#s.add_runtime_dependency('supply_drop')
# misc gems
- s.add_runtime_dependency('ya2yaml') # pure ruby yaml, so we can better control output.
+ s.add_runtime_dependency('ya2yaml') # pure ruby yaml, so we can better control output. see https://github.com/afunai/ya2yaml
s.add_runtime_dependency('json_pure') # pure ruby json, so we can better control output.
s.add_runtime_dependency('gpgme') # not essential, but used for some minor stuff in adding sysadmins
arg_name '<node filter>'
command :deploy do |c|
c.action do |global_options,options,args|
+ init_submodules
+
nodes = manager.filter!(args)
if nodes.size > 1
say "Deploying to these nodes: #{nodes.keys.join(', ')}"
quit! "OK. Bye."
end
end
+
ssh_connect(nodes) do |ssh|
# directory setup
ssh.leap.mkdir("/etc/leap")
end
end
+ private
+
+ def init_submodules
+ Dir.chdir Path.platform do
+ statuses = assert_run! "git submodule status"
+ statuses.strip.split("\n").each do |status_line|
+ if status_line =~ /^-/
+ submodule = status_line.split(' ')[1]
+ progress "Updating submodule #{submodule}"
+ assert_run! "git submodule update --init #{submodule}"
+ end
+ end
+ end
+ end
+
end
end
\ No newline at end of file
# assert that the command is run without an error.
# if successful, return output.
#
- def assert_run!(cmd, message)
- log2(" * run: #{cmd}")
+ def assert_run!(cmd, message=nil)
cmd = cmd + " 2>&1"
output = `#{cmd}`
- assert!($?.success?, message)
+ unless $?.success?
+ log1(" * run: #{cmd}")
+ log1(" * FAILED: (exit #{$?}) #{output}")
+ else
+ log2(" * run: #{cmd}")
+ end
return output
end