engineyard-serverside 1.5.21 → 1.5.23.ruby19
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside/cli.rb +39 -45
- data/lib/engineyard-serverside/configuration.rb +28 -4
- data/lib/engineyard-serverside/deploy.rb +5 -4
- data/lib/engineyard-serverside/logged_output.rb +3 -5
- data/lib/engineyard-serverside/server.rb +26 -2
- data/lib/engineyard-serverside/task.rb +2 -4
- data/lib/engineyard-serverside/version.rb +1 -1
- data/lib/engineyard-serverside.rb +8 -20
- data/spec/basic_deploy_spec.rb +1 -1
- data/spec/bundler_deploy_spec.rb +1 -1
- data/spec/nodejs_deploy_spec.rb +1 -1
- data/spec/rails31_deploy_spec.rb +1 -1
- data/spec/services_deploy_spec.rb +1 -1
- metadata +80 -233
- data/lib/vendor/dataflow/HISTORY +0 -52
- data/lib/vendor/dataflow/LICENSE +0 -19
- data/lib/vendor/dataflow/README.textile +0 -290
- data/lib/vendor/dataflow/Rakefile +0 -36
- data/lib/vendor/dataflow/dataflow/actor.rb +0 -22
- data/lib/vendor/dataflow/dataflow/equality.rb +0 -44
- data/lib/vendor/dataflow/dataflow/future_queue.rb +0 -24
- data/lib/vendor/dataflow/dataflow/port.rb +0 -54
- data/lib/vendor/dataflow/dataflow.rb +0 -124
- data/lib/vendor/dataflow/examples/barrier.rb +0 -9
- data/lib/vendor/dataflow/examples/data_driven.rb +0 -17
- data/lib/vendor/dataflow/examples/dataflow_http_gets.rb +0 -13
- data/lib/vendor/dataflow/examples/flow.rb +0 -20
- data/lib/vendor/dataflow/examples/future_http_gets.rb +0 -12
- data/lib/vendor/dataflow/examples/future_queue.rb +0 -11
- data/lib/vendor/dataflow/examples/instance_variables.rb +0 -15
- data/lib/vendor/dataflow/examples/laziness.rb +0 -9
- data/lib/vendor/dataflow/examples/local_variables.rb +0 -11
- data/lib/vendor/dataflow/examples/messages.rb +0 -26
- data/lib/vendor/dataflow/examples/port_http_gets.rb +0 -13
- data/lib/vendor/dataflow/examples/port_send.rb +0 -10
- data/lib/vendor/dataflow/examples/ring.rb +0 -21
- data/lib/vendor/dataflow/spec/actor_spec.rb +0 -28
- data/lib/vendor/dataflow/spec/anonymous_variables_spec.rb +0 -21
- data/lib/vendor/dataflow/spec/barrier_spec.rb +0 -25
- data/lib/vendor/dataflow/spec/by_need_spec.rb +0 -55
- data/lib/vendor/dataflow/spec/dataflow_spec.rb +0 -151
- data/lib/vendor/dataflow/spec/equality_spec.rb +0 -40
- data/lib/vendor/dataflow/spec/flow_spec.rb +0 -25
- data/lib/vendor/dataflow/spec/forker_spec.rb +0 -28
- data/lib/vendor/dataflow/spec/future_queue_spec.rb +0 -31
- data/lib/vendor/dataflow/spec/inspect_spec.rb +0 -19
- data/lib/vendor/dataflow/spec/need_later_spec.rb +0 -12
- data/lib/vendor/dataflow/spec/port_spec.rb +0 -26
- data/lib/vendor/dataflow/spec/spec.opts +0 -1
- data/lib/vendor/dataflow/spec/spec_helper.rb +0 -10
- data/lib/vendor/escape/Readme +0 -21
- data/lib/vendor/escape/doc_include/template/qualitysmith.rb +0 -631
- data/lib/vendor/json_pure/CHANGES +0 -166
- data/lib/vendor/json_pure/COPYING +0 -58
- data/lib/vendor/json_pure/GPL +0 -340
- data/lib/vendor/json_pure/README +0 -358
- data/lib/vendor/json_pure/Rakefile +0 -292
- data/lib/vendor/json_pure/TODO +0 -1
- data/lib/vendor/json_pure/VERSION +0 -1
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +0 -52
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +0 -1000
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +0 -1001
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +0 -900
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +0 -901
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +0 -1000
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +0 -1001
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +0 -261
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +0 -1000
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +0 -1001
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +0 -1000
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +0 -1001
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +0 -1000
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +0 -1001
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +0 -262
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +0 -1000
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +0 -1001
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +0 -82
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +0 -34
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +0 -900
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +0 -901
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +0 -81
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +0 -1000
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +0 -1001
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +0 -82
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +0 -1000
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +0 -1001
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +0 -82
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +0 -1000
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +0 -1001
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +0 -82
- data/lib/vendor/json_pure/benchmarks/generator2_benchmark.rb +0 -222
- data/lib/vendor/json_pure/benchmarks/generator_benchmark.rb +0 -224
- data/lib/vendor/json_pure/benchmarks/ohai.json +0 -1216
- data/lib/vendor/json_pure/benchmarks/ohai.ruby +0 -1
- data/lib/vendor/json_pure/benchmarks/parser2_benchmark.rb +0 -251
- data/lib/vendor/json_pure/benchmarks/parser_benchmark.rb +0 -259
- data/lib/vendor/json_pure/bin/edit_json.rb +0 -9
- data/lib/vendor/json_pure/bin/prettify_json.rb +0 -75
- data/lib/vendor/json_pure/data/example.json +0 -1
- data/lib/vendor/json_pure/data/index.html +0 -38
- data/lib/vendor/json_pure/data/prototype.js +0 -4184
- data/lib/vendor/json_pure/ext/json/ext/generator/extconf.rb +0 -16
- data/lib/vendor/json_pure/ext/json/ext/generator/generator.c +0 -1323
- data/lib/vendor/json_pure/ext/json/ext/generator/generator.h +0 -170
- data/lib/vendor/json_pure/ext/json/ext/parser/extconf.rb +0 -15
- data/lib/vendor/json_pure/ext/json/ext/parser/parser.c +0 -1935
- data/lib/vendor/json_pure/ext/json/ext/parser/parser.h +0 -71
- data/lib/vendor/json_pure/ext/json/ext/parser/parser.rl +0 -792
- data/lib/vendor/json_pure/install.rb +0 -26
- data/lib/vendor/json_pure/tests/fixtures/fail1.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail10.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail11.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail12.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail13.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail14.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail18.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail19.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail2.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail20.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail21.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail22.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail23.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail24.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail25.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail27.json +0 -2
- data/lib/vendor/json_pure/tests/fixtures/fail28.json +0 -2
- data/lib/vendor/json_pure/tests/fixtures/fail3.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail4.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail5.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail6.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail7.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail8.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/fail9.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/pass1.json +0 -56
- data/lib/vendor/json_pure/tests/fixtures/pass15.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/pass16.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/pass17.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/pass2.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/pass26.json +0 -1
- data/lib/vendor/json_pure/tests/fixtures/pass3.json +0 -6
- data/lib/vendor/json_pure/tests/test_json.rb +0 -361
- data/lib/vendor/json_pure/tests/test_json_addition.rb +0 -162
- data/lib/vendor/json_pure/tests/test_json_encoding.rb +0 -68
- data/lib/vendor/json_pure/tests/test_json_fixtures.rb +0 -34
- data/lib/vendor/json_pure/tests/test_json_generate.rb +0 -122
- data/lib/vendor/json_pure/tests/test_json_rails.rb +0 -144
- data/lib/vendor/json_pure/tests/test_json_unicode.rb +0 -76
- data/lib/vendor/json_pure/tools/fuzz.rb +0 -139
- data/lib/vendor/json_pure/tools/server.rb +0 -61
- data/lib/vendor/open4/lib/open4.rb +0 -403
- data/lib/vendor/thor/CHANGELOG.rdoc +0 -89
- data/lib/vendor/thor/LICENSE +0 -20
- data/lib/vendor/thor/README.rdoc +0 -297
- data/lib/vendor/thor/Thorfile +0 -69
- data/lib/vendor/thor/bin/rake2thor +0 -86
- data/lib/vendor/thor/bin/thor +0 -6
- data/lib/vendor/thor/lib/thor/actions/create_file.rb +0 -103
- data/lib/vendor/thor/lib/thor/actions/directory.rb +0 -91
- data/lib/vendor/thor/lib/thor/actions/empty_directory.rb +0 -134
- data/lib/vendor/thor/lib/thor/actions/file_manipulation.rb +0 -223
- data/lib/vendor/thor/lib/thor/actions/inject_into_file.rb +0 -104
- data/lib/vendor/thor/lib/thor/actions.rb +0 -275
- data/lib/vendor/thor/lib/thor/base.rb +0 -540
- data/lib/vendor/thor/lib/thor/core_ext/file_binary_read.rb +0 -9
- data/lib/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +0 -75
- data/lib/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -100
- data/lib/vendor/thor/lib/thor/error.rb +0 -30
- data/lib/vendor/thor/lib/thor/group.rb +0 -271
- data/lib/vendor/thor/lib/thor/invocation.rb +0 -180
- data/lib/vendor/thor/lib/thor/parser/argument.rb +0 -67
- data/lib/vendor/thor/lib/thor/parser/arguments.rb +0 -150
- data/lib/vendor/thor/lib/thor/parser/option.rb +0 -128
- data/lib/vendor/thor/lib/thor/parser/options.rb +0 -169
- data/lib/vendor/thor/lib/thor/parser.rb +0 -4
- data/lib/vendor/thor/lib/thor/rake_compat.rb +0 -66
- data/lib/vendor/thor/lib/thor/runner.rb +0 -314
- data/lib/vendor/thor/lib/thor/shell/basic.rb +0 -239
- data/lib/vendor/thor/lib/thor/shell/color.rb +0 -108
- data/lib/vendor/thor/lib/thor/shell.rb +0 -83
- data/lib/vendor/thor/lib/thor/task.rb +0 -102
- data/lib/vendor/thor/lib/thor/util.rb +0 -230
- data/lib/vendor/thor/lib/thor/version.rb +0 -3
- data/lib/vendor/thor/lib/thor.rb +0 -244
- data/lib/vendor/thor/thor.gemspec +0 -120
@@ -1,16 +1,8 @@
|
|
1
|
-
require 'thor'
|
2
1
|
require 'pathname'
|
3
2
|
|
4
3
|
module EY
|
5
4
|
module Serverside
|
6
5
|
class CLI < Thor
|
7
|
-
include Dataflow
|
8
|
-
|
9
|
-
def self.start(*)
|
10
|
-
super
|
11
|
-
rescue RemoteFailure
|
12
|
-
exit(1)
|
13
|
-
end
|
14
6
|
|
15
7
|
method_option :migrate, :type => :string,
|
16
8
|
:desc => "Run migrations with this deploy",
|
@@ -56,14 +48,14 @@ module EY
|
|
56
48
|
:aliases => ["-v"]
|
57
49
|
|
58
50
|
desc "deploy", "Deploy code from /data/<app>"
|
59
|
-
def deploy(default_task
|
51
|
+
def deploy(default_task = :deploy)
|
60
52
|
config = EY::Serverside::Deploy::Configuration.new(options)
|
61
53
|
EY::Serverside::Server.load_all_from_array(assemble_instance_hashes(config))
|
62
54
|
|
63
55
|
EY::Serverside::LoggedOutput.verbose = options[:verbose]
|
64
56
|
EY::Serverside::LoggedOutput.logfile = File.join(ENV['HOME'], "#{options[:app]}-deploy.log")
|
65
57
|
|
66
|
-
|
58
|
+
propagate
|
67
59
|
|
68
60
|
EY::Serverside::Deploy.new(config).send(default_task)
|
69
61
|
end
|
@@ -144,7 +136,7 @@ module EY
|
|
144
136
|
|
145
137
|
EY::Serverside::Server.load_all_from_array(assemble_instance_hashes(config))
|
146
138
|
|
147
|
-
|
139
|
+
propagate
|
148
140
|
|
149
141
|
EY::Serverside::Server.all.each do |server|
|
150
142
|
server.sync_directory app_dir
|
@@ -190,56 +182,39 @@ module EY
|
|
190
182
|
config = EY::Serverside::Deploy::Configuration.new(options)
|
191
183
|
EY::Serverside::Server.load_all_from_array(assemble_instance_hashes(config))
|
192
184
|
|
193
|
-
|
185
|
+
propagate
|
194
186
|
|
195
187
|
EY::Serverside::Deploy.new(config).restart_with_maintenance_page
|
196
188
|
end
|
197
189
|
|
198
|
-
|
190
|
+
desc "install_bundler [VERSION]", "Make sure VERSION of bundler is installed (in system ruby)"
|
199
191
|
def install_bundler(version)
|
200
|
-
|
201
|
-
# the grep "bundler " is so that gems like bundler08 don't get
|
202
|
-
# their versions considered too
|
203
|
-
#
|
204
|
-
# the [,$] is to stop us from looking for e.g. 0.9.2, seeing
|
205
|
-
# 0.9.22, and mistakenly thinking 0.9.2 is there
|
206
|
-
has_bundler_cmd = "gem list bundler | grep \"bundler \" | egrep -q '#{egrep_escaped_version}[,)]'"
|
192
|
+
has_bundler_cmd = "gem list -i bundler -v '#{verison}'"
|
207
193
|
|
208
194
|
unless system(has_bundler_cmd)
|
209
195
|
system("gem install bundler -q --no-rdoc --no-ri -v '#{version}'")
|
210
196
|
end
|
211
197
|
end
|
212
198
|
|
213
|
-
|
199
|
+
desc "propagate", "Propagate the engineyard-serverside gem to the other instances in the cluster. This will install exactly version #{EY::Serverside::VERSION}."
|
214
200
|
def propagate
|
215
|
-
|
216
|
-
|
217
|
-
local_gem_file = File.join(Gem.dir, 'cache', gem_filename)
|
218
|
-
remote_gem_file = File.join(Dir.tmpdir, gem_filename)
|
219
|
-
gem_binary = File.join(Gem.default_bindir, 'gem')
|
220
|
-
|
221
|
-
barrier(*(EY::Serverside::Server.all.find_all do |server|
|
201
|
+
ey_server_side = Dependency.new('engineyard-serverside', EY::Serverside::VERSION)
|
202
|
+
futures = EY::Serverside::Server.all.find_all do |server|
|
222
203
|
!server.local? # of course this machine has it
|
223
204
|
end.map do |server|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
system(Escape.shell_command([
|
234
|
-
'scp', '-i', "#{ENV['HOME']}/.ssh/internal",
|
235
|
-
"-o", "StrictHostKeyChecking=no",
|
236
|
-
local_gem_file,
|
237
|
-
"#{config.user}@#{server.hostname}:#{remote_gem_file}",
|
238
|
-
]))
|
239
|
-
server.run("sudo #{gem_binary} install --no-rdoc --no-ri '#{remote_gem_file}'")
|
205
|
+
Celluloid::Future.new do
|
206
|
+
unless server.gem?(ey_server_side.name, ey_server_side.version)
|
207
|
+
(dependencies + [ey_server_side]).each do |dependency|
|
208
|
+
unless server.gem?(dependency.name, dependency.version)
|
209
|
+
puts "~> Installing #{dependency.name} on #{server.hostname}"
|
210
|
+
server.copy(dependency.local_path, dependency.remote_path)
|
211
|
+
server.install_gem(dependency.remote_path)
|
212
|
+
end
|
213
|
+
end
|
240
214
|
end
|
241
215
|
end
|
242
|
-
end
|
216
|
+
end
|
217
|
+
futures.all?{|x| x.value == true } || raise(EY::Serverside::RemoteFailure.new("Error installing engineyard-serverside dependencies"))
|
243
218
|
end
|
244
219
|
|
245
220
|
private
|
@@ -253,6 +228,25 @@ module EY
|
|
253
228
|
}
|
254
229
|
}
|
255
230
|
end
|
231
|
+
|
232
|
+
def dependencies
|
233
|
+
[Dependency.new('hashie', Hashie::VERSION),
|
234
|
+
Dependency.new('celluloid', Celluloid::VERSION),
|
235
|
+
Dependency.new('posix-spawn', POSIX::Spawn::VERSION),
|
236
|
+
Dependency.new('thor', '0.13.3')]
|
237
|
+
end
|
238
|
+
|
239
|
+
class Dependency
|
240
|
+
attr_reader :name, :version
|
241
|
+
def initialize(name, version)
|
242
|
+
@name = name
|
243
|
+
@version = version
|
244
|
+
end
|
245
|
+
|
246
|
+
def gemname; "#{name}-#{version}.gem"; end
|
247
|
+
def local_path; File.expand_path(File.join('cache', gemname), Gem.dir); end
|
248
|
+
def remote_path; File.expand_path(gemname, Dir.tmpdir); end
|
249
|
+
end
|
256
250
|
end
|
257
251
|
end
|
258
252
|
end
|
@@ -1,13 +1,37 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'thor'
|
3
1
|
|
4
2
|
module EY
|
5
3
|
module Serverside
|
4
|
+
# Really simple and hacked implementation that works for the 99.9999% of the cases
|
5
|
+
class HashWithIndifferentAccess
|
6
|
+
def initialize(hash = {})
|
7
|
+
@internal = {}
|
8
|
+
hash.each do |k, v|
|
9
|
+
@internal[k.to_s] = v
|
10
|
+
end
|
11
|
+
end
|
12
|
+
def [](name)
|
13
|
+
@internal[name.to_s]
|
14
|
+
end
|
15
|
+
def []=(name, value)
|
16
|
+
@internal[name.to_s] = value
|
17
|
+
end
|
18
|
+
|
19
|
+
def method_missing(method, *args, &block)
|
20
|
+
if @internal.key?(method.to_s)
|
21
|
+
@internal[method.to_s]
|
22
|
+
else
|
23
|
+
@internal.send(method, args, &block)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
6
28
|
class Deploy::Configuration
|
7
|
-
|
29
|
+
require 'json'
|
30
|
+
|
31
|
+
DEFAULT_CONFIG = Hashie::Mash.new({
|
8
32
|
"branch" => "master",
|
9
33
|
"strategy" => "Git",
|
10
|
-
"bundle_without" => "test development"
|
34
|
+
"bundle_without" => "test development"
|
11
35
|
})
|
12
36
|
|
13
37
|
attr_reader :configuration
|
@@ -145,9 +145,10 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
|
|
145
145
|
# task
|
146
146
|
def push_code
|
147
147
|
info "~> Pushing code to all servers"
|
148
|
-
|
149
|
-
|
150
|
-
end
|
148
|
+
futures = EY::Serverside::Server.all.map do |server|
|
149
|
+
Celluloid:: Future.new { server.sync_directory(config.repository_cache) }
|
150
|
+
end
|
151
|
+
futures.all? {|f| f.value == true}
|
151
152
|
end
|
152
153
|
|
153
154
|
# task
|
@@ -161,7 +162,7 @@ To fix this problem, commit your Gemfile.lock to your repository and redeploy.
|
|
161
162
|
end
|
162
163
|
|
163
164
|
def restart_command
|
164
|
-
"/engineyard/bin/app_#{c.app} deploy
|
165
|
+
%{LANG="en_US.UTF-8" /engineyard/bin/app_#{c.app} deploy}
|
165
166
|
end
|
166
167
|
|
167
168
|
# GIT_SSH needs to be defined in the environment for customers with private bundler repos in their Gemfile.
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'open4'
|
2
|
-
|
3
1
|
module EY
|
4
2
|
module Serverside
|
5
3
|
module LoggedOutput
|
@@ -64,9 +62,9 @@ module EY
|
|
64
62
|
|
65
63
|
out << ":: running #{cmd}\n"
|
66
64
|
|
67
|
-
|
68
|
-
status =
|
69
|
-
status.
|
65
|
+
pid = POSIX::Spawn::spawn(cmd, :out => out, :err => err)
|
66
|
+
status = Process::waitpid(pid)
|
67
|
+
status.success?
|
70
68
|
end
|
71
69
|
end
|
72
70
|
|
@@ -83,12 +83,36 @@ module EY
|
|
83
83
|
if local?
|
84
84
|
logged_system(command)
|
85
85
|
else
|
86
|
-
logged_system(ssh_command +
|
86
|
+
logged_system(ssh_command + Escape.shell_command(["#{user}@#{hostname}", command]))
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
def copy(local_file, remote_file)
|
91
|
+
logged_system(scp_command + Escape.shell_command([local_file, "#{user}@#{hostname}:#{remote_file}"]))
|
92
|
+
end
|
93
|
+
|
90
94
|
def ssh_command
|
91
|
-
"ssh
|
95
|
+
"ssh #{ssh_options} "
|
96
|
+
end
|
97
|
+
|
98
|
+
def scp_command
|
99
|
+
"scp #{ssh_options} "
|
100
|
+
end
|
101
|
+
|
102
|
+
def ssh_options
|
103
|
+
"-i #{ENV['HOME']}/.ssh/internal -o StrictHostKeyChecking=no -o PasswordAuthentication=no"
|
104
|
+
end
|
105
|
+
|
106
|
+
def gem?(name, version)
|
107
|
+
run("#{gem_command} list -i #{name} -v '#{version}'")
|
108
|
+
end
|
109
|
+
|
110
|
+
def install_gem(path)
|
111
|
+
run("#{gem_command} install --no-ri --no-rdoc #{path}")
|
112
|
+
end
|
113
|
+
|
114
|
+
def gem_command
|
115
|
+
File.expand_path('gem', Gem.default_bindir)
|
92
116
|
end
|
93
117
|
|
94
118
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module EY
|
2
2
|
module Serverside
|
3
3
|
class Task
|
4
|
-
include Dataflow
|
5
4
|
|
6
5
|
attr_reader :config
|
7
6
|
alias :c :config
|
@@ -51,13 +50,12 @@ module EY
|
|
51
50
|
def run_on_roles(cmd, wrapper=%w[sh -l -c])
|
52
51
|
results = EY::Serverside::Server.from_roles(@roles).map do |server|
|
53
52
|
to_run = block_given? ? yield(server, cmd.dup) : cmd
|
54
|
-
|
53
|
+
Celluloid::Future.new { server.run(Escape.shell_command(wrapper + [to_run])) }
|
55
54
|
end
|
56
|
-
barrier *results
|
57
55
|
# MRI's truthiness check is an internal C thing that does not call
|
58
56
|
# any methods... so Dataflow cannot proxy it & we must "x == true"
|
59
57
|
# Rubinius, wherefore art thou!?
|
60
|
-
results.all?{|x| x == true } || raise(EY::Serverside::RemoteFailure.new(cmd))
|
58
|
+
results.all?{|x| x.value == true } || raise(EY::Serverside::RemoteFailure.new(cmd))
|
61
59
|
end
|
62
60
|
|
63
61
|
end
|
@@ -1,21 +1,15 @@
|
|
1
|
-
|
2
|
-
$string_encodings = true
|
3
|
-
else
|
4
|
-
# KCODE is gone in 1.9-like implementations, but we
|
5
|
-
# still need to set it for 1.8.
|
6
|
-
$KCODE = 'U'
|
7
|
-
$string_encodings = false
|
8
|
-
end
|
1
|
+
# encoding: utf-8
|
9
2
|
|
10
|
-
$LOAD_PATH.unshift File.expand_path('vendor/thor/lib', File.dirname(__FILE__))
|
11
|
-
$LOAD_PATH.unshift File.expand_path('vendor/open4/lib', File.dirname(__FILE__))
|
12
3
|
$LOAD_PATH.unshift File.expand_path('vendor/escape/lib', File.dirname(__FILE__))
|
13
4
|
$LOAD_PATH.unshift File.expand_path('vendor/json_pure/lib', File.dirname(__FILE__))
|
14
|
-
$LOAD_PATH.unshift File.expand_path('vendor/dataflow', File.dirname(__FILE__))
|
15
5
|
|
16
6
|
require 'escape'
|
17
7
|
require 'json'
|
18
|
-
require '
|
8
|
+
require 'posix/spawn'
|
9
|
+
require 'tmpdir'
|
10
|
+
require 'celluloid'
|
11
|
+
require 'hashie/mash'
|
12
|
+
require 'hashie/version'
|
19
13
|
|
20
14
|
require 'engineyard-serverside/version'
|
21
15
|
require 'engineyard-serverside/strategies/git'
|
@@ -43,7 +37,7 @@ module EY
|
|
43
37
|
private # doesn't work how people think, but hey..
|
44
38
|
def self.deep_indifferentize(thing)
|
45
39
|
if thing.kind_of?(Hash)
|
46
|
-
indifferent_hash =
|
40
|
+
indifferent_hash = Hashie::Mash.new
|
47
41
|
thing.each do |k, v|
|
48
42
|
indifferent_hash[k] = deep_indifferentize(v)
|
49
43
|
end
|
@@ -60,13 +54,7 @@ module EY
|
|
60
54
|
end
|
61
55
|
|
62
56
|
def self.read_encoded_dna
|
63
|
-
|
64
|
-
`sudo cat #{dna_path}`
|
65
|
-
else
|
66
|
-
'{}'
|
67
|
-
end
|
68
|
-
json.force_encoding('UTF-8') if $string_encodings
|
69
|
-
json
|
57
|
+
File.exist?(dna_path) ? File.read(dna_path) : '{}'
|
70
58
|
end
|
71
59
|
end
|
72
60
|
end
|
data/spec/basic_deploy_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe "Deploying an application without Bundler" do
|
|
4
4
|
before(:all) do
|
5
5
|
$DISABLE_GEMFILE = true # Don't generate Gemfile/Gemfile.lock
|
6
6
|
$DISABLE_LOCKFILE = true
|
7
|
-
@deploy_dir = Pathname.new(Dir.
|
7
|
+
@deploy_dir = Pathname.new(Dir.mktmpdir("serverside-deploy-#{Time.now.to_i}-#{$$}"))
|
8
8
|
|
9
9
|
# set up EY::Serverside::Server like we're on a solo
|
10
10
|
EY::Serverside::Server.reset
|
data/spec/bundler_deploy_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe "Deploying an application that uses Bundler" do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def deploy_test_application
|
10
|
-
@deploy_dir =
|
10
|
+
@deploy_dir = Dir.mktmpdir("serverside-deploy-#{Time.now.to_i}-#{$$}")
|
11
11
|
|
12
12
|
# set up EY::Serverside::Server like we're on a solo
|
13
13
|
EY::Serverside::Server.reset
|
data/spec/nodejs_deploy_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "Deploying an application that uses Node.js and NPM" do
|
4
4
|
def deploy_test_application
|
5
|
-
@deploy_dir =
|
5
|
+
@deploy_dir = Dir.mktmpdir( "serverside-deploy-#{Time.now.to_i}-#{$$}")
|
6
6
|
|
7
7
|
# set up EY::Serverside::Server like we're on a solo
|
8
8
|
EY::Serverside::Server.reset
|
data/spec/rails31_deploy_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe "Deploying a Rails 3.1 application" do
|
|
4
4
|
def deploy_test_application(assets_enabled = true, &block)
|
5
5
|
$DISABLE_GEMFILE = false
|
6
6
|
$DISABLE_LOCKFILE = false
|
7
|
-
@deploy_dir =
|
7
|
+
@deploy_dir = Dir.mktmpdir("serverside-deploy-#{Time.now.to_i}-#{$$}")
|
8
8
|
|
9
9
|
# set up EY::Serverside::Server like we're on a solo
|
10
10
|
EY::Serverside::Server.reset
|
@@ -4,7 +4,7 @@ describe "Deploying an application with services" do
|
|
4
4
|
before(:each) do
|
5
5
|
#$DISABLE_GEMFILE = true # Don't generate Gemfile/Gemfile.lock
|
6
6
|
#$DISABLE_LOCKFILE = true
|
7
|
-
@deploy_dir = Pathname.new(Dir.
|
7
|
+
@deploy_dir = Pathname.new(Dir.mktmpdir("serverside-deploy-#{Time.now.to_i}-#{$$}"))
|
8
8
|
|
9
9
|
# set up EY::Serverside::Server like we're on a solo
|
10
10
|
EY::Serverside::Server.reset
|