engineyard-serverside 1.5.23.ruby19.16 → 1.5.24
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside.rb +19 -17
- data/lib/engineyard-serverside/cli.rb +38 -30
- data/lib/engineyard-serverside/configuration.rb +4 -28
- data/lib/engineyard-serverside/deploy.rb +10 -7
- data/lib/engineyard-serverside/lockfile_parser.rb +2 -2
- data/lib/engineyard-serverside/logged_output.rb +2 -0
- data/lib/engineyard-serverside/server.rb +2 -27
- data/lib/engineyard-serverside/task.rb +14 -10
- data/lib/engineyard-serverside/version.rb +1 -1
- data/lib/vendor/dataflow/HISTORY +52 -0
- data/lib/vendor/dataflow/LICENSE +19 -0
- data/lib/vendor/dataflow/README.textile +290 -0
- data/lib/vendor/dataflow/Rakefile +36 -0
- data/lib/vendor/dataflow/examples/barrier.rb +9 -0
- data/lib/vendor/dataflow/examples/data_driven.rb +17 -0
- data/lib/vendor/dataflow/examples/dataflow_http_gets.rb +13 -0
- data/lib/vendor/dataflow/examples/flow.rb +20 -0
- data/lib/vendor/dataflow/examples/future_http_gets.rb +12 -0
- data/lib/vendor/dataflow/examples/future_queue.rb +11 -0
- data/lib/vendor/dataflow/examples/instance_variables.rb +15 -0
- data/lib/vendor/dataflow/examples/laziness.rb +9 -0
- data/lib/vendor/dataflow/examples/local_variables.rb +11 -0
- data/lib/vendor/dataflow/examples/messages.rb +26 -0
- data/lib/vendor/dataflow/examples/port_http_gets.rb +13 -0
- data/lib/vendor/dataflow/examples/port_send.rb +10 -0
- data/lib/vendor/dataflow/examples/ring.rb +21 -0
- data/lib/vendor/dataflow/spec/actor_spec.rb +28 -0
- data/lib/vendor/dataflow/spec/anonymous_variables_spec.rb +21 -0
- data/lib/vendor/dataflow/spec/barrier_spec.rb +25 -0
- data/lib/vendor/dataflow/spec/by_need_spec.rb +55 -0
- data/lib/vendor/dataflow/spec/dataflow_spec.rb +151 -0
- data/lib/vendor/dataflow/spec/equality_spec.rb +40 -0
- data/lib/vendor/dataflow/spec/flow_spec.rb +25 -0
- data/lib/vendor/dataflow/spec/forker_spec.rb +28 -0
- data/lib/vendor/dataflow/spec/future_queue_spec.rb +31 -0
- data/lib/vendor/dataflow/spec/inspect_spec.rb +19 -0
- data/lib/vendor/dataflow/spec/need_later_spec.rb +12 -0
- data/lib/vendor/dataflow/spec/port_spec.rb +26 -0
- data/lib/vendor/dataflow/spec/spec.opts +1 -0
- data/lib/vendor/dataflow/spec/spec_helper.rb +10 -0
- data/lib/vendor/escape/Readme +21 -0
- data/lib/vendor/escape/doc_include/template/qualitysmith.rb +631 -0
- data/lib/vendor/json_pure/CHANGES +166 -0
- data/lib/vendor/json_pure/COPYING +58 -0
- data/lib/vendor/json_pure/GPL +340 -0
- data/lib/vendor/json_pure/README +358 -0
- data/lib/vendor/json_pure/Rakefile +292 -0
- data/lib/vendor/json_pure/TODO +1 -0
- data/lib/vendor/json_pure/VERSION +1 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +52 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +1000 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +1001 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +900 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +901 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +1000 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +1001 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +261 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +1000 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +1001 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +1000 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +1001 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +1000 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +1001 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +262 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +1000 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +1001 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +82 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +34 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +900 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +901 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +81 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +1000 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +1001 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +82 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +1000 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +1001 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +82 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +1000 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +1001 -0
- data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +82 -0
- data/lib/vendor/json_pure/benchmarks/generator2_benchmark.rb +222 -0
- data/lib/vendor/json_pure/benchmarks/generator_benchmark.rb +224 -0
- data/lib/vendor/json_pure/benchmarks/ohai.json +1216 -0
- data/lib/vendor/json_pure/benchmarks/ohai.ruby +1 -0
- data/lib/vendor/json_pure/benchmarks/parser2_benchmark.rb +251 -0
- data/lib/vendor/json_pure/benchmarks/parser_benchmark.rb +259 -0
- data/lib/vendor/json_pure/bin/edit_json.rb +9 -0
- data/lib/vendor/json_pure/bin/prettify_json.rb +75 -0
- data/lib/vendor/json_pure/data/example.json +1 -0
- data/lib/vendor/json_pure/data/index.html +38 -0
- data/lib/vendor/json_pure/data/prototype.js +4184 -0
- data/lib/vendor/json_pure/ext/json/ext/generator/extconf.rb +16 -0
- data/lib/vendor/json_pure/ext/json/ext/generator/generator.c +1323 -0
- data/lib/vendor/json_pure/ext/json/ext/generator/generator.h +170 -0
- data/lib/vendor/json_pure/ext/json/ext/parser/extconf.rb +15 -0
- data/lib/vendor/json_pure/ext/json/ext/parser/parser.c +1935 -0
- data/lib/vendor/json_pure/ext/json/ext/parser/parser.h +71 -0
- data/lib/vendor/json_pure/ext/json/ext/parser/parser.rl +792 -0
- data/lib/vendor/json_pure/install.rb +26 -0
- data/lib/vendor/json_pure/tests/fixtures/fail1.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail10.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail11.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail12.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail13.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail14.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail18.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail19.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail2.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail20.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail21.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail22.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail23.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail24.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail25.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail27.json +2 -0
- data/lib/vendor/json_pure/tests/fixtures/fail28.json +2 -0
- data/lib/vendor/json_pure/tests/fixtures/fail3.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail4.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail5.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail6.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail7.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail8.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/fail9.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/pass1.json +56 -0
- data/lib/vendor/json_pure/tests/fixtures/pass15.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/pass16.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/pass17.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/pass2.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/pass26.json +1 -0
- data/lib/vendor/json_pure/tests/fixtures/pass3.json +6 -0
- data/lib/vendor/json_pure/tests/test_json.rb +361 -0
- data/lib/vendor/json_pure/tests/test_json_addition.rb +162 -0
- data/lib/vendor/json_pure/tests/test_json_encoding.rb +68 -0
- data/lib/vendor/json_pure/tests/test_json_fixtures.rb +34 -0
- data/lib/vendor/json_pure/tests/test_json_generate.rb +122 -0
- data/lib/vendor/json_pure/tests/test_json_rails.rb +144 -0
- data/lib/vendor/json_pure/tests/test_json_unicode.rb +76 -0
- data/lib/vendor/json_pure/tools/fuzz.rb +139 -0
- data/lib/vendor/json_pure/tools/server.rb +61 -0
- data/lib/vendor/open4/lib/open4.rb +51 -80
- data/lib/vendor/thor/CHANGELOG.rdoc +89 -0
- data/lib/vendor/thor/LICENSE +20 -0
- data/lib/vendor/thor/README.rdoc +297 -0
- data/lib/vendor/thor/Thorfile +69 -0
- data/lib/vendor/thor/bin/rake2thor +86 -0
- data/lib/vendor/thor/bin/thor +6 -0
- data/lib/vendor/thor/thor.gemspec +120 -0
- data/spec/basic_deploy_spec.rb +1 -1
- data/spec/bundler_deploy_spec.rb +1 -1
- data/spec/nodejs_deploy_spec.rb +5 -2
- data/spec/rails31_deploy_spec.rb +3 -3
- data/spec/services_deploy_spec.rb +1 -1
- data/spec/support/integration.rb +1 -2
- metadata +165 -44
- data/lib/engineyard-serverside/future.rb +0 -29
- data/lib/engineyard-serverside/futures/celluloid.rb +0 -25
- data/lib/engineyard-serverside/futures/dataflow.rb +0 -31
- data/lib/vendor/celluloid/lib/celluloid.rb +0 -261
- data/lib/vendor/celluloid/lib/celluloid/actor.rb +0 -242
- data/lib/vendor/celluloid/lib/celluloid/actor_pool.rb +0 -54
- data/lib/vendor/celluloid/lib/celluloid/actor_proxy.rb +0 -75
- data/lib/vendor/celluloid/lib/celluloid/application.rb +0 -78
- data/lib/vendor/celluloid/lib/celluloid/calls.rb +0 -94
- data/lib/vendor/celluloid/lib/celluloid/core_ext.rb +0 -14
- data/lib/vendor/celluloid/lib/celluloid/events.rb +0 -14
- data/lib/vendor/celluloid/lib/celluloid/fiber.rb +0 -33
- data/lib/vendor/celluloid/lib/celluloid/fsm.rb +0 -141
- data/lib/vendor/celluloid/lib/celluloid/future.rb +0 -60
- data/lib/vendor/celluloid/lib/celluloid/links.rb +0 -61
- data/lib/vendor/celluloid/lib/celluloid/logger.rb +0 -32
- data/lib/vendor/celluloid/lib/celluloid/mailbox.rb +0 -124
- data/lib/vendor/celluloid/lib/celluloid/receivers.rb +0 -66
- data/lib/vendor/celluloid/lib/celluloid/registry.rb +0 -33
- data/lib/vendor/celluloid/lib/celluloid/responses.rb +0 -26
- data/lib/vendor/celluloid/lib/celluloid/rspec.rb +0 -2
- data/lib/vendor/celluloid/lib/celluloid/signals.rb +0 -50
- data/lib/vendor/celluloid/lib/celluloid/supervisor.rb +0 -57
- data/lib/vendor/celluloid/lib/celluloid/task.rb +0 -73
- data/lib/vendor/celluloid/lib/celluloid/tcp_server.rb +0 -33
- data/lib/vendor/celluloid/lib/celluloid/timers.rb +0 -109
- data/lib/vendor/celluloid/lib/celluloid/version.rb +0 -4
@@ -1,15 +1,21 @@
|
|
1
|
-
|
1
|
+
if String.instance_methods.include?(:force_encoding)
|
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
|
2
9
|
|
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__))
|
3
12
|
$LOAD_PATH.unshift File.expand_path('vendor/escape/lib', File.dirname(__FILE__))
|
4
13
|
$LOAD_PATH.unshift File.expand_path('vendor/json_pure/lib', File.dirname(__FILE__))
|
5
|
-
$LOAD_PATH.unshift File.expand_path('vendor/
|
6
|
-
$LOAD_PATH.unshift File.expand_path('vendor/thor/lib', File.dirname(__FILE__))
|
14
|
+
$LOAD_PATH.unshift File.expand_path('vendor/dataflow', File.dirname(__FILE__))
|
7
15
|
|
8
16
|
require 'escape'
|
9
17
|
require 'json'
|
10
|
-
require '
|
11
|
-
require 'thor'
|
12
|
-
require 'open4'
|
18
|
+
require 'dataflow'
|
13
19
|
|
14
20
|
require 'engineyard-serverside/version'
|
15
21
|
require 'engineyard-serverside/strategies/git'
|
@@ -21,7 +27,6 @@ require 'engineyard-serverside/lockfile_parser'
|
|
21
27
|
require 'engineyard-serverside/cli'
|
22
28
|
require 'engineyard-serverside/configuration'
|
23
29
|
require 'engineyard-serverside/deprecation'
|
24
|
-
require 'engineyard-serverside/future'
|
25
30
|
|
26
31
|
module EY
|
27
32
|
module Serverside
|
@@ -55,16 +60,13 @@ module EY
|
|
55
60
|
end
|
56
61
|
|
57
62
|
def self.read_encoded_dna
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
encoded_dna
|
63
|
+
json = if File.exist?(dna_path)
|
64
|
+
`sudo cat #{dna_path}`
|
65
|
+
else
|
66
|
+
'{}'
|
67
|
+
end
|
68
|
+
json.force_encoding('UTF-8') if $string_encodings
|
69
|
+
json
|
68
70
|
end
|
69
71
|
end
|
70
72
|
end
|
@@ -1,8 +1,16 @@
|
|
1
|
+
require 'thor'
|
1
2
|
require 'pathname'
|
2
3
|
|
3
4
|
module EY
|
4
5
|
module Serverside
|
5
6
|
class CLI < Thor
|
7
|
+
include Dataflow
|
8
|
+
|
9
|
+
def self.start(*)
|
10
|
+
super
|
11
|
+
rescue RemoteFailure
|
12
|
+
exit(1)
|
13
|
+
end
|
6
14
|
|
7
15
|
method_option :migrate, :type => :string,
|
8
16
|
:desc => "Run migrations with this deploy",
|
@@ -48,14 +56,14 @@ module EY
|
|
48
56
|
:aliases => ["-v"]
|
49
57
|
|
50
58
|
desc "deploy", "Deploy code from /data/<app>"
|
51
|
-
def deploy(default_task
|
59
|
+
def deploy(default_task=:deploy)
|
52
60
|
config = EY::Serverside::Deploy::Configuration.new(options)
|
53
61
|
EY::Serverside::Server.load_all_from_array(assemble_instance_hashes(config))
|
54
62
|
|
55
63
|
EY::Serverside::LoggedOutput.verbose = options[:verbose]
|
56
64
|
EY::Serverside::LoggedOutput.logfile = File.join(ENV['HOME'], "#{options[:app]}-deploy.log")
|
57
65
|
|
58
|
-
propagate
|
66
|
+
invoke :propagate
|
59
67
|
|
60
68
|
EY::Serverside::Deploy.new(config).send(default_task)
|
61
69
|
end
|
@@ -136,7 +144,7 @@ module EY
|
|
136
144
|
|
137
145
|
EY::Serverside::Server.load_all_from_array(assemble_instance_hashes(config))
|
138
146
|
|
139
|
-
propagate
|
147
|
+
invoke :propagate
|
140
148
|
|
141
149
|
EY::Serverside::Server.all.each do |server|
|
142
150
|
server.sync_directory app_dir
|
@@ -182,7 +190,7 @@ module EY
|
|
182
190
|
config = EY::Serverside::Deploy::Configuration.new(options)
|
183
191
|
EY::Serverside::Server.load_all_from_array(assemble_instance_hashes(config))
|
184
192
|
|
185
|
-
propagate
|
193
|
+
invoke :propagate
|
186
194
|
|
187
195
|
EY::Serverside::Deploy.new(config).restart_with_maintenance_page
|
188
196
|
end
|
@@ -204,22 +212,34 @@ module EY
|
|
204
212
|
|
205
213
|
desc "propagate", "Propagate the engineyard-serverside gem to the other instances in the cluster. This will install exactly version #{EY::Serverside::VERSION}."
|
206
214
|
def propagate
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
215
|
+
config = EY::Serverside::Deploy::Configuration.new
|
216
|
+
gem_filename = "engineyard-serverside-#{EY::Serverside::VERSION}.gem"
|
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|
|
222
|
+
!server.local? # of course this machine has it
|
223
|
+
end.map do |server|
|
224
|
+
need_later do
|
225
|
+
egrep_escaped_version = EY::Serverside::VERSION.gsub(/\./, '\.')
|
226
|
+
# the [,)] is to stop us from looking for e.g. 0.5.1, seeing
|
227
|
+
# 0.5.11, and mistakenly thinking 0.5.1 is there
|
228
|
+
has_gem_cmd = "#{gem_binary} list engineyard-serverside | grep \"engineyard-serverside\" | egrep -q '#{egrep_escaped_version}[,)]'"
|
229
|
+
|
230
|
+
if !server.run(has_gem_cmd) # doesn't have this exact version
|
231
|
+
puts "~> Installing engineyard-serverside on #{server.hostname}"
|
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}'")
|
217
240
|
end
|
218
241
|
end
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
EY::Serverside::Future.success?(futures)
|
242
|
+
end))
|
223
243
|
end
|
224
244
|
|
225
245
|
private
|
@@ -233,18 +253,6 @@ module EY
|
|
233
253
|
}
|
234
254
|
}
|
235
255
|
end
|
236
|
-
|
237
|
-
class Dependency
|
238
|
-
attr_reader :name, :version
|
239
|
-
def initialize(name, version)
|
240
|
-
@name = name
|
241
|
-
@version = version
|
242
|
-
end
|
243
|
-
|
244
|
-
def gemname; "#{name}-#{version}.gem"; end
|
245
|
-
def local_path; File.expand_path(File.join('cache', gemname), Gem.dir); end
|
246
|
-
def remote_path; File.expand_path(gemname, Dir.tmpdir); end
|
247
|
-
end
|
248
256
|
end
|
249
257
|
end
|
250
258
|
end
|
@@ -1,37 +1,13 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'thor'
|
1
3
|
|
2
4
|
module EY
|
3
5
|
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
|
-
|
28
6
|
class Deploy::Configuration
|
29
|
-
require 'json'
|
30
|
-
|
31
7
|
DEFAULT_CONFIG = Thor::CoreExt::HashWithIndifferentAccess.new({
|
32
8
|
"branch" => "master",
|
33
9
|
"strategy" => "Git",
|
34
|
-
"bundle_without" => "test development"
|
10
|
+
"bundle_without" => "test development",
|
35
11
|
})
|
36
12
|
|
37
13
|
attr_reader :configuration
|
@@ -88,7 +64,7 @@ module EY
|
|
88
64
|
end
|
89
65
|
|
90
66
|
def repository_cache
|
91
|
-
configuration['repository_cache'] || File.join(deploy_to,
|
67
|
+
configuration['repository_cache'] || File.join(deploy_to, 'shared', 'cached-copy')
|
92
68
|
end
|
93
69
|
|
94
70
|
def deploy_to
|
@@ -145,10 +145,9 @@ 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
|
-
server.sync_directory(config.repository_cache)
|
150
|
-
end
|
151
|
-
EY::Serverside::Future.success?(futures)
|
148
|
+
barrier *(EY::Serverside::Server.all.map do |server|
|
149
|
+
need_later { server.sync_directory(config.repository_cache) }
|
150
|
+
end)
|
152
151
|
end
|
153
152
|
|
154
153
|
# task
|
@@ -263,7 +262,7 @@ WRAP
|
|
263
262
|
# task
|
264
263
|
def copy_repository_cache
|
265
264
|
info "~> Copying to #{c.release_path}"
|
266
|
-
run("mkdir -p #{c.release_path} && rsync -aq #{c.exclusions} #{c.repository_cache}/ #{c.release_path}")
|
265
|
+
run("mkdir -p #{c.release_path} #{c.failed_release_dir} && rsync -aq #{c.exclusions} #{c.repository_cache}/ #{c.release_path}")
|
267
266
|
|
268
267
|
info "~> Ensuring proper ownership."
|
269
268
|
sudo("chown -R #{c.user}:#{c.group} #{c.deploy_to}")
|
@@ -281,6 +280,10 @@ WRAP
|
|
281
280
|
"/usr/local/ey_resin/ruby/bin/ey-services-setup #{config.app}"
|
282
281
|
end
|
283
282
|
|
283
|
+
def node_package_manager_command_check
|
284
|
+
"which npm"
|
285
|
+
end
|
286
|
+
|
284
287
|
def setup_services
|
285
288
|
info "~> Setting up external services."
|
286
289
|
begin
|
@@ -400,7 +403,7 @@ Deploy again if your services configuration appears incomplete or out of date.
|
|
400
403
|
yield
|
401
404
|
rescue Exception
|
402
405
|
info "~> Release #{c.release_path} failed, saving release to #{c.failed_release_dir}."
|
403
|
-
sudo "
|
406
|
+
sudo "mv #{c.release_path} #{c.failed_release_dir}"
|
404
407
|
raise
|
405
408
|
end
|
406
409
|
|
@@ -463,7 +466,7 @@ Deploy again if your services configuration appears incomplete or out of date.
|
|
463
466
|
|
464
467
|
def check_node_npm
|
465
468
|
if File.exist?("#{c.release_path}/package.json")
|
466
|
-
unless run(
|
469
|
+
unless run(node_package_manager_command_check)
|
467
470
|
abort "*** [Error] package.json detected, but npm was not installed"
|
468
471
|
else
|
469
472
|
info "~> package.json detected, installing npm packages"
|
@@ -16,11 +16,11 @@ module EY
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def any_database_adapter?
|
19
|
-
any_ruby_adapter = %w[mysql2 mysql do_mysql pg do_postgres
|
19
|
+
any_ruby_adapter = %w[mysql2 mysql do_mysql pg do_postgres].any? do |type|
|
20
20
|
@contents.index(/^\s+#{type}\s\([^\)]+\)$/)
|
21
21
|
end
|
22
22
|
|
23
|
-
any_jruby_adapter = %w[mysql postgresql
|
23
|
+
any_jruby_adapter = %w[mysql postgresql].any? do |type|
|
24
24
|
@contents.index(/^\s+jdbc-#{type}\s\([^\)]+\)$/) || @contents.index(/^\s+activerecord-jdbc#{type}-adapter\s\([^\)]+\)$/)
|
25
25
|
end
|
26
26
|
|
@@ -83,37 +83,12 @@ module EY
|
|
83
83
|
if local?
|
84
84
|
logged_system(command)
|
85
85
|
else
|
86
|
-
logged_system(ssh_command + Escape.shell_command(["#{user}@#{hostname}", 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
|
-
|
94
90
|
def ssh_command
|
95
|
-
"ssh #{
|
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
|
-
# resin + ruby 1.8.6 need sudo privileges to install gems
|
112
|
-
run("sudo #{gem_command} install -q --no-ri --no-rdoc #{path}")
|
113
|
-
end
|
114
|
-
|
115
|
-
def gem_command
|
116
|
-
File.expand_path('gem', Gem.default_bindir)
|
91
|
+
"ssh -i #{ENV['HOME']}/.ssh/internal -o StrictHostKeyChecking=no -o PasswordAuthentication=no"
|
117
92
|
end
|
118
93
|
|
119
94
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module EY
|
2
2
|
module Serverside
|
3
3
|
class Task
|
4
|
+
include Dataflow
|
4
5
|
|
5
6
|
attr_reader :config
|
6
7
|
alias :c :config
|
@@ -37,6 +38,9 @@ module EY
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
41
|
+
# Returns +true+ if the command is successful,
|
42
|
+
# raises EY::Serverside::RemoteFailure with a list of failures
|
43
|
+
# otherwise.
|
40
44
|
def run(cmd, &blk)
|
41
45
|
run_on_roles(cmd, &blk)
|
42
46
|
end
|
@@ -47,18 +51,18 @@ module EY
|
|
47
51
|
|
48
52
|
private
|
49
53
|
|
50
|
-
def run_on_roles(cmd, wrapper=%w[sh -l -c]
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
server.run(Escape.shell_command(wrapper + [to_run]))
|
55
|
-
end
|
56
|
-
|
57
|
-
unless EY::Serverside::Future.success?(futures)
|
58
|
-
failures = futures.select {|f| f.error? }.map {|f| f.inspect}.join("\n")
|
59
|
-
raise EY::Serverside::RemoteFailure.new(failures)
|
54
|
+
def run_on_roles(cmd, wrapper=%w[sh -l -c])
|
55
|
+
results = EY::Serverside::Server.from_roles(@roles).map do |server|
|
56
|
+
to_run = block_given? ? yield(server, cmd.dup) : cmd
|
57
|
+
need_later { server.run(Escape.shell_command(wrapper + [to_run])) }
|
60
58
|
end
|
59
|
+
barrier *results
|
60
|
+
# MRI's truthiness check is an internal C thing that does not call
|
61
|
+
# any methods... so Dataflow cannot proxy it & we must "x == true"
|
62
|
+
# Rubinius, wherefore art thou!?
|
63
|
+
results.all?{|x| x == true } || raise(EY::Serverside::RemoteFailure.new(cmd))
|
61
64
|
end
|
65
|
+
|
62
66
|
end
|
63
67
|
end
|
64
68
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
== 0.3.0 / 2009-08-29
|
2
|
+
|
3
|
+
* Major enhancements
|
4
|
+
|
5
|
+
* "flow" abstraction for threading (use it to create threads and optionally
|
6
|
+
pass it a variable to be bound output, or override it to modify need_later
|
7
|
+
for other threading strategies such as thread pools)
|
8
|
+
|
9
|
+
* Dataflow::FutureQueue
|
10
|
+
|
11
|
+
* Nested binding through variables possible
|
12
|
+
|
13
|
+
* Minor enhancements
|
14
|
+
|
15
|
+
* Better #inspect and UnificationError debugging output
|
16
|
+
|
17
|
+
* "barrier" abstraction for manually preventing execution until variable
|
18
|
+
arguments have been bound
|
19
|
+
|
20
|
+
* Use mixin methods as class/module methods optionally
|
21
|
+
e.g. Dataflow.local {|v| v }
|
22
|
+
|
23
|
+
== 0.2.1 / 2009-07-29
|
24
|
+
|
25
|
+
* Minor enhancements
|
26
|
+
|
27
|
+
* Leave __send__ and __id__ alone when acting as a proxy
|
28
|
+
|
29
|
+
== 0.2.0 / 2009-07-09
|
30
|
+
|
31
|
+
* Major enhancements
|
32
|
+
|
33
|
+
* Made equality between objects and dataflow variables more transparent
|
34
|
+
(load equality changes with: require 'dataflow/equality')
|
35
|
+
|
36
|
+
* Minor enhancements
|
37
|
+
|
38
|
+
* Made #inspect work with unbound variables to not crash deubggers/repls/etc
|
39
|
+
|
40
|
+
* Made relationship between lazy and dataflow behavior more strict
|
41
|
+
|
42
|
+
== 0.1.1 / 2009-06-13
|
43
|
+
|
44
|
+
* Minor enhancements
|
45
|
+
|
46
|
+
* Got the "require_path" set correctly so rubygems can be used =)
|
47
|
+
|
48
|
+
== 0.1.0 / 2009-06-13
|
49
|
+
|
50
|
+
* 1 major enhancement
|
51
|
+
|
52
|
+
* Birthday!
|