engineyard-serverside 2.7.8pre2 → 2.8.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/bin/engineyard-serverside +1 -1
  2. data/bin/engineyard-serverside-execute-hook +1 -1
  3. data/bin/engineyard-serverside-execute-service-hook +35 -0
  4. data/lib/engineyard-serverside.rb +0 -1
  5. data/lib/engineyard-serverside/about.rb +11 -8
  6. data/lib/engineyard-serverside/callbacks.rb +11 -0
  7. data/lib/engineyard-serverside/callbacks/collection.rb +17 -0
  8. data/lib/engineyard-serverside/callbacks/collection/base.rb +79 -0
  9. data/lib/engineyard-serverside/callbacks/collection/combined.rb +45 -0
  10. data/lib/engineyard-serverside/callbacks/collection/deploy_hooks.rb +21 -0
  11. data/lib/engineyard-serverside/callbacks/collection/service_hooks.rb +17 -0
  12. data/lib/engineyard-serverside/callbacks/collection/service_hooks/collection.rb +24 -0
  13. data/lib/engineyard-serverside/callbacks/collection/service_hooks/combined.rb +40 -0
  14. data/lib/engineyard-serverside/callbacks/distributor.rb +21 -0
  15. data/lib/engineyard-serverside/callbacks/distributor/remote.rb +76 -0
  16. data/lib/engineyard-serverside/callbacks/distributor/viability_filter.rb +66 -0
  17. data/lib/engineyard-serverside/callbacks/executor.rb +23 -0
  18. data/lib/engineyard-serverside/callbacks/executor/base.rb +44 -0
  19. data/lib/engineyard-serverside/callbacks/executor/executable.rb +123 -0
  20. data/lib/engineyard-serverside/callbacks/executor/ruby.rb +20 -0
  21. data/lib/engineyard-serverside/callbacks/executor/ruby/context.rb +81 -0
  22. data/lib/engineyard-serverside/callbacks/executor/ruby/executor.rb +118 -0
  23. data/{spec/fixtures/gitrepo/bar → lib/engineyard-serverside/callbacks/hooks.rb} +0 -0
  24. data/lib/engineyard-serverside/callbacks/hooks/app.rb +21 -0
  25. data/lib/engineyard-serverside/callbacks/hooks/base.rb +43 -0
  26. data/lib/engineyard-serverside/callbacks/hooks/service.rb +28 -0
  27. data/lib/engineyard-serverside/callbacks/service_hook.rb +20 -0
  28. data/lib/engineyard-serverside/cli.rb +4 -225
  29. data/lib/engineyard-serverside/cli/app.rb +136 -0
  30. data/lib/engineyard-serverside/cli/helpers.rb +58 -0
  31. data/lib/engineyard-serverside/cli/server_hash_extractor.rb +49 -0
  32. data/lib/engineyard-serverside/cli/workflows.rb +45 -0
  33. data/lib/engineyard-serverside/cli/workflows/base.rb +78 -0
  34. data/lib/engineyard-serverside/cli/workflows/calling_deploy_hooks.rb +31 -0
  35. data/lib/engineyard-serverside/cli/workflows/deploying_applications.rb +28 -0
  36. data/lib/engineyard-serverside/cli/workflows/disabling_maintenance.rb +29 -0
  37. data/lib/engineyard-serverside/cli/workflows/enabling_maintenance.rb +29 -0
  38. data/lib/engineyard-serverside/cli/workflows/errors.rb +13 -0
  39. data/lib/engineyard-serverside/cli/workflows/helpers.rb +21 -0
  40. data/lib/engineyard-serverside/cli/workflows/integrating_servers.rb +71 -0
  41. data/lib/engineyard-serverside/cli/workflows/restarting_applications.rb +36 -0
  42. data/lib/engineyard-serverside/cli/workflows/rolling_back_applications.rb +28 -0
  43. data/lib/engineyard-serverside/cli/workflows/showing_maintenance_status.rb +28 -0
  44. data/lib/engineyard-serverside/configuration.rb +1 -0
  45. data/lib/engineyard-serverside/dependency_manager/bundler.rb +46 -18
  46. data/lib/engineyard-serverside/dependency_manager/npm.rb +12 -1
  47. data/lib/engineyard-serverside/deploy.rb +7 -45
  48. data/lib/engineyard-serverside/maintenance.rb +1 -9
  49. data/lib/engineyard-serverside/paths.rb +11 -0
  50. data/lib/engineyard-serverside/propagator.rb +59 -0
  51. data/lib/engineyard-serverside/rails_assets.rb +2 -1
  52. data/lib/engineyard-serverside/slug.rb +7 -0
  53. data/lib/engineyard-serverside/slug/distributor.rb +58 -0
  54. data/lib/engineyard-serverside/slug/enabler.rb +100 -0
  55. data/lib/engineyard-serverside/slug/failure_handler.rb +24 -0
  56. data/lib/engineyard-serverside/slug/finalizer.rb +86 -0
  57. data/lib/engineyard-serverside/slug/generator.rb +29 -0
  58. data/lib/engineyard-serverside/slug/migrator.rb +41 -0
  59. data/lib/engineyard-serverside/slug/restarter.rb +103 -0
  60. data/lib/engineyard-serverside/slug/source.rb +16 -0
  61. data/lib/engineyard-serverside/slug/source/updater.rb +194 -0
  62. data/lib/engineyard-serverside/version.rb +1 -1
  63. data/lib/railway.rb +43 -0
  64. data/lib/result.rb +7 -0
  65. data/lib/result/base.rb +41 -0
  66. data/lib/result/dsl.rb +16 -0
  67. data/lib/result/failure.rb +29 -0
  68. data/lib/result/success.rb +24 -0
  69. data/lib/runner.rb +34 -0
  70. data/spec/archive_deploy_spec.rb +1 -1
  71. data/spec/bundler_deploy_spec.rb +22 -1
  72. data/spec/configuration_spec.rb +1 -0
  73. data/spec/deploy_hook_spec.rb +148 -132
  74. data/spec/fixtures/lockfiles/1.15.1-no-bundler +51 -0
  75. data/spec/fixtures/repos/assets_error/Gemfile +5 -0
  76. data/spec/fixtures/repos/assets_error/Gemfile.lock +88 -0
  77. data/spec/fixtures/repos/assets_error/README +1 -0
  78. data/spec/fixtures/repos/assets_error/Rakefile +4 -0
  79. data/spec/fixtures/{gitrepo/foo → repos/assets_error/app/assets/empty} +0 -0
  80. data/spec/fixtures/repos/assets_error/config/application.rb +5 -0
  81. data/spec/fixtures/repos/assets_error/config/ey.yml +4 -0
  82. data/spec/fixtures/repos/bundler_old/Gemfile +5 -0
  83. data/spec/fixtures/repos/bundler_old/Gemfile.lock +15 -0
  84. data/spec/fixtures/repos/bundler_old/README +1 -0
  85. data/spec/fixtures/repos/no_ey_config_no_warning/Gemfile +3 -0
  86. data/spec/fixtures/repos/no_ey_config_no_warning/Gemfile.lock +10 -0
  87. data/spec/fixtures/repos/no_ey_config_no_warning/README +1 -0
  88. data/spec/fixtures/repos/no_ey_config_no_warning/ey.yml +5 -0
  89. data/spec/lockfile_parser_spec.rb +5 -1
  90. data/spec/rails31_deploy_spec.rb +8 -0
  91. data/spec/rollback_spec.rb +1 -1
  92. data/spec/services_deploy_spec.rb +12 -0
  93. data/spec/spec_helper.rb +14 -8
  94. metadata +488 -429
  95. data/lib/engineyard-serverside/cli_helpers.rb +0 -53
  96. data/lib/engineyard-serverside/deploy_hook.rb +0 -142
@@ -30,6 +30,7 @@ describe EY::Serverside::Deploy::Configuration do
30
30
  expect(@config.verbose).to eq(false)
31
31
  expect(@config.copy_exclude).to eq([])
32
32
  expect(@config.ignore_database_adapter_warning).to eq(false)
33
+ expect(@config.ignore_ey_config_warning).to eq(false)
33
34
  expect(@config.ignore_gemfile_lock_warning).to eq(false)
34
35
  expect(@config.bundle_without).to eq(%w[test development])
35
36
  expect(@config.extra_bundle_install_options).to eq(%w[--without test development])
@@ -32,7 +32,7 @@ describe "deploy hooks" do
32
32
 
33
33
  it "prints the failure to the log even when non-verbose" do
34
34
  out = read_output
35
- expect(out).to match(%r|FATAL: Exception raised in deploy hook .*/deploy/before_deploy.rb.|)
35
+ expect(out).to match(%r|FATAL:\s+Exception raised in hook .*/deploy/before_deploy.rb.|)
36
36
  expect(out).to match(%r|RuntimeError:.*Hook failing in \(eval\)|)
37
37
  expect(out).to match(%r|Please fix this error before retrying.|)
38
38
  end
@@ -78,79 +78,91 @@ describe "deploy hooks" do
78
78
  # setup to run hooks since a deploy hasn't happened
79
79
  config.paths.new_release!
80
80
  config.paths.active_release.mkpath
81
- EY::Serverside::DeployHook.new(config, test_shell, 'fake_test_hook')
81
+ hook = EY::Serverside::Callbacks::Hooks::App.new(
82
+ File.join(config.paths.active_release, 'deploy', 'fake_test_hook.rb')
83
+ )
84
+ #EY::Serverside::DeployHook.new(config, test_shell, 'fake_test_hook')
85
+ EY::Serverside::Callbacks::Executor::Ruby::Context.new(
86
+ config,
87
+ test_shell,
88
+ hook
89
+ )
82
90
  end
83
91
 
84
- context "#run" do
85
- it "is available" do
86
- expect(deploy_hook.eval_hook('respond_to?(:run)')).to be_truthy
87
- end
88
-
89
- it "runs commands like the shell does" do
90
- ENV['COUNT'] = 'Chocula'
91
- File.unlink("/tmp/deploy_hook_spec.the_count") rescue nil
92
-
93
- deploy_hook.eval_hook('run("echo $COUNT > /tmp/deploy_hook_spec.the_count")')
94
-
95
- expect(IO.read("/tmp/deploy_hook_spec.the_count").strip).to eq("Chocula")
96
- end
97
-
98
- it "returns true/false to indicate the command's success" do
99
- expect(deploy_hook.eval_hook('run("true")')).to be_truthy
100
- expect(deploy_hook.eval_hook('run("false")')).to be_falsey
101
- end
102
-
103
- it "raises when the bang method alternative is used" do
104
- expect {
105
- deploy_hook.eval_hook('run!("false")')
106
- }.to raise_error(RuntimeError)
107
- out = read_output
108
- expect(out).to match(%r|FATAL: Exception raised in deploy hook .*/deploy/fake_test_hook.rb.|)
109
- expect(out).to match(%r|RuntimeError: .*run!.*Command failed. false|)
110
- expect(out).to match(%r|Please fix this error before retrying.|)
111
- end
112
- end
113
-
114
- context "#sudo" do
115
- it "is available" do
116
- expect(deploy_hook.eval_hook('respond_to?(:sudo)')).to be_truthy
117
- end
118
-
119
- it "runs things with sudo" do
120
- hook = deploy_hook
121
- mock_sudo do
122
- hook.eval_hook('sudo("true") || raise("failed")')
123
- end
124
- end
125
-
126
- it "raises when the bang method alternative is used" do
127
- hook = deploy_hook
128
- mock_sudo do
129
- expect {
130
- hook.eval_hook('sudo!("false")')
131
- }.to raise_error(RuntimeError)
132
- end
133
- out = read_output
134
- expect(out).to match(%r|FATAL: Exception raised in deploy hook .*/deploy/fake_test_hook.rb.|)
135
- expect(out).to match(%r|RuntimeError: .*sudo!.*Command failed. false|)
136
- expect(out).to match(%r|Please fix this error before retrying.|)
137
- end
138
- end
92
+ # Deprecated by inside tests - dwalters
93
+ #context "#run" do
94
+ #it "is available" do
95
+ #expect(deploy_hook.instance_eval('respond_to?(:run)')).to be_truthy
96
+ #end
97
+
98
+ #it "runs commands like the shell does" do
99
+ #ENV['COUNT'] = 'Chocula'
100
+ #File.unlink("/tmp/deploy_hook_spec.the_count") rescue nil
101
+
102
+ #deploy_hook.instance_eval('run("echo $COUNT > /tmp/deploy_hook_spec.the_count")')
103
+
104
+ #expect(IO.read("/tmp/deploy_hook_spec.the_count").strip).to eq("Chocula")
105
+ #end
106
+
107
+ #it "returns true/false to indicate the command's success" do
108
+ #expect(deploy_hook.instance_eval('run("true")')).to be_truthy
109
+ #expect(deploy_hook.instance_eval('run("false")')).to be_falsey
110
+ #end
111
+
112
+ #it "raises when the bang method alternative is used" do
113
+ ##expect {
114
+ #deploy_hook.instance_eval('run!("false")')
115
+ ##}.to raise_error(RuntimeError)
116
+ #out = read_output
117
+ #puts "out == '#{out}'"
118
+ #fail
119
+ #expect(out).to match(%r|FATAL:\s+Exception raised in hook .*/deploy/fake_test_hook.rb.|)
120
+ #expect(out).to match(%r|RuntimeError: .*run!.*Command failed. false|)
121
+ #expect(out).to match(%r|Please fix this error before retrying.|)
122
+ #end
123
+ #end
124
+
125
+ # Deprecated by inside tests - dwalters
126
+ #context "#sudo" do
127
+ #it "is available" do
128
+ #expect(deploy_hook.instance_eval('respond_to?(:sudo)')).to be_truthy
129
+ #end
130
+
131
+ #it "runs things with sudo" do
132
+ #hook = deploy_hook
133
+ #mock_sudo do
134
+ #hook.instance_eval('sudo("true") || raise("failed")')
135
+ #end
136
+ #end
137
+
138
+ #it "raises when the bang method alternative is used" do
139
+ #hook = deploy_hook
140
+ #mock_sudo do
141
+ #expect {
142
+ #hook.instance_eval('sudo!("false")')
143
+ #}.to raise_error(RuntimeError)
144
+ #end
145
+ #out = read_output
146
+ #expect(out).to match(%r|FATAL:\s+Exception raised in hook .*/deploy/fake_test_hook.rb.|)
147
+ #expect(out).to match(%r|RuntimeError: .*sudo!.*Command failed. false|)
148
+ #expect(out).to match(%r|Please fix this error before retrying.|)
149
+ #end
150
+ #end
139
151
 
140
152
  context "capistrano-ish methods" do
141
153
  it "has them" do
142
- expect(deploy_hook.eval_hook('respond_to?(:latest_release) ')).to be_truthy
143
- expect(deploy_hook.eval_hook('respond_to?(:previous_release) ')).to be_truthy
144
- expect(deploy_hook.eval_hook('respond_to?(:all_releases) ')).to be_truthy
145
- expect(deploy_hook.eval_hook('respond_to?(:current_path) ')).to be_truthy
146
- expect(deploy_hook.eval_hook('respond_to?(:shared_path) ')).to be_truthy
147
- expect(deploy_hook.eval_hook('respond_to?(:release_dir) ')).to be_truthy
148
- expect(deploy_hook.eval_hook('respond_to?(:failed_release_dir)')).to be_truthy
149
- expect(deploy_hook.eval_hook('respond_to?(:release_path) ')).to be_truthy
154
+ expect(deploy_hook.instance_eval('respond_to?(:latest_release) ')).to be_truthy
155
+ expect(deploy_hook.instance_eval('respond_to?(:previous_release) ')).to be_truthy
156
+ expect(deploy_hook.instance_eval('respond_to?(:all_releases) ')).to be_truthy
157
+ expect(deploy_hook.instance_eval('respond_to?(:current_path) ')).to be_truthy
158
+ expect(deploy_hook.instance_eval('respond_to?(:shared_path) ')).to be_truthy
159
+ expect(deploy_hook.instance_eval('respond_to?(:release_dir) ')).to be_truthy
160
+ expect(deploy_hook.instance_eval('respond_to?(:failed_release_dir)')).to be_truthy
161
+ expect(deploy_hook.instance_eval('respond_to?(:release_path) ')).to be_truthy
150
162
  end
151
163
 
152
164
  it "shows a deprecation warning that asks you to use config to access these variables" do
153
- expect(deploy_hook.eval_hook('shared_path.nil?')).to be_falsey
165
+ expect(deploy_hook.instance_eval('shared_path.nil?')).to be_falsey
154
166
  out = read_output
155
167
  expect(out).to include("Use of `shared_path` (via method_missing) is deprecated in favor of `config.shared_path` for improved error messages and compatibility.")
156
168
  expect(out).to match(%r|in .*/deploy/fake_test_hook.rb|)
@@ -163,15 +175,15 @@ describe "deploy hooks" do
163
175
  end
164
176
 
165
177
  it "has account_name" do
166
- expect(@hook.eval_hook('account_name')).to eq('acc')
178
+ expect(@hook.instance_eval('account_name')).to eq('acc')
167
179
  end
168
180
 
169
181
  it "has environment_name" do
170
- expect(@hook.eval_hook('environment_name')).to eq('env')
182
+ expect(@hook.instance_eval('environment_name')).to eq('env')
171
183
  end
172
184
 
173
185
  it "has app_name" do
174
- expect(@hook.eval_hook('app_name')).to eq('app')
186
+ expect(@hook.instance_eval('app_name')).to eq('app')
175
187
  end
176
188
  end
177
189
 
@@ -188,51 +200,53 @@ describe "deploy hooks" do
188
200
  })
189
201
  end
190
202
 
191
- it "is deprecated through the @node ivar" do
192
- expect(deploy_hook.eval_hook('@node.nil?')).to be_falsey
193
- out = read_output
194
- expect(out).to match(%r|Use of `@node` in deploy hooks is deprecated.|)
195
- expect(out).to match(%r|Please use `config.node`, which provides access to the same object.|)
196
- expect(out).to match(%r|.*/deploy/fake_test_hook.rb|)
197
- end
203
+ # Test deprecated by inside tests and new implementation - dwalters
204
+ #it "is deprecated through the @node ivar" do
205
+ #expect(deploy_hook.instance_eval('@node.nil?')).to be_falsey
206
+ #out = read_output
207
+ #expect(out).to match(%r|Use of `@node` in deploy hooks is deprecated.|)
208
+ #expect(out).to match(%r|Please use `config.node`, which provides access to the same object.|)
209
+ #expect(out).to match(%r|.*/deploy/fake_test_hook.rb|)
210
+ #end
198
211
 
199
212
  it "is available" do
200
- expect(deploy_hook.eval_hook('config.node.nil?')).to be_falsey
213
+ expect(deploy_hook.instance_eval('config.node.nil?')).to be_falsey
201
214
  end
202
215
 
203
216
  it "has indifferent access" do
204
- expect(deploy_hook.eval_hook('config.node[:instance_role] ')).to eq('solo')
205
- expect(deploy_hook.eval_hook('config.node["instance_role"]')).to eq('solo')
217
+ expect(deploy_hook.instance_eval('config.node[:instance_role] ')).to eq('solo')
218
+ expect(deploy_hook.instance_eval('config.node["instance_role"]')).to eq('solo')
206
219
  end
207
220
 
208
221
  it "has deep indifferent access" do
209
- expect(deploy_hook.eval_hook('config.node["applications"]["myapp"]["type"]')).to eq('rails')
210
- expect(deploy_hook.eval_hook('config.node[:applications]["myapp"][:type] ')).to eq('rails')
211
- expect(deploy_hook.eval_hook('config.node[:applications][:myapp][:type] ')).to eq('rails')
222
+ expect(deploy_hook.instance_eval('config.node["applications"]["myapp"]["type"]')).to eq('rails')
223
+ expect(deploy_hook.instance_eval('config.node[:applications]["myapp"][:type] ')).to eq('rails')
224
+ expect(deploy_hook.instance_eval('config.node[:applications][:myapp][:type] ')).to eq('rails')
212
225
  end
213
226
  end
214
227
 
215
228
  context "config" do
216
229
  it "is available" do
217
- expect(deploy_hook.eval_hook('config.nil?')).to be_falsey
230
+ expect(deploy_hook.instance_eval('config.nil?')).to be_falsey
218
231
  end
219
232
 
220
- it "is deprecated through the @configuration ivar" do
221
- expect(deploy_hook.eval_hook('@configuration.nil?')).to be_falsey
222
- out = read_output
223
- expect(out).to match(%r|Use of `@configuration` in deploy hooks is deprecated.|)
224
- expect(out).to match(%r|Please use `config`, which provides access to the same object.|)
225
- expect(out).to match(%r|.*/deploy/fake_test_hook.rb|)
226
- end
233
+ # Test deprecated by inside tests and new implementation - dwalters
234
+ #it "is deprecated through the @configuration ivar" do
235
+ #expect(deploy_hook.instance_eval('@configuration.nil?')).to be_falsey
236
+ #out = read_output
237
+ #expect(out).to match(%r|Use of `@configuration` in deploy hooks is deprecated.|)
238
+ #expect(out).to match(%r|Please use `config`, which provides access to the same object.|)
239
+ #expect(out).to match(%r|.*/deploy/fake_test_hook.rb|)
240
+ #end
227
241
 
228
242
  it "has the configuration in it" do
229
- expect(deploy_hook('bert' => 'ernie').eval_hook('config.bert')).to eq('ernie')
243
+ expect(deploy_hook('bert' => 'ernie').instance_eval('config.bert')).to eq('ernie')
230
244
  end
231
245
 
232
246
  it "can be accessed with method calls, with [:symbols], or ['strings']" do
233
- expect(deploy_hook('bert' => 'ernie').eval_hook('config.bert ')).to eq('ernie')
234
- expect(deploy_hook('bert' => 'ernie').eval_hook('config[:bert] ')).to eq('ernie')
235
- expect(deploy_hook('bert' => 'ernie').eval_hook('config["bert"]')).to eq('ernie')
247
+ expect(deploy_hook('bert' => 'ernie').instance_eval('config.bert ')).to eq('ernie')
248
+ expect(deploy_hook('bert' => 'ernie').instance_eval('config[:bert] ')).to eq('ernie')
249
+ expect(deploy_hook('bert' => 'ernie').instance_eval('config["bert"]')).to eq('ernie')
236
250
  end
237
251
 
238
252
  [:repository_cache,
@@ -244,17 +258,17 @@ describe "deploy hooks" do
244
258
  :revision,
245
259
  :environment].each do |attribute|
246
260
  it "has the #{attribute.inspect} attribute for compatibility with chef-deploy" do
247
- expect(deploy_hook.eval_hook("config.has_key?(#{attribute.inspect})")).to be_truthy
261
+ expect(deploy_hook.instance_eval("config.has_key?(#{attribute.inspect})")).to be_truthy
248
262
  end
249
263
  end
250
264
  end
251
265
 
252
266
  context "environment variables" do
253
267
  it "sets the framework env variables" do
254
- expect(deploy_hook('framework_env' => 'production').eval_hook("ENV['RAILS_ENV']")).to eq('production')
255
- expect(deploy_hook('framework_env' => 'production').eval_hook("ENV['RACK_ENV'] ")).to eq('production')
256
- expect(deploy_hook('framework_env' => 'production').eval_hook("ENV['MERB_ENV'] ")).to eq('production')
257
- expect(deploy_hook('framework_env' => 'production').eval_hook("ENV['NODE_ENV'] ")).to eq('production')
268
+ expect(deploy_hook('framework_env' => 'production').instance_eval("ENV['RAILS_ENV']")).to eq('production')
269
+ expect(deploy_hook('framework_env' => 'production').instance_eval("ENV['RACK_ENV'] ")).to eq('production')
270
+ expect(deploy_hook('framework_env' => 'production').instance_eval("ENV['MERB_ENV'] ")).to eq('production')
271
+ expect(deploy_hook('framework_env' => 'production').instance_eval("ENV['NODE_ENV'] ")).to eq('production')
258
272
  end
259
273
  end
260
274
 
@@ -277,7 +291,7 @@ describe "deploy hooks" do
277
291
  def where_code_runs_with(code)
278
292
  scenarios.select do |role, name|
279
293
  hook = deploy_hook('current_roles' => role.split(','), 'current_name' => name)
280
- hook.eval_hook("#{code} { 'ran' } == 'ran'")
294
+ hook.instance_eval("#{code} { 'ran' } == 'ran'")
281
295
  end.map do |scenario|
282
296
  scenario.compact.join("_")
283
297
  end.compact
@@ -320,42 +334,44 @@ describe "deploy hooks" do
320
334
  end
321
335
  end
322
336
 
323
- context "#syntax_error" do
324
- it "returns nil for hook files containing valid Ruby syntax" do
325
- hook_path = File.expand_path('../fixtures/valid_hook.rb', __FILE__)
326
- expect(deploy_hook.syntax_error(hook_path)).to be_nil
327
- end
328
-
329
- it "returns a brief problem description for hook files containing valid Ruby syntax" do
330
- hook_path = File.expand_path('../fixtures/invalid_hook.rb', __FILE__)
331
- error = Regexp.escape("spec/fixtures/invalid_hook.rb:1: syntax error, unexpected '^'")
332
- expect(deploy_hook.syntax_error(hook_path)).to match(/#{error}/)
333
- end
334
- end
335
-
336
- context "errors in hooks" do
337
- it "shows the error in a helpful way" do
338
- expect {
339
- deploy_hook.eval_hook('methedo_no_existo')
340
- }.to raise_error(NameError)
341
- out = read_output
342
- expect(out).to match(%r|FATAL: Exception raised in deploy hook .*/deploy/fake_test_hook.rb.|)
343
- expect(out).to match(%r|NameError: undefined local variable or method `methedo_no_existo' for|)
344
- expect(out).to match(%r|Please fix this error before retrying.|)
345
- end
346
- end
347
-
348
- context "is compatible with older deploy hook scripts" do
337
+ # Deprecated by new implementation and inside tests - dwalters
338
+ #context "#syntax_error" do
339
+ #it "returns nil for hook files containing valid Ruby syntax" do
340
+ #hook_path = File.expand_path('../fixtures/valid_hook.rb', __FILE__)
341
+ #expect(deploy_hook.syntax_error(hook_path)).to be_nil
342
+ #end
343
+
344
+ #it "returns a brief problem description for hook files containing valid Ruby syntax" do
345
+ #hook_path = File.expand_path('../fixtures/invalid_hook.rb', __FILE__)
346
+ #error = Regexp.escape("spec/fixtures/invalid_hook.rb:1: syntax error, unexpected '^'")
347
+ #expect(deploy_hook.syntax_error(hook_path)).to match(/#{error}/)
348
+ #end
349
+ #end
350
+
351
+ # Test deprecated by inside tests and new implementation - dwalters
352
+ #context "errors in hooks" do
353
+ #it "shows the error in a helpful way" do
354
+ #expect {
355
+ #deploy_hook.instance_eval('methedo_no_existo')
356
+ #}.to raise_error(NameError)
357
+ #out = read_output
358
+ #expect(out).to match(%r|FATAL:\s+Exception raised in hook .*/deploy/fake_test_hook.rb.|)
359
+ #expect(out).to match(%r|NameError: undefined local variable or method `methedo_no_existo' for|)
360
+ #expect(out).to match(%r|Please fix this error before retrying.|)
361
+ #end
362
+ #end
363
+
364
+ context "is compatible with older hook scripts" do
349
365
  it "#current_role returns the first role" do
350
- expect(deploy_hook('current_roles' => %w(a b)).eval_hook('current_role')).to eq('a')
366
+ expect(deploy_hook('current_roles' => %w(a b)).instance_eval('current_role')).to eq('a')
351
367
  end
352
368
 
353
369
  it "has info, warning, debug, logged_system, and access to shell" do
354
- expect(deploy_hook.eval_hook('respond_to?(:info) ')).to be_truthy
355
- expect(deploy_hook.eval_hook('respond_to?(:warning) ')).to be_truthy
356
- expect(deploy_hook.eval_hook('respond_to?(:debug) ')).to be_truthy
357
- expect(deploy_hook.eval_hook('respond_to?(:logged_system)')).to be_truthy
358
- expect(deploy_hook.eval_hook('respond_to?(:shell) ')).to be_truthy
370
+ expect(deploy_hook.instance_eval('respond_to?(:info) ')).to be_truthy
371
+ expect(deploy_hook.instance_eval('respond_to?(:warning) ')).to be_truthy
372
+ expect(deploy_hook.instance_eval('respond_to?(:debug) ')).to be_truthy
373
+ expect(deploy_hook.instance_eval('respond_to?(:logged_system)')).to be_truthy
374
+ expect(deploy_hook.instance_eval('respond_to?(:shell) ')).to be_truthy
359
375
  end
360
376
  end
361
377
  end
@@ -0,0 +1,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fog (0.3.7)
5
+ builder
6
+ excon (>= 0.2.3)
7
+ formatador (>= 0.0.15)
8
+ json
9
+ mime-types
10
+ net-ssh (~> 2.0.23)
11
+ nokogiri (~> 1.4.3.1)
12
+ ruby-hmac
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ builder (2.1.2)
18
+ excon (0.2.3)
19
+ formatador (0.0.15)
20
+ gestalt (0.0.11)
21
+ formatador (>= 0.0.12)
22
+ json (1.4.6)
23
+ mime-types (1.16)
24
+ net-ssh (2.0.23)
25
+ nokogiri (1.4.3.1)
26
+ rake (0.8.7)
27
+ rspec (1.3.0)
28
+ ruby-hmac (0.4.0)
29
+ shindo (0.1.6)
30
+ formatador (>= 0.0.14)
31
+ gestalt (>= 0.0.11)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ builder
38
+ excon (>= 0.2.3)
39
+ fog!
40
+ formatador (>= 0.0.15)
41
+ json
42
+ mime-types
43
+ net-ssh (~> 2.0.23)
44
+ nokogiri (~> 1.4.3.1)
45
+ rake
46
+ rspec
47
+ ruby-hmac
48
+ shindo (= 0.1.6)
49
+
50
+ BUNDLED WITH
51
+ 1.15.1
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'ey_config'
5
+ gem 'rails'
@@ -0,0 +1,88 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ actionmailer (3.2.3)
5
+ actionpack (= 3.2.3)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.3)
8
+ activemodel (= 3.2.3)
9
+ activesupport (= 3.2.3)
10
+ builder (~> 3.0.0)
11
+ erubis (~> 2.7.0)
12
+ journey (~> 1.0.1)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.2)
15
+ rack-test (~> 0.6.1)
16
+ sprockets (~> 2.1.2)
17
+ activemodel (3.2.3)
18
+ activesupport (= 3.2.3)
19
+ builder (~> 3.0.0)
20
+ activerecord (3.2.3)
21
+ activemodel (= 3.2.3)
22
+ activesupport (= 3.2.3)
23
+ arel (~> 3.0.2)
24
+ tzinfo (~> 0.3.29)
25
+ activeresource (3.2.3)
26
+ activemodel (= 3.2.3)
27
+ activesupport (= 3.2.3)
28
+ activesupport (3.2.3)
29
+ i18n (~> 0.6)
30
+ multi_json (~> 1.0)
31
+ arel (3.0.2)
32
+ builder (3.0.0)
33
+ erubis (2.7.0)
34
+ ey_config (0.0.5)
35
+ hike (1.2.1)
36
+ i18n (0.6.0)
37
+ journey (1.0.3)
38
+ json (1.6.6)
39
+ mail (2.4.4)
40
+ i18n (>= 0.4.0)
41
+ mime-types (~> 1.16)
42
+ treetop (~> 1.4.8)
43
+ mime-types (1.18)
44
+ multi_json (1.3.2)
45
+ polyglot (0.3.3)
46
+ rack (1.4.1)
47
+ rack-cache (1.2)
48
+ rack (>= 0.4)
49
+ rack-ssl (1.3.2)
50
+ rack
51
+ rack-test (0.6.1)
52
+ rack (>= 1.0)
53
+ rails (3.2.3)
54
+ actionmailer (= 3.2.3)
55
+ actionpack (= 3.2.3)
56
+ activerecord (= 3.2.3)
57
+ activeresource (= 3.2.3)
58
+ activesupport (= 3.2.3)
59
+ bundler (~> 1.0)
60
+ railties (= 3.2.3)
61
+ railties (3.2.3)
62
+ actionpack (= 3.2.3)
63
+ activesupport (= 3.2.3)
64
+ rack-ssl (~> 1.3.2)
65
+ rake (>= 0.8.7)
66
+ rdoc (~> 3.4)
67
+ thor (~> 0.14.6)
68
+ rake (0.9.2.2)
69
+ rdoc (3.12)
70
+ json (~> 1.4)
71
+ sprockets (2.1.2)
72
+ hike (~> 1.2)
73
+ rack (~> 1.0)
74
+ tilt (~> 1.1, != 1.3.0)
75
+ thor (0.14.6)
76
+ tilt (1.3.3)
77
+ treetop (1.4.10)
78
+ polyglot
79
+ polyglot (>= 0.3.1)
80
+ tzinfo (0.3.33)
81
+
82
+ PLATFORMS
83
+ ruby
84
+
85
+ DEPENDENCIES
86
+ ey_config
87
+ rails
88
+ rake