Sha256: 02b47cf1356b18e741aadd209f1cf0e66eac01b33d2a5aa0c5ff6ad56fa283ea
Contents?: true
Size: 1.06 KB
Versions: 8
Compression:
Stored size: 1.06 KB
Contents
require 'rubygems' require 'aerosol' require 'clamp' class Aerosol::AbstractCommand < Clamp::Command option ['-f', '--file'], 'FILE', 'aerosol file to read', :default => 'aerosol.rb', :attribute_name => :file def execute if File.exist?(file) Aerosol.load_file = file else raise 'Could not find an aerosol file!' end end end class Aerosol::SshCommand < Aerosol::AbstractCommand option ['-r', '--run'], :flag, 'run first ssh command', :attribute_name => :run_first parameter 'DEPLOY', 'the deploy to list commands for', :attribute_name => :deploy_name def execute super if deploy = Aerosol.deploy(deploy_name.to_sym) ssh_commands = deploy.generate_ssh_commands raise 'No instances to ssh too!' if ssh_commands.empty? ssh_commands.each do |ssh_command| puts ssh_command end if run_first? system(ssh_commands.first) end end end end class Aerosol::Cli < Aerosol::AbstractCommand subcommand ['ssh', 's'], 'Print ssh commands for latest running instances', Aerosol::SshCommand end
Version data entries
8 entries across 8 versions & 1 rubygems