engineyard 2.2.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +75 -18
- data/lib/engineyard.rb +6 -6
- data/lib/engineyard/cli.rb +131 -11
- data/lib/engineyard/cli/ui.rb +42 -0
- data/lib/engineyard/config.rb +39 -105
- data/lib/engineyard/deploy_config.rb +19 -16
- data/lib/engineyard/error.rb +1 -1
- data/lib/engineyard/serverside_runner.rb +1 -1
- data/lib/engineyard/templates.rb +6 -0
- data/lib/engineyard/templates/ey.yml.erb +193 -0
- data/lib/engineyard/templates/ey_yml.rb +119 -0
- data/lib/engineyard/version.rb +2 -2
- data/spec/engineyard/deploy_config_spec.rb +33 -67
- data/spec/ey/deploy_spec.rb +54 -94
- data/spec/ey/init_spec.rb +123 -0
- data/spec/ey/rebuild_spec.rb +1 -1
- data/spec/ey/servers_spec.rb +143 -0
- data/spec/ey/timeout_deploy_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -7
- data/spec/support/helpers.rb +43 -1
- data/spec/support/shared_behavior.rb +4 -1
- metadata +19 -11
- data/lib/engineyard/deploy_config/migrate.rb +0 -129
@@ -13,6 +13,6 @@ describe "ey timeout-deploy" do
|
|
13
13
|
it "complains when there is no stuck deployment" do
|
14
14
|
login_scenario "one app, one environment"
|
15
15
|
fast_failing_ey ["timeout-deploy"]
|
16
|
-
@err.should include(%|No unfinished deployment was found for main/rails232app/giblets.|)
|
16
|
+
@err.should include(%|No unfinished deployment was found for main / rails232app / giblets.|)
|
17
17
|
end
|
18
18
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -56,13 +56,6 @@ RSpec.configure do |config|
|
|
56
56
|
config.before(:suite) { clean_tmpdir }
|
57
57
|
config.after(:suite) { clean_tmpdir }
|
58
58
|
|
59
|
-
def clean_eyrc
|
60
|
-
ENV['EYRC'] = File.join('/tmp','eyrc')
|
61
|
-
if ENV['EYRC'] && File.exist?(ENV['EYRC'])
|
62
|
-
File.unlink(ENV['EYRC'])
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
59
|
config.before(:all) do
|
67
60
|
clean_eyrc
|
68
61
|
FakeWeb.allow_net_connect = false
|
data/spec/support/helpers.rb
CHANGED
@@ -249,14 +249,28 @@ module SpecHelpers
|
|
249
249
|
@scenario_api_token
|
250
250
|
end
|
251
251
|
|
252
|
+
def clean_tmpdir
|
253
|
+
TMPDIR.rmtree if TMPDIR.exist?
|
254
|
+
end
|
255
|
+
|
252
256
|
def read_yaml(file)
|
253
|
-
|
257
|
+
contents = File.read(File.expand_path(file))
|
258
|
+
YAML.load(contents)
|
259
|
+
rescue Exception => e
|
260
|
+
raise "#{e}\n#{contents}"
|
254
261
|
end
|
255
262
|
|
256
263
|
def write_yaml(data, file)
|
257
264
|
File.open(file, "w"){|f| YAML.dump(data, f) }
|
258
265
|
end
|
259
266
|
|
267
|
+
def clean_eyrc
|
268
|
+
ENV['EYRC'] = File.join('/tmp','eyrc')
|
269
|
+
if ENV['EYRC'] && File.exist?(ENV['EYRC'])
|
270
|
+
File.unlink(ENV['EYRC'])
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
260
274
|
def read_eyrc
|
261
275
|
read_yaml(ENV['EYRC'])
|
262
276
|
end
|
@@ -265,6 +279,34 @@ module SpecHelpers
|
|
265
279
|
write_yaml(data, ENV['EYRC'])
|
266
280
|
end
|
267
281
|
|
282
|
+
def ey_yml
|
283
|
+
EY::Config.pathname
|
284
|
+
end
|
285
|
+
|
286
|
+
def clean_ey_yml
|
287
|
+
ey_yml.unlink if ey_yml && ey_yml.exist?
|
288
|
+
FileUtils.rm_r 'config' if FileTest.exist?('config')
|
289
|
+
end
|
290
|
+
|
291
|
+
def read_ey_yml
|
292
|
+
read_yaml(EY::Config.pathname)
|
293
|
+
end
|
294
|
+
|
295
|
+
def write_ey_yml(data)
|
296
|
+
write_yaml(data, EY::Config.pathname_for_write)
|
297
|
+
end
|
298
|
+
|
299
|
+
def expect_config(*keys)
|
300
|
+
root = keys.unshift('defaults') unless %w[defaults environments].include?(keys.first)
|
301
|
+
config = read_ey_yml
|
302
|
+
value = keys.inject(config) { |conf, key| conf[key] }
|
303
|
+
expect(value)
|
304
|
+
end
|
305
|
+
|
306
|
+
def exist
|
307
|
+
be_exist
|
308
|
+
end
|
309
|
+
|
268
310
|
def with_env(new_env_vars)
|
269
311
|
raise ArgumentError, "with_env takes a block" unless block_given?
|
270
312
|
old_env_vars = {}
|
@@ -86,6 +86,7 @@ shared_examples_for "it takes an environment name and an account name" do
|
|
86
86
|
run_ey({:environment => "giblets", :account => "main"})
|
87
87
|
verify_ran(make_scenario({
|
88
88
|
:environment => 'giblets',
|
89
|
+
:account => 'main',
|
89
90
|
:application => 'rails232app',
|
90
91
|
:master_hostname => 'app_master_hostname.compute-1.amazonaws.com',
|
91
92
|
:ssh_username => 'turkey',
|
@@ -113,6 +114,7 @@ shared_examples_for "it takes an environment name" do
|
|
113
114
|
run_ey(:environment => nil)
|
114
115
|
verify_ran(make_scenario({
|
115
116
|
:environment => 'giblets',
|
117
|
+
:account => 'main',
|
116
118
|
:application => 'rails232app',
|
117
119
|
:master_hostname => 'app_master_hostname.compute-1.amazonaws.com',
|
118
120
|
:ssh_username => 'turkey',
|
@@ -168,10 +170,11 @@ shared_examples_for "it takes an environment name" do
|
|
168
170
|
|
169
171
|
it "works when the substring is unambiguous" do
|
170
172
|
login_scenario "one app, many similarly-named environments"
|
171
|
-
run_ey({:environment => 'prod', :migrate =>
|
173
|
+
run_ey({:environment => 'prod', :migrate => 'rake db:migrate'}, {:debug => true})
|
172
174
|
verify_ran(make_scenario({
|
173
175
|
:environment => 'railsapp_production',
|
174
176
|
:application => 'rails232app',
|
177
|
+
:account => 'main',
|
175
178
|
:master_hostname => 'app_master_hostname.compute-1.amazonaws.com',
|
176
179
|
:ssh_username => 'turkey',
|
177
180
|
}))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Engine Yard Cloud Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.0
|
61
|
+
version: 2.2.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.0
|
68
|
+
version: 2.2.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: engineyard-cloud-client
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0.
|
75
|
+
version: 1.0.14
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.0.
|
82
|
+
version: 1.0.14
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: net-ssh
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -291,13 +291,15 @@ files:
|
|
291
291
|
- lib/engineyard/cli/web.rb
|
292
292
|
- lib/engineyard/cli.rb
|
293
293
|
- lib/engineyard/config.rb
|
294
|
-
- lib/engineyard/deploy_config/migrate.rb
|
295
294
|
- lib/engineyard/deploy_config/ref.rb
|
296
295
|
- lib/engineyard/deploy_config.rb
|
297
296
|
- lib/engineyard/error.rb
|
298
297
|
- lib/engineyard/eyrc.rb
|
299
298
|
- lib/engineyard/repo.rb
|
300
299
|
- lib/engineyard/serverside_runner.rb
|
300
|
+
- lib/engineyard/templates/ey.yml.erb
|
301
|
+
- lib/engineyard/templates/ey_yml.rb
|
302
|
+
- lib/engineyard/templates.rb
|
301
303
|
- lib/engineyard/thor.rb
|
302
304
|
- lib/engineyard/version.rb
|
303
305
|
- lib/engineyard.rb
|
@@ -345,6 +347,7 @@ files:
|
|
345
347
|
- spec/engineyard_spec.rb
|
346
348
|
- spec/ey/deploy_spec.rb
|
347
349
|
- spec/ey/ey_spec.rb
|
350
|
+
- spec/ey/init_spec.rb
|
348
351
|
- spec/ey/list_environments_spec.rb
|
349
352
|
- spec/ey/login_spec.rb
|
350
353
|
- spec/ey/logout_spec.rb
|
@@ -354,6 +357,7 @@ files:
|
|
354
357
|
- spec/ey/recipes/download_spec.rb
|
355
358
|
- spec/ey/recipes/upload_spec.rb
|
356
359
|
- spec/ey/rollback_spec.rb
|
360
|
+
- spec/ey/servers_spec.rb
|
357
361
|
- spec/ey/ssh_spec.rb
|
358
362
|
- spec/ey/status_spec.rb
|
359
363
|
- spec/ey/timeout_deploy_spec.rb
|
@@ -373,11 +377,13 @@ homepage: http://github.com/engineyard/engineyard
|
|
373
377
|
licenses:
|
374
378
|
- MIT
|
375
379
|
metadata: {}
|
376
|
-
post_install_message: ! "Thanks for installing engineyard
|
380
|
+
post_install_message: ! "Thanks for installing the engineyard gem!\n\nNeed help? Problem?
|
377
381
|
https://support.cloud.engineyard.com\nNot working? Uninstall this version to downgrade.\n\nIMPORTANT:\n
|
378
|
-
\ Please verify eydeploy.rb files in staging after upgrading!\n
|
379
|
-
|
380
|
-
|
382
|
+
\ Please verify eydeploy.rb files in staging after upgrading!\n Internals frequently
|
383
|
+
change that could break eydeploy.rb.\n\nGetting started:\n 1. Run `ey init` to
|
384
|
+
generate an annotated config file.\n 2. Review the ey.yml file and commit it to
|
385
|
+
your repository.\n 3. Run `ey deploy` when you're ready to deploy.\nThe Engine
|
386
|
+
Yard Pandas want to help you!\nEmail pandas@engineyard.com with your questions.\n"
|
381
387
|
rdoc_options: []
|
382
388
|
require_paths:
|
383
389
|
- lib
|
@@ -407,6 +413,7 @@ test_files:
|
|
407
413
|
- spec/engineyard_spec.rb
|
408
414
|
- spec/ey/deploy_spec.rb
|
409
415
|
- spec/ey/ey_spec.rb
|
416
|
+
- spec/ey/init_spec.rb
|
410
417
|
- spec/ey/list_environments_spec.rb
|
411
418
|
- spec/ey/login_spec.rb
|
412
419
|
- spec/ey/logout_spec.rb
|
@@ -416,6 +423,7 @@ test_files:
|
|
416
423
|
- spec/ey/recipes/download_spec.rb
|
417
424
|
- spec/ey/recipes/upload_spec.rb
|
418
425
|
- spec/ey/rollback_spec.rb
|
426
|
+
- spec/ey/servers_spec.rb
|
419
427
|
- spec/ey/ssh_spec.rb
|
420
428
|
- spec/ey/status_spec.rb
|
421
429
|
- spec/ey/timeout_deploy_spec.rb
|
@@ -1,129 +0,0 @@
|
|
1
|
-
module EY
|
2
|
-
class DeployConfig
|
3
|
-
class Migrate
|
4
|
-
|
5
|
-
DEFAULT = 'rake db:migrate'
|
6
|
-
|
7
|
-
def initialize(cli_opts, env_config, ui)
|
8
|
-
@cli_opts = cli_opts
|
9
|
-
@env_config = env_config
|
10
|
-
@ui = ui
|
11
|
-
|
12
|
-
@perform = nil
|
13
|
-
@command = nil
|
14
|
-
end
|
15
|
-
|
16
|
-
# Returns an array of [perform_migration, migrate_command] on success.
|
17
|
-
# Yields the block if no migrate options are set.
|
18
|
-
def when_outside_repo
|
19
|
-
if perform_from_cli_opts
|
20
|
-
if @perform
|
21
|
-
@command ||= command_from_opts || DEFAULT
|
22
|
-
else
|
23
|
-
@command = nil
|
24
|
-
end
|
25
|
-
[@perform, @command]
|
26
|
-
else
|
27
|
-
raise RefAndMigrateRequiredOutsideRepo.new(@cli_opts)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
# Returns an array of [perform_migration, migrate_command] on success.
|
32
|
-
# Should always return successfully.
|
33
|
-
def when_inside_repo
|
34
|
-
if perform_from_cli_opts || perform_from_config || perform_from_interaction
|
35
|
-
if @perform
|
36
|
-
@command ||= command_from_opts || command_from_config || DEFAULT
|
37
|
-
else
|
38
|
-
@command = nil
|
39
|
-
end
|
40
|
-
[@perform, @command]
|
41
|
-
else
|
42
|
-
raise MigrateRequired.new(@cli_opts)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
attr_reader :cli_opts, :env_config, :ui
|
49
|
-
|
50
|
-
def command_from_opts
|
51
|
-
cli_migrate = cli_opts.fetch('migrate', nil)
|
52
|
-
cli_migrate.respond_to?(:to_str) && cli_migrate.to_str
|
53
|
-
end
|
54
|
-
|
55
|
-
def command_from_config
|
56
|
-
env_config.migrate_command
|
57
|
-
end
|
58
|
-
|
59
|
-
def perform_from_cli_opts
|
60
|
-
@perform = cli_opts.fetch('migrate') { return false } # yields on not found
|
61
|
-
true
|
62
|
-
end
|
63
|
-
|
64
|
-
def perform_from_config
|
65
|
-
@perform = env_config.fetch('migrate') { return perform_implied_via_command_in_config }
|
66
|
-
if @perform
|
67
|
-
unless command_from_config
|
68
|
-
env_config.migration_command = DEFAULT
|
69
|
-
end
|
70
|
-
end
|
71
|
-
true
|
72
|
-
end
|
73
|
-
|
74
|
-
# if the command is set in ey.yml and perform isn't explicitly turned off,
|
75
|
-
# then we'll write out the old default of migrating always, since that's
|
76
|
-
# probably what is expected.
|
77
|
-
def perform_implied_via_command_in_config
|
78
|
-
if @perfom.nil? && @command = command_from_config
|
79
|
-
@perform = true
|
80
|
-
env_config.migrate = @perform
|
81
|
-
ui.info "********************************************************************************"
|
82
|
-
ui.info "#{env_config.path} config for #{env_config.name} has been updated to"
|
83
|
-
ui.info "migrate by default to maintain previous expected default behavior."
|
84
|
-
ui.info ""
|
85
|
-
ui.info "Please git commit #{env_config.path} with these new changes.", :yellow
|
86
|
-
ui.info ""
|
87
|
-
true
|
88
|
-
else
|
89
|
-
false
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def perform_from_interaction
|
94
|
-
@perform = ui.agree("Run migrations by default on #{env_config.name}? ", true)
|
95
|
-
env_config.migrate = @perform
|
96
|
-
if @perform
|
97
|
-
command_from_interaction
|
98
|
-
end
|
99
|
-
ui.info "#{env_config.path}: migrate settings saved for #{env_config.name}."
|
100
|
-
ui.info "You can override this default with --migrate or --no-migrate."
|
101
|
-
ui.info "Please git commit #{env_config.path} with these new changes.", :yellow
|
102
|
-
true
|
103
|
-
rescue Timeout::Error
|
104
|
-
@perform = nil
|
105
|
-
@command = nil
|
106
|
-
ui.error "Timeout when waiting for input. Maybe this is not a terminal?"
|
107
|
-
ui.error "ey deploy no longer migrates when no default is set in ey.yml."
|
108
|
-
ui.error "Run interactively for step-by-step ey.yml migration setup."
|
109
|
-
ui.error ""
|
110
|
-
ui.error "Alternatively, you may add ey.yml to your project directly:"
|
111
|
-
ui.error "---"
|
112
|
-
ui.error "environments:"
|
113
|
-
ui.error " #{env_config.name}:"
|
114
|
-
ui.error " migrate: true"
|
115
|
-
ui.error " migration_command: 'rake db:migrate'"
|
116
|
-
return false
|
117
|
-
end
|
118
|
-
|
119
|
-
# only interactively request a command if we interactively requested the perform setting.
|
120
|
-
# don't call this outside of the interactive setting (otherwise, why even have a default?)
|
121
|
-
def command_from_interaction
|
122
|
-
default = env_config.migration_command || DEFAULT
|
123
|
-
@command = ui.ask("Migration command? ", false, default)
|
124
|
-
env_config.migration_command = @command
|
125
|
-
@command
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|