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
#options
Class Method Summary
collapse
Instance Method Summary
collapse
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
8
9
10
11
12
|
# File 'lib/engineyard-serverside/cli.rb', line 8
def self.start(*)
super
rescue RemoteFailure
exit(1)
end
|
Instance Method Details
#deploy(default_task = :deploy) ⇒ Object
#hook(hook_name) ⇒ Object
95
96
97
|
# File 'lib/engineyard-serverside/cli.rb', line 95
def hook(hook_name)
EY::DeployHook.new(options).run(hook_name)
end
|
#install_bundler(version) ⇒ Object
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# File 'lib/engineyard-serverside/cli.rb', line 164
def install_bundler(version)
egrep_escaped_version = version.gsub(/\./, '\.')
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
|
#integrate ⇒ Object
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'lib/engineyard-serverside/cli.rb', line 129
def integrate
EY::LoggedOutput.verbose = options[:verbose]
EY::LoggedOutput.logfile = File.join(ENV['HOME'], "#{options[:app]}-integrate.log")
app_dir = Pathname.new "/data/#{options[:app]}"
current_app_dir = app_dir + "current"
integrate_options = options.dup
integrate_options[:release_path] = current_app_dir.realpath.to_s
integrate_options[:branch] = (current_app_dir + 'REVISION').read.strip
config = EY::Deploy::Configuration.new(integrate_options)
EY::Server.load_all_from_array(assemble_instance_hashes(config))
invoke :propagate
EY::Server.all.each do |server|
server.sync_directory app_dir
server.run("rm -rf #{current_app_dir}")
end
EY::Deploy.new(config).cached_deploy
end
|
#propagate ⇒ Object
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# File 'lib/engineyard-serverside/cli.rb', line 179
def propagate
config = EY::Deploy::Configuration.new
gem_filename = "engineyard-serverside-#{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')
barrier(*(EY::Server.all.find_all do |server|
!server.local? end.map do |server|
need_later do
egrep_escaped_version = VERSION.gsub(/\./, '\.')
has_gem_cmd = "#{gem_binary} list engineyard-serverside | grep \"engineyard-serverside\" | egrep -q '#{egrep_escaped_version}[,)]'"
if !server.run(has_gem_cmd) puts "~> Installing engineyard-serverside 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
|