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.
Files changed (184) hide show
  1. data/lib/engineyard-serverside/cli.rb +39 -45
  2. data/lib/engineyard-serverside/configuration.rb +28 -4
  3. data/lib/engineyard-serverside/deploy.rb +5 -4
  4. data/lib/engineyard-serverside/logged_output.rb +3 -5
  5. data/lib/engineyard-serverside/server.rb +26 -2
  6. data/lib/engineyard-serverside/task.rb +2 -4
  7. data/lib/engineyard-serverside/version.rb +1 -1
  8. data/lib/engineyard-serverside.rb +8 -20
  9. data/spec/basic_deploy_spec.rb +1 -1
  10. data/spec/bundler_deploy_spec.rb +1 -1
  11. data/spec/nodejs_deploy_spec.rb +1 -1
  12. data/spec/rails31_deploy_spec.rb +1 -1
  13. data/spec/services_deploy_spec.rb +1 -1
  14. metadata +80 -233
  15. data/lib/vendor/dataflow/HISTORY +0 -52
  16. data/lib/vendor/dataflow/LICENSE +0 -19
  17. data/lib/vendor/dataflow/README.textile +0 -290
  18. data/lib/vendor/dataflow/Rakefile +0 -36
  19. data/lib/vendor/dataflow/dataflow/actor.rb +0 -22
  20. data/lib/vendor/dataflow/dataflow/equality.rb +0 -44
  21. data/lib/vendor/dataflow/dataflow/future_queue.rb +0 -24
  22. data/lib/vendor/dataflow/dataflow/port.rb +0 -54
  23. data/lib/vendor/dataflow/dataflow.rb +0 -124
  24. data/lib/vendor/dataflow/examples/barrier.rb +0 -9
  25. data/lib/vendor/dataflow/examples/data_driven.rb +0 -17
  26. data/lib/vendor/dataflow/examples/dataflow_http_gets.rb +0 -13
  27. data/lib/vendor/dataflow/examples/flow.rb +0 -20
  28. data/lib/vendor/dataflow/examples/future_http_gets.rb +0 -12
  29. data/lib/vendor/dataflow/examples/future_queue.rb +0 -11
  30. data/lib/vendor/dataflow/examples/instance_variables.rb +0 -15
  31. data/lib/vendor/dataflow/examples/laziness.rb +0 -9
  32. data/lib/vendor/dataflow/examples/local_variables.rb +0 -11
  33. data/lib/vendor/dataflow/examples/messages.rb +0 -26
  34. data/lib/vendor/dataflow/examples/port_http_gets.rb +0 -13
  35. data/lib/vendor/dataflow/examples/port_send.rb +0 -10
  36. data/lib/vendor/dataflow/examples/ring.rb +0 -21
  37. data/lib/vendor/dataflow/spec/actor_spec.rb +0 -28
  38. data/lib/vendor/dataflow/spec/anonymous_variables_spec.rb +0 -21
  39. data/lib/vendor/dataflow/spec/barrier_spec.rb +0 -25
  40. data/lib/vendor/dataflow/spec/by_need_spec.rb +0 -55
  41. data/lib/vendor/dataflow/spec/dataflow_spec.rb +0 -151
  42. data/lib/vendor/dataflow/spec/equality_spec.rb +0 -40
  43. data/lib/vendor/dataflow/spec/flow_spec.rb +0 -25
  44. data/lib/vendor/dataflow/spec/forker_spec.rb +0 -28
  45. data/lib/vendor/dataflow/spec/future_queue_spec.rb +0 -31
  46. data/lib/vendor/dataflow/spec/inspect_spec.rb +0 -19
  47. data/lib/vendor/dataflow/spec/need_later_spec.rb +0 -12
  48. data/lib/vendor/dataflow/spec/port_spec.rb +0 -26
  49. data/lib/vendor/dataflow/spec/spec.opts +0 -1
  50. data/lib/vendor/dataflow/spec/spec_helper.rb +0 -10
  51. data/lib/vendor/escape/Readme +0 -21
  52. data/lib/vendor/escape/doc_include/template/qualitysmith.rb +0 -631
  53. data/lib/vendor/json_pure/CHANGES +0 -166
  54. data/lib/vendor/json_pure/COPYING +0 -58
  55. data/lib/vendor/json_pure/GPL +0 -340
  56. data/lib/vendor/json_pure/README +0 -358
  57. data/lib/vendor/json_pure/Rakefile +0 -292
  58. data/lib/vendor/json_pure/TODO +0 -1
  59. data/lib/vendor/json_pure/VERSION +0 -1
  60. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +0 -52
  61. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +0 -1000
  62. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +0 -1001
  63. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +0 -900
  64. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +0 -901
  65. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +0 -1000
  66. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +0 -1001
  67. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +0 -261
  68. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +0 -1000
  69. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +0 -1001
  70. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +0 -1000
  71. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +0 -1001
  72. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +0 -1000
  73. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +0 -1001
  74. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +0 -262
  75. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +0 -1000
  76. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +0 -1001
  77. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +0 -82
  78. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +0 -34
  79. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +0 -900
  80. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +0 -901
  81. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +0 -81
  82. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +0 -1000
  83. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +0 -1001
  84. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +0 -82
  85. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +0 -1000
  86. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +0 -1001
  87. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +0 -82
  88. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +0 -1000
  89. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +0 -1001
  90. data/lib/vendor/json_pure/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +0 -82
  91. data/lib/vendor/json_pure/benchmarks/generator2_benchmark.rb +0 -222
  92. data/lib/vendor/json_pure/benchmarks/generator_benchmark.rb +0 -224
  93. data/lib/vendor/json_pure/benchmarks/ohai.json +0 -1216
  94. data/lib/vendor/json_pure/benchmarks/ohai.ruby +0 -1
  95. data/lib/vendor/json_pure/benchmarks/parser2_benchmark.rb +0 -251
  96. data/lib/vendor/json_pure/benchmarks/parser_benchmark.rb +0 -259
  97. data/lib/vendor/json_pure/bin/edit_json.rb +0 -9
  98. data/lib/vendor/json_pure/bin/prettify_json.rb +0 -75
  99. data/lib/vendor/json_pure/data/example.json +0 -1
  100. data/lib/vendor/json_pure/data/index.html +0 -38
  101. data/lib/vendor/json_pure/data/prototype.js +0 -4184
  102. data/lib/vendor/json_pure/ext/json/ext/generator/extconf.rb +0 -16
  103. data/lib/vendor/json_pure/ext/json/ext/generator/generator.c +0 -1323
  104. data/lib/vendor/json_pure/ext/json/ext/generator/generator.h +0 -170
  105. data/lib/vendor/json_pure/ext/json/ext/parser/extconf.rb +0 -15
  106. data/lib/vendor/json_pure/ext/json/ext/parser/parser.c +0 -1935
  107. data/lib/vendor/json_pure/ext/json/ext/parser/parser.h +0 -71
  108. data/lib/vendor/json_pure/ext/json/ext/parser/parser.rl +0 -792
  109. data/lib/vendor/json_pure/install.rb +0 -26
  110. data/lib/vendor/json_pure/tests/fixtures/fail1.json +0 -1
  111. data/lib/vendor/json_pure/tests/fixtures/fail10.json +0 -1
  112. data/lib/vendor/json_pure/tests/fixtures/fail11.json +0 -1
  113. data/lib/vendor/json_pure/tests/fixtures/fail12.json +0 -1
  114. data/lib/vendor/json_pure/tests/fixtures/fail13.json +0 -1
  115. data/lib/vendor/json_pure/tests/fixtures/fail14.json +0 -1
  116. data/lib/vendor/json_pure/tests/fixtures/fail18.json +0 -1
  117. data/lib/vendor/json_pure/tests/fixtures/fail19.json +0 -1
  118. data/lib/vendor/json_pure/tests/fixtures/fail2.json +0 -1
  119. data/lib/vendor/json_pure/tests/fixtures/fail20.json +0 -1
  120. data/lib/vendor/json_pure/tests/fixtures/fail21.json +0 -1
  121. data/lib/vendor/json_pure/tests/fixtures/fail22.json +0 -1
  122. data/lib/vendor/json_pure/tests/fixtures/fail23.json +0 -1
  123. data/lib/vendor/json_pure/tests/fixtures/fail24.json +0 -1
  124. data/lib/vendor/json_pure/tests/fixtures/fail25.json +0 -1
  125. data/lib/vendor/json_pure/tests/fixtures/fail27.json +0 -2
  126. data/lib/vendor/json_pure/tests/fixtures/fail28.json +0 -2
  127. data/lib/vendor/json_pure/tests/fixtures/fail3.json +0 -1
  128. data/lib/vendor/json_pure/tests/fixtures/fail4.json +0 -1
  129. data/lib/vendor/json_pure/tests/fixtures/fail5.json +0 -1
  130. data/lib/vendor/json_pure/tests/fixtures/fail6.json +0 -1
  131. data/lib/vendor/json_pure/tests/fixtures/fail7.json +0 -1
  132. data/lib/vendor/json_pure/tests/fixtures/fail8.json +0 -1
  133. data/lib/vendor/json_pure/tests/fixtures/fail9.json +0 -1
  134. data/lib/vendor/json_pure/tests/fixtures/pass1.json +0 -56
  135. data/lib/vendor/json_pure/tests/fixtures/pass15.json +0 -1
  136. data/lib/vendor/json_pure/tests/fixtures/pass16.json +0 -1
  137. data/lib/vendor/json_pure/tests/fixtures/pass17.json +0 -1
  138. data/lib/vendor/json_pure/tests/fixtures/pass2.json +0 -1
  139. data/lib/vendor/json_pure/tests/fixtures/pass26.json +0 -1
  140. data/lib/vendor/json_pure/tests/fixtures/pass3.json +0 -6
  141. data/lib/vendor/json_pure/tests/test_json.rb +0 -361
  142. data/lib/vendor/json_pure/tests/test_json_addition.rb +0 -162
  143. data/lib/vendor/json_pure/tests/test_json_encoding.rb +0 -68
  144. data/lib/vendor/json_pure/tests/test_json_fixtures.rb +0 -34
  145. data/lib/vendor/json_pure/tests/test_json_generate.rb +0 -122
  146. data/lib/vendor/json_pure/tests/test_json_rails.rb +0 -144
  147. data/lib/vendor/json_pure/tests/test_json_unicode.rb +0 -76
  148. data/lib/vendor/json_pure/tools/fuzz.rb +0 -139
  149. data/lib/vendor/json_pure/tools/server.rb +0 -61
  150. data/lib/vendor/open4/lib/open4.rb +0 -403
  151. data/lib/vendor/thor/CHANGELOG.rdoc +0 -89
  152. data/lib/vendor/thor/LICENSE +0 -20
  153. data/lib/vendor/thor/README.rdoc +0 -297
  154. data/lib/vendor/thor/Thorfile +0 -69
  155. data/lib/vendor/thor/bin/rake2thor +0 -86
  156. data/lib/vendor/thor/bin/thor +0 -6
  157. data/lib/vendor/thor/lib/thor/actions/create_file.rb +0 -103
  158. data/lib/vendor/thor/lib/thor/actions/directory.rb +0 -91
  159. data/lib/vendor/thor/lib/thor/actions/empty_directory.rb +0 -134
  160. data/lib/vendor/thor/lib/thor/actions/file_manipulation.rb +0 -223
  161. data/lib/vendor/thor/lib/thor/actions/inject_into_file.rb +0 -104
  162. data/lib/vendor/thor/lib/thor/actions.rb +0 -275
  163. data/lib/vendor/thor/lib/thor/base.rb +0 -540
  164. data/lib/vendor/thor/lib/thor/core_ext/file_binary_read.rb +0 -9
  165. data/lib/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +0 -75
  166. data/lib/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -100
  167. data/lib/vendor/thor/lib/thor/error.rb +0 -30
  168. data/lib/vendor/thor/lib/thor/group.rb +0 -271
  169. data/lib/vendor/thor/lib/thor/invocation.rb +0 -180
  170. data/lib/vendor/thor/lib/thor/parser/argument.rb +0 -67
  171. data/lib/vendor/thor/lib/thor/parser/arguments.rb +0 -150
  172. data/lib/vendor/thor/lib/thor/parser/option.rb +0 -128
  173. data/lib/vendor/thor/lib/thor/parser/options.rb +0 -169
  174. data/lib/vendor/thor/lib/thor/parser.rb +0 -4
  175. data/lib/vendor/thor/lib/thor/rake_compat.rb +0 -66
  176. data/lib/vendor/thor/lib/thor/runner.rb +0 -314
  177. data/lib/vendor/thor/lib/thor/shell/basic.rb +0 -239
  178. data/lib/vendor/thor/lib/thor/shell/color.rb +0 -108
  179. data/lib/vendor/thor/lib/thor/shell.rb +0 -83
  180. data/lib/vendor/thor/lib/thor/task.rb +0 -102
  181. data/lib/vendor/thor/lib/thor/util.rb +0 -230
  182. data/lib/vendor/thor/lib/thor/version.rb +0 -3
  183. data/lib/vendor/thor/lib/thor.rb +0 -244
  184. 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=:deploy)
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
- invoke :propagate
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
- invoke :propagate
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
- invoke :propagate
185
+ propagate
194
186
 
195
187
  EY::Serverside::Deploy.new(config).restart_with_maintenance_page
196
188
  end
197
189
 
198
- desc "install_bundler [VERSION]", "Make sure VERSION of bundler is installed (in system ruby)"
190
+ desc "install_bundler [VERSION]", "Make sure VERSION of bundler is installed (in system ruby)"
199
191
  def install_bundler(version)
200
- egrep_escaped_version = version.gsub(/\./, '\.')
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
- desc "propagate", "Propagate the engineyard-serverside gem to the other instances in the cluster. This will install exactly version #{EY::Serverside::VERSION}."
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
- 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|
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
- 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}'")
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
- DEFAULT_CONFIG = Thor::CoreExt::HashWithIndifferentAccess.new({
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
- barrier *(EY::Serverside::Server.all.map do |server|
149
- need_later { server.sync_directory(config.repository_cache) }
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
- # :quiet means don't raise an error on nonzero exit status
68
- status = Open4.spawn cmd, 0 => '', 1 => out, 2 => err, :quiet => true
69
- status.exitstatus == 0
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 + " " + 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
+
90
94
  def ssh_command
91
- "ssh -i #{ENV['HOME']}/.ssh/internal -o StrictHostKeyChecking=no -o PasswordAuthentication=no"
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
- need_later { server.run(Escape.shell_command(wrapper + [to_run])) }
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,5 +1,5 @@
1
1
  module EY
2
2
  module Serverside
3
- VERSION = '1.5.21'
3
+ VERSION = '1.5.23.ruby19'
4
4
  end
5
5
  end
@@ -1,21 +1,15 @@
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
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 'dataflow'
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 = Thor::CoreExt::HashWithIndifferentAccess.new
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
- 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
57
+ File.exist?(dna_path) ? File.read(dna_path) : '{}'
70
58
  end
71
59
  end
72
60
  end
@@ -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.tmpdir).join("serverside-deploy-#{Time.now.to_i}-#{$$}")
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
@@ -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 = File.join(Dir.tmpdir, "serverside-deploy-#{Time.now.to_i}-#{$$}")
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
@@ -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 = File.join(Dir.tmpdir, "serverside-deploy-#{Time.now.to_i}-#{$$}")
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
@@ -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 = File.join(Dir.tmpdir, "serverside-deploy-#{Time.now.to_i}-#{$$}")
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.tmpdir).join("serverside-deploy-#{Time.now.to_i}-#{$$}")
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