Class: EY::CLI
Constant Summary
Constants included from Dataflow
Dataflow::UnificationError, Dataflow::VERSION
Constants inherited from Thor
Thor::HELP_MAPPINGS, Thor::THOR_RESERVED_WORDS, Thor::VERSION
Instance Attribute Summary
Attributes included from Thor::Base
Class Method Summary collapse
Instance Method Summary collapse
- #deploy(default_task = :deploy) ⇒ Object
- #hook(hook_name) ⇒ Object
- #install_bundler(version) ⇒ Object
- #propagate ⇒ Object
Methods included from Dataflow
#barrier, #by_need, #flow, included, #local, #need_later, #unify
Methods inherited from Thor
default_task, desc, handle_argument_error, #help, help, map, method_option, method_options, printable_tasks, task_help
Methods included from Thor::Base
included, #initialize, register_klass_file, shell, shell=, subclass_files, subclasses
Class Method Details
.start ⇒ Object
7 8 9 10 11 |
# File 'lib/ey-deploy/cli.rb', line 7 def self.start(*) super rescue RemoteFailure exit(1) end |
Instance Method Details
#deploy(default_task = :deploy) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/ey-deploy/cli.rb', line 50 def deploy(default_task=:deploy) EY::Server.all = parse_instances([:instances]) EY::LoggedOutput.verbose = [:verbose] EY::LoggedOutput.logfile = File.join(ENV['HOME'], "#{[:app]}-deploy.log") invoke :propagate EY::Deploy.run(.merge("default_task" => default_task)) end |
#hook(hook_name) ⇒ Object
83 84 85 |
# File 'lib/ey-deploy/cli.rb', line 83 def hook(hook_name) EY::DeployHook.new().run(hook_name) end |
#install_bundler(version) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ey-deploy/cli.rb', line 88 def install_bundler(version) egrep_escaped_version = version.gsub(/\./, '\.') # the grep "bundler " is so that gems like bundler08 don't get # their versions considered too # # the [,$] is to stop us from looking for e.g. 0.9.2, seeing # 0.9.22, and mistakenly thinking 0.9.2 is there has_bundler_cmd = "gem list bundler | grep \"bundler \" | egrep -q '#{egrep_escaped_version}[,)]'" unless system(has_bundler_cmd) system("gem install bundler -q --no-rdoc --no-ri -v '#{version}'") end end |
#propagate ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/ey-deploy/cli.rb', line 103 def propagate config = EY::Deploy::Configuration.new gem_filename = "ey-deploy-#{VERSION}.gem" local_gem_file = File.join(Gem.dir, 'cache', gem_filename) remote_gem_file = File.join(Dir.tmpdir, gem_filename) gem_binary = File.join(Gem.default_bindir, 'gem') EY::Server.config = config (*(EY::Server.all.find_all do |server| !server.local? # of course this machine has it end.map do |server| need_later do egrep_escaped_version = VERSION.gsub(/\./, '\.') # the [,)] is to stop us from looking for e.g. 0.5.1, seeing # 0.5.11, and mistakenly thinking 0.5.1 is there has_gem_cmd = "#{gem_binary} list ey-deploy | grep \"ey-deploy \" | egrep -q '#{egrep_escaped_version}[,)]'" if !server.run(has_gem_cmd) # doesn't have this exact version puts "~> Installing ey-deploy on #{server.hostname}" system(Escape.shell_command([ 'scp', '-i', "#{ENV['HOME']}/.ssh/internal", "-o", "StrictHostKeyChecking=no", local_gem_file, "#{config.user}@#{server.hostname}:#{remote_gem_file}", ])) server.run("sudo #{gem_binary} install --no-rdoc --no-ri '#{remote_gem_file}'") end end end)) end |