engineyard-serverside-adapter 1.6.4 → 1.7.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside-adapter/arguments.rb +11 -1
- data/lib/engineyard-serverside-adapter/command.rb +3 -1
- data/lib/engineyard-serverside-adapter/deploy.rb +11 -9
- data/lib/engineyard-serverside-adapter/disable_maintenance_page.rb +5 -3
- data/lib/engineyard-serverside-adapter/enable_maintenance_page.rb +5 -3
- data/lib/engineyard-serverside-adapter/integrate.rb +7 -5
- data/lib/engineyard-serverside-adapter/restart.rb +6 -4
- data/lib/engineyard-serverside-adapter/rollback.rb +8 -6
- data/lib/engineyard-serverside-adapter/version.rb +1 -1
- data/spec/adapter_spec.rb +24 -18
- data/spec/deploy_spec.rb +73 -9
- data/spec/disable_maintenance_page_spec.rb +19 -3
- data/spec/enable_maintenance_page_spec.rb +19 -3
- data/spec/integrate_spec.rb +23 -5
- data/spec/restart_spec.rb +21 -4
- data/spec/rollback_spec.rb +25 -6
- data/spec/spec_helper.rb +16 -12
- metadata +4 -7
@@ -1,13 +1,23 @@
|
|
1
1
|
module EY
|
2
2
|
module Serverside
|
3
3
|
class Adapter
|
4
|
-
class Arguments < Struct.new(:app, :config, :framework_env, :instances, :migrate, :ref, :repo, :stack, :verbose)
|
4
|
+
class Arguments < Struct.new(:app, :environment_name, :account_name, :config, :framework_env, :instances, :migrate, :ref, :repo, :stack, :verbose)
|
5
5
|
|
6
6
|
def app=(app)
|
7
7
|
enforce_nonempty!('app', app)
|
8
8
|
super
|
9
9
|
end
|
10
10
|
|
11
|
+
def environment_name=(env)
|
12
|
+
enforce_nonempty!('environment_name', env)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def account_name=(acc)
|
17
|
+
enforce_nonempty!('account_name', acc)
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
11
21
|
def framework_env=(framework_env)
|
12
22
|
enforce_nonempty!('framework_env', framework_env)
|
13
23
|
super
|
@@ -3,15 +3,17 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class Deploy < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
9
|
-
option :
|
10
|
-
option :
|
11
|
-
option :
|
12
|
-
option :
|
13
|
-
option :
|
14
|
-
option :
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :account_name, :string, :required => true
|
8
|
+
option :environment_name, :string, :required => true
|
9
|
+
option :stack, :string, :required => true
|
10
|
+
option :instances, :instances, :required => true
|
11
|
+
option :config, :json
|
12
|
+
option :verbose, :boolean
|
13
|
+
option :framework_env, :string, :required => true
|
14
|
+
option :ref, :string, :required => true
|
15
|
+
option :repo, :string, :required => true
|
16
|
+
option :migrate, :string
|
15
17
|
|
16
18
|
private
|
17
19
|
|
@@ -3,9 +3,11 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class DisableMaintenancePage < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :account_name, :string, :required => true
|
8
|
+
option :environment_name, :string, :required => true
|
9
|
+
option :instances, :instances, :required => true
|
10
|
+
option :verbose, :boolean
|
9
11
|
|
10
12
|
private
|
11
13
|
|
@@ -3,9 +3,11 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class EnableMaintenancePage < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :account_name, :string, :required => true
|
8
|
+
option :environment_name, :string, :required => true
|
9
|
+
option :instances, :instances, :required => true
|
10
|
+
option :verbose, :boolean
|
9
11
|
|
10
12
|
private
|
11
13
|
|
@@ -3,11 +3,13 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class Integrate < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
9
|
-
option :
|
10
|
-
option :
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :account_name, :string, :required => true
|
8
|
+
option :environment_name, :string, :required => true
|
9
|
+
option :stack, :string, :required => true
|
10
|
+
option :instances, :instances, :required => true
|
11
|
+
option :framework_env, :string, :required => true
|
12
|
+
option :verbose, :boolean
|
11
13
|
|
12
14
|
private
|
13
15
|
|
@@ -3,10 +3,12 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class Restart < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
9
|
-
option :
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :account_name, :string, :required => true
|
8
|
+
option :environment_name, :string, :required => true
|
9
|
+
option :instances, :instances, :required => true
|
10
|
+
option :stack, :string, :required => true
|
11
|
+
option :verbose, :boolean
|
10
12
|
|
11
13
|
private
|
12
14
|
|
@@ -3,12 +3,14 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class Rollback < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
9
|
-
option :
|
10
|
-
option :
|
11
|
-
option :
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :account_name, :string, :required => true
|
8
|
+
option :environment_name, :string, :required => true
|
9
|
+
option :config, :json
|
10
|
+
option :framework_env, :string, :required => true
|
11
|
+
option :instances, :instances, :required => true
|
12
|
+
option :stack, :string, :required => true
|
13
|
+
option :verbose, :boolean
|
12
14
|
|
13
15
|
private
|
14
16
|
|
data/spec/adapter_spec.rb
CHANGED
@@ -3,12 +3,14 @@ require 'spec_helper'
|
|
3
3
|
shared_examples_for "a serverside action" do
|
4
4
|
before(:each) do
|
5
5
|
@adapter = described_class.new do |args|
|
6
|
-
args.app
|
7
|
-
args.
|
8
|
-
args.
|
9
|
-
args.
|
10
|
-
args.
|
11
|
-
args.
|
6
|
+
args.app = 'app-from-adapter-new'
|
7
|
+
args.environment_name = 'env-from-adapter-new'
|
8
|
+
args.account_name = 'acc-from-adapter-new'
|
9
|
+
args.instances = [{:hostname => 'localhost', :roles => %w[a b c]}]
|
10
|
+
args.framework_env = 'production'
|
11
|
+
args.ref = 'master'
|
12
|
+
args.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
13
|
+
args.stack = 'nginx_unicorn'
|
12
14
|
args
|
13
15
|
end
|
14
16
|
end
|
@@ -54,12 +56,14 @@ shared_examples_for "a serverside action" do
|
|
54
56
|
context "with a pathname specified" do
|
55
57
|
it "begins both commands with the given path" do
|
56
58
|
adapter = described_class.new("/usr/local/grin") do |args|
|
57
|
-
args.app
|
58
|
-
args.
|
59
|
-
args.
|
60
|
-
args.
|
61
|
-
args.
|
62
|
-
args.
|
59
|
+
args.app = 'app-from-adapter-new'
|
60
|
+
args.environment_name = 'env-from-adapter-new'
|
61
|
+
args.account_name = 'acc-from-adapter-new'
|
62
|
+
args.instances = [{:hostname => 'localhost', :roles => %w[a b c]}]
|
63
|
+
args.framework_env = 'production'
|
64
|
+
args.ref = 'master'
|
65
|
+
args.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
66
|
+
args.stack = 'nginx_unicorn'
|
63
67
|
args
|
64
68
|
end
|
65
69
|
|
@@ -104,12 +108,14 @@ describe EY::Serverside::Adapter do
|
|
104
108
|
context "mapping of methods to action classes" do
|
105
109
|
before(:each) do
|
106
110
|
@adapter = described_class.new do |args|
|
107
|
-
args.app
|
108
|
-
args.
|
109
|
-
args.
|
110
|
-
args.
|
111
|
-
args.
|
112
|
-
args.
|
111
|
+
args.app = 'app-from-adapter-new'
|
112
|
+
args.environment_name = 'env-from-adapter-new'
|
113
|
+
args.account_name = 'acc-from-adapter-new'
|
114
|
+
args.instances = [{:hostname => 'localhost', :roles => %w[a b c]}]
|
115
|
+
args.framework_env = 'production'
|
116
|
+
args.ref = 'master'
|
117
|
+
args.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
118
|
+
args.stack = 'nginx_unicorn'
|
113
119
|
args
|
114
120
|
end
|
115
121
|
end
|
data/spec/deploy_spec.rb
CHANGED
@@ -4,6 +4,8 @@ describe EY::Serverside::Adapter::Deploy do
|
|
4
4
|
it_should_behave_like "it installs engineyard-serverside"
|
5
5
|
|
6
6
|
it_should_behave_like "it accepts app"
|
7
|
+
it_should_behave_like "it accepts environment_name"
|
8
|
+
it_should_behave_like "it accepts account_name"
|
7
9
|
it_should_behave_like "it accepts framework_env"
|
8
10
|
it_should_behave_like "it accepts instances"
|
9
11
|
it_should_behave_like "it accepts migrate"
|
@@ -13,6 +15,8 @@ describe EY::Serverside::Adapter::Deploy do
|
|
13
15
|
it_should_behave_like "it accepts verbose"
|
14
16
|
|
15
17
|
it_should_require :app
|
18
|
+
it_should_require :environment_name
|
19
|
+
it_should_require :account_name
|
16
20
|
it_should_require :instances
|
17
21
|
it_should_require :framework_env
|
18
22
|
it_should_require :ref
|
@@ -25,14 +29,16 @@ describe EY::Serverside::Adapter::Deploy do
|
|
25
29
|
context "with valid arguments" do
|
26
30
|
let(:command) do
|
27
31
|
adapter = described_class.new do |arguments|
|
28
|
-
arguments.app
|
29
|
-
arguments.
|
30
|
-
arguments.
|
31
|
-
arguments.
|
32
|
-
arguments.
|
33
|
-
arguments.
|
34
|
-
arguments.
|
35
|
-
arguments.
|
32
|
+
arguments.app = "rackapp"
|
33
|
+
arguments.environment_name = 'rackapp_production'
|
34
|
+
arguments.account_name = 'ey'
|
35
|
+
arguments.framework_env = 'production'
|
36
|
+
arguments.config = {'a' => 1}
|
37
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
38
|
+
arguments.migrate = 'rake db:migrate'
|
39
|
+
arguments.ref = 'master'
|
40
|
+
arguments.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
41
|
+
arguments.stack = "nginx_unicorn"
|
36
42
|
end
|
37
43
|
last_command(adapter)
|
38
44
|
end
|
@@ -42,7 +48,65 @@ describe EY::Serverside::Adapter::Deploy do
|
|
42
48
|
end
|
43
49
|
|
44
50
|
it "invokes exactly the right command" do
|
45
|
-
command.should ==
|
51
|
+
command.should == [
|
52
|
+
"engineyard-serverside",
|
53
|
+
"_#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_",
|
54
|
+
"deploy",
|
55
|
+
"--account-name ey",
|
56
|
+
"--app rackapp",
|
57
|
+
"--config '{\"a\":1}'",
|
58
|
+
"--environment-name rackapp_production",
|
59
|
+
"--framework-env production",
|
60
|
+
"--instance-names localhost:chewie",
|
61
|
+
"--instance-roles localhost:han,solo",
|
62
|
+
"--instances localhost",
|
63
|
+
"--migrate 'rake db:migrate'",
|
64
|
+
"--ref master",
|
65
|
+
"--repo git@github.com:engineyard/engineyard-serverside.git",
|
66
|
+
"--stack nginx_unicorn",
|
67
|
+
].join(' ')
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
context "with no migrate argument" do
|
72
|
+
let(:command) do
|
73
|
+
adapter = described_class.new do |arguments|
|
74
|
+
arguments.app = "rackapp"
|
75
|
+
arguments.environment_name = 'rackapp_production'
|
76
|
+
arguments.account_name = 'ey'
|
77
|
+
arguments.framework_env = 'production'
|
78
|
+
arguments.config = {'a' => 1}
|
79
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
80
|
+
arguments.migrate = false
|
81
|
+
arguments.ref = 'master'
|
82
|
+
arguments.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
83
|
+
arguments.stack = "nginx_unicorn"
|
84
|
+
end
|
85
|
+
last_command(adapter)
|
86
|
+
end
|
87
|
+
|
88
|
+
it "puts the config in the command line as json" do
|
89
|
+
command.should =~ /--config '#{Regexp.quote '{"a":1}'}'/
|
90
|
+
end
|
91
|
+
|
92
|
+
it "invokes exactly the right command" do
|
93
|
+
command.should == [
|
94
|
+
"engineyard-serverside",
|
95
|
+
"_#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_",
|
96
|
+
"deploy",
|
97
|
+
"--account-name ey",
|
98
|
+
"--app rackapp",
|
99
|
+
"--config '{\"a\":1}'",
|
100
|
+
"--environment-name rackapp_production",
|
101
|
+
"--framework-env production",
|
102
|
+
"--instance-names localhost:chewie",
|
103
|
+
"--instance-roles localhost:han,solo",
|
104
|
+
"--instances localhost",
|
105
|
+
"--no-migrate",
|
106
|
+
"--ref master",
|
107
|
+
"--repo git@github.com:engineyard/engineyard-serverside.git",
|
108
|
+
"--stack nginx_unicorn",
|
109
|
+
].join(' ')
|
46
110
|
end
|
47
111
|
end
|
48
112
|
end
|
@@ -4,23 +4,39 @@ describe EY::Serverside::Adapter::DisableMaintenancePage do
|
|
4
4
|
it_should_behave_like "it installs engineyard-serverside"
|
5
5
|
|
6
6
|
it_should_behave_like "it accepts app"
|
7
|
+
it_should_behave_like "it accepts environment_name"
|
8
|
+
it_should_behave_like "it accepts account_name"
|
7
9
|
it_should_behave_like "it accepts instances"
|
8
10
|
it_should_behave_like "it accepts verbose"
|
9
11
|
|
10
12
|
it_should_require :app
|
13
|
+
it_should_require :environment_name
|
14
|
+
it_should_require :account_name
|
11
15
|
it_should_require :instances
|
12
16
|
|
13
17
|
context "with valid arguments" do
|
14
18
|
let(:command) do
|
15
19
|
adapter = described_class.new do |arguments|
|
16
|
-
arguments.app
|
17
|
-
arguments.
|
20
|
+
arguments.app = "rackapp"
|
21
|
+
arguments.environment_name = "rackapp_production"
|
22
|
+
arguments.account_name = "ey"
|
23
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
18
24
|
end
|
19
25
|
last_command(adapter)
|
20
26
|
end
|
21
27
|
|
22
28
|
it "invokes exactly the right command" do
|
23
|
-
command.should ==
|
29
|
+
command.should == [
|
30
|
+
"engineyard-serverside",
|
31
|
+
"_#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_",
|
32
|
+
"deploy disable_maintenance_page",
|
33
|
+
"--account-name ey",
|
34
|
+
"--app rackapp",
|
35
|
+
"--environment-name rackapp_production",
|
36
|
+
"--instance-names localhost:chewie",
|
37
|
+
"--instance-roles localhost:han,solo",
|
38
|
+
"--instances localhost",
|
39
|
+
].join(' ')
|
24
40
|
end
|
25
41
|
end
|
26
42
|
end
|
@@ -4,24 +4,40 @@ describe EY::Serverside::Adapter::EnableMaintenancePage do
|
|
4
4
|
it_should_behave_like "it installs engineyard-serverside"
|
5
5
|
|
6
6
|
it_should_behave_like "it accepts app"
|
7
|
+
it_should_behave_like "it accepts environment_name"
|
8
|
+
it_should_behave_like "it accepts account_name"
|
7
9
|
it_should_behave_like "it accepts instances"
|
8
10
|
it_should_behave_like "it accepts verbose"
|
9
11
|
|
10
12
|
it_should_require :app
|
13
|
+
it_should_require :environment_name
|
14
|
+
it_should_require :account_name
|
11
15
|
it_should_require :instances
|
12
16
|
|
13
17
|
context "with valid arguments" do
|
14
18
|
|
15
19
|
let(:command) do
|
16
20
|
adapter = described_class.new do |arguments|
|
17
|
-
arguments.app
|
18
|
-
arguments.
|
21
|
+
arguments.app = "rackapp"
|
22
|
+
arguments.environment_name = "rackapp_production"
|
23
|
+
arguments.account_name = "ey"
|
24
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
19
25
|
end
|
20
26
|
last_command(adapter)
|
21
27
|
end
|
22
28
|
|
23
29
|
it "invokes exactly the right command" do
|
24
|
-
command.should ==
|
30
|
+
command.should == [
|
31
|
+
"engineyard-serverside",
|
32
|
+
"_#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_",
|
33
|
+
"deploy enable_maintenance_page",
|
34
|
+
"--account-name ey",
|
35
|
+
"--app rackapp",
|
36
|
+
"--environment-name rackapp_production",
|
37
|
+
"--instance-names localhost:chewie",
|
38
|
+
"--instance-roles localhost:han,solo",
|
39
|
+
"--instances localhost",
|
40
|
+
].join(' ')
|
25
41
|
end
|
26
42
|
end
|
27
43
|
|
data/spec/integrate_spec.rb
CHANGED
@@ -4,12 +4,16 @@ describe EY::Serverside::Adapter::Integrate do
|
|
4
4
|
it_should_behave_like "it installs engineyard-serverside"
|
5
5
|
|
6
6
|
it_should_behave_like "it accepts app"
|
7
|
+
it_should_behave_like "it accepts environment_name"
|
8
|
+
it_should_behave_like "it accepts account_name"
|
7
9
|
it_should_behave_like "it accepts framework_env"
|
8
10
|
it_should_behave_like "it accepts instances"
|
9
11
|
it_should_behave_like "it accepts stack"
|
10
12
|
it_should_behave_like "it accepts verbose"
|
11
13
|
|
12
14
|
it_should_require :app
|
15
|
+
it_should_require :environment_name
|
16
|
+
it_should_require :account_name
|
13
17
|
it_should_require :stack
|
14
18
|
it_should_require :instances
|
15
19
|
it_should_require :framework_env
|
@@ -17,16 +21,30 @@ describe EY::Serverside::Adapter::Integrate do
|
|
17
21
|
context "with valid arguments" do
|
18
22
|
let(:command) do
|
19
23
|
adapter = described_class.new do |arguments|
|
20
|
-
arguments.app
|
21
|
-
arguments.
|
22
|
-
arguments.
|
23
|
-
arguments.
|
24
|
+
arguments.app = "rackapp"
|
25
|
+
arguments.environment_name = "rackapp_production"
|
26
|
+
arguments.account_name = "ey"
|
27
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
28
|
+
arguments.stack = "nginx_unicorn"
|
29
|
+
arguments.framework_env = "production"
|
24
30
|
end
|
25
31
|
last_command(adapter)
|
26
32
|
end
|
27
33
|
|
28
34
|
it "invokes exactly the right command" do
|
29
|
-
command.should ==
|
35
|
+
command.should == [
|
36
|
+
"engineyard-serverside",
|
37
|
+
"_#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_",
|
38
|
+
"integrate",
|
39
|
+
"--account-name ey",
|
40
|
+
"--app rackapp",
|
41
|
+
"--environment-name rackapp_production",
|
42
|
+
"--framework-env production",
|
43
|
+
"--instance-names localhost:chewie",
|
44
|
+
"--instance-roles localhost:han,solo",
|
45
|
+
"--instances localhost",
|
46
|
+
"--stack nginx_unicorn",
|
47
|
+
].join(' ')
|
30
48
|
end
|
31
49
|
end
|
32
50
|
end
|
data/spec/restart_spec.rb
CHANGED
@@ -4,26 +4,43 @@ describe EY::Serverside::Adapter::Restart do
|
|
4
4
|
it_should_behave_like "it installs engineyard-serverside"
|
5
5
|
|
6
6
|
it_should_behave_like "it accepts app"
|
7
|
+
it_should_behave_like "it accepts environment_name"
|
8
|
+
it_should_behave_like "it accepts account_name"
|
7
9
|
it_should_behave_like "it accepts instances"
|
8
10
|
it_should_behave_like "it accepts stack"
|
9
11
|
it_should_behave_like "it accepts verbose"
|
10
12
|
|
11
13
|
it_should_require :app
|
14
|
+
it_should_require :environment_name
|
15
|
+
it_should_require :account_name
|
12
16
|
it_should_require :instances
|
13
17
|
it_should_require :stack
|
14
18
|
|
15
19
|
context "with valid arguments" do
|
16
20
|
let(:command) do
|
17
21
|
adapter = described_class.new do |arguments|
|
18
|
-
arguments.app
|
19
|
-
arguments.
|
20
|
-
arguments.
|
22
|
+
arguments.app = "rackapp"
|
23
|
+
arguments.environment_name = "rackapp_production"
|
24
|
+
arguments.account_name = "ey"
|
25
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
26
|
+
arguments.stack = "nginx_unicorn"
|
21
27
|
end
|
22
28
|
last_command(adapter)
|
23
29
|
end
|
24
30
|
|
25
31
|
it "invokes exactly the right command" do
|
26
|
-
command.should ==
|
32
|
+
command.should == [
|
33
|
+
"engineyard-serverside",
|
34
|
+
"_#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_",
|
35
|
+
"restart",
|
36
|
+
"--account-name ey",
|
37
|
+
"--app rackapp",
|
38
|
+
"--environment-name rackapp_production",
|
39
|
+
"--instance-names localhost:chewie",
|
40
|
+
"--instance-roles localhost:han,solo",
|
41
|
+
"--instances localhost",
|
42
|
+
"--stack nginx_unicorn",
|
43
|
+
].join(' ')
|
27
44
|
end
|
28
45
|
end
|
29
46
|
end
|
data/spec/rollback_spec.rb
CHANGED
@@ -4,12 +4,16 @@ describe EY::Serverside::Adapter::Rollback do
|
|
4
4
|
it_should_behave_like "it installs engineyard-serverside"
|
5
5
|
|
6
6
|
it_should_behave_like "it accepts app"
|
7
|
+
it_should_behave_like "it accepts environment_name"
|
8
|
+
it_should_behave_like "it accepts account_name"
|
7
9
|
it_should_behave_like "it accepts framework_env"
|
8
10
|
it_should_behave_like "it accepts instances"
|
9
11
|
it_should_behave_like "it accepts stack"
|
10
12
|
it_should_behave_like "it accepts verbose"
|
11
13
|
|
12
14
|
it_should_require :app
|
15
|
+
it_should_require :environment_name
|
16
|
+
it_should_require :account_name
|
13
17
|
it_should_require :framework_env
|
14
18
|
it_should_require :instances
|
15
19
|
it_should_require :stack
|
@@ -17,11 +21,13 @@ describe EY::Serverside::Adapter::Rollback do
|
|
17
21
|
context "with valid arguments" do
|
18
22
|
let(:command) do
|
19
23
|
adapter = described_class.new do |arguments|
|
20
|
-
arguments.app
|
21
|
-
arguments.
|
22
|
-
arguments.
|
23
|
-
arguments.
|
24
|
-
arguments.
|
24
|
+
arguments.app = "rackapp"
|
25
|
+
arguments.environment_name = "rackapp_production"
|
26
|
+
arguments.account_name = "ey"
|
27
|
+
arguments.framework_env = 'production'
|
28
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
29
|
+
arguments.stack = "nginx_unicorn"
|
30
|
+
arguments.config = {'a' => 1}
|
25
31
|
end
|
26
32
|
last_command(adapter)
|
27
33
|
end
|
@@ -31,7 +37,20 @@ describe EY::Serverside::Adapter::Rollback do
|
|
31
37
|
end
|
32
38
|
|
33
39
|
it "invokes exactly the right command" do
|
34
|
-
command.should ==
|
40
|
+
command.should == [
|
41
|
+
"engineyard-serverside",
|
42
|
+
"_#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_",
|
43
|
+
"deploy rollback",
|
44
|
+
"--account-name ey",
|
45
|
+
"--app rackapp",
|
46
|
+
"--config '{\"a\":1}'",
|
47
|
+
"--environment-name rackapp_production",
|
48
|
+
"--framework-env production",
|
49
|
+
"--instance-names localhost:chewie",
|
50
|
+
"--instance-roles localhost:han,solo",
|
51
|
+
"--instances localhost",
|
52
|
+
"--stack nginx_unicorn",
|
53
|
+
].join(' ')
|
35
54
|
end
|
36
55
|
end
|
37
56
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,12 +7,14 @@ require 'pp'
|
|
7
7
|
module ArgumentsHelpers
|
8
8
|
def valid_options
|
9
9
|
{
|
10
|
-
:app
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
10
|
+
:app => 'rackapp',
|
11
|
+
:environment_name => 'rackapp_production',
|
12
|
+
:account_name => 'ey',
|
13
|
+
:framework_env => 'production',
|
14
|
+
:instances => [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}],
|
15
|
+
:ref => 'master',
|
16
|
+
:repo => 'git@github.com:engineyard/engineyard-serverside.git',
|
17
|
+
:stack => 'nginx_unicorn',
|
16
18
|
}
|
17
19
|
end
|
18
20
|
|
@@ -103,12 +105,14 @@ RSpec.configure do |config|
|
|
103
105
|
end
|
104
106
|
|
105
107
|
{
|
106
|
-
:app
|
107
|
-
:
|
108
|
-
:
|
109
|
-
:
|
110
|
-
:
|
111
|
-
:
|
108
|
+
:app => '--app',
|
109
|
+
:environment_name => '--environment-name',
|
110
|
+
:account_name => '--account-name',
|
111
|
+
:stack => '--stack',
|
112
|
+
:framework_env => '--framework-env',
|
113
|
+
:ref => '--ref',
|
114
|
+
:repo => '--repo',
|
115
|
+
:migrate => '--migrate',
|
112
116
|
}.each do |arg, switch|
|
113
117
|
shared_examples_for "it accepts #{arg}" do
|
114
118
|
it "puts the #{switch} arg in the command line" do
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-serverside-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.7.0.pre
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Martin Emde
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-05-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: escape
|
@@ -123,9 +123,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- - ! '>='
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
-
segments:
|
127
|
-
- 0
|
128
|
-
hash: -390529157811432938
|
129
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
127
|
none: false
|
131
128
|
requirements:
|
@@ -134,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
131
|
version: 1.3.6
|
135
132
|
requirements: []
|
136
133
|
rubyforge_project: engineyard-serverside-adapter
|
137
|
-
rubygems_version: 1.8.
|
134
|
+
rubygems_version: 1.8.24
|
138
135
|
signing_key:
|
139
136
|
specification_version: 3
|
140
137
|
summary: Adapter for speaking to engineyard-serverside
|