engineyard-serverside-adapter 1.6.0.pre2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside-adapter.rb +1 -4
- data/lib/engineyard-serverside-adapter/arguments.rb +1 -11
- data/lib/engineyard-serverside-adapter/command.rb +1 -3
- data/lib/engineyard-serverside-adapter/deploy.rb +9 -11
- data/lib/engineyard-serverside-adapter/disable_maintenance_page.rb +3 -5
- data/lib/engineyard-serverside-adapter/enable_maintenance_page.rb +3 -5
- data/lib/engineyard-serverside-adapter/integrate.rb +5 -7
- data/lib/engineyard-serverside-adapter/restart.rb +4 -6
- data/lib/engineyard-serverside-adapter/rollback.rb +6 -8
- data/lib/engineyard-serverside-adapter/version.rb +1 -1
- data/spec/adapter_spec.rb +18 -24
- data/spec/deploy_spec.rb +9 -73
- data/spec/disable_maintenance_page_spec.rb +3 -19
- data/spec/enable_maintenance_page_spec.rb +3 -19
- data/spec/integrate_spec.rb +5 -23
- data/spec/restart_spec.rb +4 -21
- data/spec/rollback_spec.rb +6 -25
- data/spec/spec_helper.rb +12 -16
- metadata +35 -12
@@ -14,10 +14,7 @@ module EY
|
|
14
14
|
autoload :Rollback, 'engineyard-serverside-adapter/rollback'
|
15
15
|
autoload :VERSION, 'engineyard-serverside-adapter/version'
|
16
16
|
|
17
|
-
|
18
|
-
# potentially-4-digit version lets us release fixes in the
|
19
|
-
# adapter while still keeping in version sync
|
20
|
-
ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || VERSION.split('.')[0..2].join('.')
|
17
|
+
ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || VERSION
|
21
18
|
|
22
19
|
def initialize(gem_bin_path = "")
|
23
20
|
@gem_bin_path = Pathname.new(gem_bin_path)
|
@@ -1,23 +1,13 @@
|
|
1
1
|
module EY
|
2
2
|
module Serverside
|
3
3
|
class Adapter
|
4
|
-
class Arguments < Struct.new(:app, :
|
4
|
+
class Arguments < Struct.new(:app, :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
|
-
|
21
11
|
def framework_env=(framework_env)
|
22
12
|
enforce_nonempty!('framework_env', framework_env)
|
23
13
|
super
|
@@ -55,9 +55,7 @@ module EY
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def string_argument(switch, value)
|
58
|
-
|
59
|
-
@arguments << [switch.sub(/^--/,'--no-')] # specifically for no-migrate
|
60
|
-
elsif !value.to_s.empty?
|
58
|
+
unless value.to_s.empty?
|
61
59
|
@arguments << [switch, value]
|
62
60
|
end
|
63
61
|
end
|
@@ -3,17 +3,15 @@ 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 :
|
15
|
-
option :repo, :string, :required => true
|
16
|
-
option :migrate, :string
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :stack, :string, :required => true
|
8
|
+
option :instances, :instances, :required => true
|
9
|
+
option :config, :json
|
10
|
+
option :verbose, :boolean
|
11
|
+
option :framework_env, :string, :required => true
|
12
|
+
option :ref, :string, :required => true
|
13
|
+
option :repo, :string, :required => true
|
14
|
+
option :migrate, :string
|
17
15
|
|
18
16
|
private
|
19
17
|
|
@@ -3,11 +3,9 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class DisableMaintenancePage < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
9
|
-
option :instances, :instances, :required => true
|
10
|
-
option :verbose, :boolean
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :instances, :instances, :required => true
|
8
|
+
option :verbose, :boolean
|
11
9
|
|
12
10
|
private
|
13
11
|
|
@@ -3,11 +3,9 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class EnableMaintenancePage < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
9
|
-
option :instances, :instances, :required => true
|
10
|
-
option :verbose, :boolean
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :instances, :instances, :required => true
|
8
|
+
option :verbose, :boolean
|
11
9
|
|
12
10
|
private
|
13
11
|
|
@@ -3,13 +3,11 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class Integrate < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
9
|
-
option :
|
10
|
-
option :
|
11
|
-
option :framework_env, :string, :required => true
|
12
|
-
option :verbose, :boolean
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :stack, :string, :required => true
|
8
|
+
option :instances, :instances, :required => true
|
9
|
+
option :framework_env, :string, :required => true
|
10
|
+
option :verbose, :boolean
|
13
11
|
|
14
12
|
private
|
15
13
|
|
@@ -3,12 +3,10 @@ module EY
|
|
3
3
|
class Adapter
|
4
4
|
class Restart < Action
|
5
5
|
|
6
|
-
option :app,
|
7
|
-
option :
|
8
|
-
option :
|
9
|
-
option :
|
10
|
-
option :stack, :string, :required => true
|
11
|
-
option :verbose, :boolean
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :instances, :instances, :required => true
|
8
|
+
option :stack, :string, :required => true
|
9
|
+
option :verbose, :boolean
|
12
10
|
|
13
11
|
private
|
14
12
|
|
@@ -3,14 +3,12 @@ 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 :
|
12
|
-
option :stack, :string, :required => true
|
13
|
-
option :verbose, :boolean
|
6
|
+
option :app, :string, :required => true
|
7
|
+
option :config, :json
|
8
|
+
option :framework_env, :string, :required => true
|
9
|
+
option :instances, :instances, :required => true
|
10
|
+
option :stack, :string, :required => true
|
11
|
+
option :verbose, :boolean
|
14
12
|
|
15
13
|
private
|
16
14
|
|
data/spec/adapter_spec.rb
CHANGED
@@ -3,14 +3,12 @@ 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.
|
12
|
-
args.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
13
|
-
args.stack = 'nginx_unicorn'
|
6
|
+
args.app = 'app-from-adapter-new'
|
7
|
+
args.instances = [{:hostname => 'localhost', :roles => %w[a b c]}]
|
8
|
+
args.framework_env = 'production'
|
9
|
+
args.ref = 'master'
|
10
|
+
args.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
11
|
+
args.stack = 'nginx_unicorn'
|
14
12
|
args
|
15
13
|
end
|
16
14
|
end
|
@@ -56,14 +54,12 @@ shared_examples_for "a serverside action" do
|
|
56
54
|
context "with a pathname specified" do
|
57
55
|
it "begins both commands with the given path" do
|
58
56
|
adapter = described_class.new("/usr/local/grin") do |args|
|
59
|
-
args.app
|
60
|
-
args.
|
61
|
-
args.
|
62
|
-
args.
|
63
|
-
args.
|
64
|
-
args.
|
65
|
-
args.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
66
|
-
args.stack = 'nginx_unicorn'
|
57
|
+
args.app = 'app-from-adapter-new'
|
58
|
+
args.instances = [{:hostname => 'localhost', :roles => %w[a b c]}]
|
59
|
+
args.framework_env = 'production'
|
60
|
+
args.ref = 'master'
|
61
|
+
args.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
62
|
+
args.stack = 'nginx_unicorn'
|
67
63
|
args
|
68
64
|
end
|
69
65
|
|
@@ -108,14 +104,12 @@ describe EY::Serverside::Adapter do
|
|
108
104
|
context "mapping of methods to action classes" do
|
109
105
|
before(:each) do
|
110
106
|
@adapter = described_class.new do |args|
|
111
|
-
args.app
|
112
|
-
args.
|
113
|
-
args.
|
114
|
-
args.
|
115
|
-
args.
|
116
|
-
args.
|
117
|
-
args.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
118
|
-
args.stack = 'nginx_unicorn'
|
107
|
+
args.app = 'app-from-adapter-new'
|
108
|
+
args.instances = [{:hostname => 'localhost', :roles => %w[a b c]}]
|
109
|
+
args.framework_env = 'production'
|
110
|
+
args.ref = 'master'
|
111
|
+
args.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
112
|
+
args.stack = 'nginx_unicorn'
|
119
113
|
args
|
120
114
|
end
|
121
115
|
end
|
data/spec/deploy_spec.rb
CHANGED
@@ -4,8 +4,6 @@ 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"
|
9
7
|
it_should_behave_like "it accepts framework_env"
|
10
8
|
it_should_behave_like "it accepts instances"
|
11
9
|
it_should_behave_like "it accepts migrate"
|
@@ -15,8 +13,6 @@ describe EY::Serverside::Adapter::Deploy do
|
|
15
13
|
it_should_behave_like "it accepts verbose"
|
16
14
|
|
17
15
|
it_should_require :app
|
18
|
-
it_should_require :environment_name
|
19
|
-
it_should_require :account_name
|
20
16
|
it_should_require :instances
|
21
17
|
it_should_require :framework_env
|
22
18
|
it_should_require :ref
|
@@ -29,16 +25,14 @@ describe EY::Serverside::Adapter::Deploy do
|
|
29
25
|
context "with valid arguments" do
|
30
26
|
let(:command) do
|
31
27
|
adapter = described_class.new do |arguments|
|
32
|
-
arguments.app
|
33
|
-
arguments.
|
34
|
-
arguments.
|
35
|
-
arguments.
|
36
|
-
arguments.
|
37
|
-
arguments.
|
38
|
-
arguments.
|
39
|
-
arguments.
|
40
|
-
arguments.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
41
|
-
arguments.stack = "nginx_unicorn"
|
28
|
+
arguments.app = "rackapp"
|
29
|
+
arguments.framework_env = 'production'
|
30
|
+
arguments.config = {'a' => 1}
|
31
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
32
|
+
arguments.migrate = 'rake db:migrate'
|
33
|
+
arguments.ref = 'master'
|
34
|
+
arguments.repo = 'git@github.com:engineyard/engineyard-serverside.git'
|
35
|
+
arguments.stack = "nginx_unicorn"
|
42
36
|
end
|
43
37
|
last_command(adapter)
|
44
38
|
end
|
@@ -48,65 +42,7 @@ describe EY::Serverside::Adapter::Deploy do
|
|
48
42
|
end
|
49
43
|
|
50
44
|
it "invokes exactly the right command" do
|
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(' ')
|
45
|
+
command.should == "engineyard-serverside _#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_ deploy --app rackapp --config '{\"a\":1}' --framework-env production --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost --migrate 'rake db:migrate' --ref master --repo git@github.com:engineyard/engineyard-serverside.git --stack nginx_unicorn"
|
110
46
|
end
|
111
47
|
end
|
112
48
|
end
|
@@ -4,39 +4,23 @@ 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"
|
9
7
|
it_should_behave_like "it accepts instances"
|
10
8
|
it_should_behave_like "it accepts verbose"
|
11
9
|
|
12
10
|
it_should_require :app
|
13
|
-
it_should_require :environment_name
|
14
|
-
it_should_require :account_name
|
15
11
|
it_should_require :instances
|
16
12
|
|
17
13
|
context "with valid arguments" do
|
18
14
|
let(:command) do
|
19
15
|
adapter = described_class.new do |arguments|
|
20
|
-
arguments.app
|
21
|
-
arguments.
|
22
|
-
arguments.account_name = "ey"
|
23
|
-
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
16
|
+
arguments.app = "rackapp"
|
17
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
24
18
|
end
|
25
19
|
last_command(adapter)
|
26
20
|
end
|
27
21
|
|
28
22
|
it "invokes exactly the right command" do
|
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(' ')
|
23
|
+
command.should == "engineyard-serverside _#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_ deploy disable_maintenance_page --app rackapp --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost"
|
40
24
|
end
|
41
25
|
end
|
42
26
|
end
|
@@ -4,40 +4,24 @@ 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"
|
9
7
|
it_should_behave_like "it accepts instances"
|
10
8
|
it_should_behave_like "it accepts verbose"
|
11
9
|
|
12
10
|
it_should_require :app
|
13
|
-
it_should_require :environment_name
|
14
|
-
it_should_require :account_name
|
15
11
|
it_should_require :instances
|
16
12
|
|
17
13
|
context "with valid arguments" do
|
18
14
|
|
19
15
|
let(:command) do
|
20
16
|
adapter = described_class.new do |arguments|
|
21
|
-
arguments.app
|
22
|
-
arguments.
|
23
|
-
arguments.account_name = "ey"
|
24
|
-
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
17
|
+
arguments.app = "rackapp"
|
18
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
25
19
|
end
|
26
20
|
last_command(adapter)
|
27
21
|
end
|
28
22
|
|
29
23
|
it "invokes exactly the right command" do
|
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(' ')
|
24
|
+
command.should == "engineyard-serverside _#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_ deploy enable_maintenance_page --app rackapp --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost"
|
41
25
|
end
|
42
26
|
end
|
43
27
|
|
data/spec/integrate_spec.rb
CHANGED
@@ -4,16 +4,12 @@ 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"
|
9
7
|
it_should_behave_like "it accepts framework_env"
|
10
8
|
it_should_behave_like "it accepts instances"
|
11
9
|
it_should_behave_like "it accepts stack"
|
12
10
|
it_should_behave_like "it accepts verbose"
|
13
11
|
|
14
12
|
it_should_require :app
|
15
|
-
it_should_require :environment_name
|
16
|
-
it_should_require :account_name
|
17
13
|
it_should_require :stack
|
18
14
|
it_should_require :instances
|
19
15
|
it_should_require :framework_env
|
@@ -21,30 +17,16 @@ describe EY::Serverside::Adapter::Integrate do
|
|
21
17
|
context "with valid arguments" do
|
22
18
|
let(:command) do
|
23
19
|
adapter = described_class.new do |arguments|
|
24
|
-
arguments.app
|
25
|
-
arguments.
|
26
|
-
arguments.
|
27
|
-
arguments.
|
28
|
-
arguments.stack = "nginx_unicorn"
|
29
|
-
arguments.framework_env = "production"
|
20
|
+
arguments.app = "rackapp"
|
21
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
22
|
+
arguments.stack = "nginx_unicorn"
|
23
|
+
arguments.framework_env = "production"
|
30
24
|
end
|
31
25
|
last_command(adapter)
|
32
26
|
end
|
33
27
|
|
34
28
|
it "invokes exactly the right command" do
|
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(' ')
|
29
|
+
command.should == "engineyard-serverside _#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_ integrate --app rackapp --framework-env production --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost --stack nginx_unicorn"
|
48
30
|
end
|
49
31
|
end
|
50
32
|
end
|
data/spec/restart_spec.rb
CHANGED
@@ -4,43 +4,26 @@ 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"
|
9
7
|
it_should_behave_like "it accepts instances"
|
10
8
|
it_should_behave_like "it accepts stack"
|
11
9
|
it_should_behave_like "it accepts verbose"
|
12
10
|
|
13
11
|
it_should_require :app
|
14
|
-
it_should_require :environment_name
|
15
|
-
it_should_require :account_name
|
16
12
|
it_should_require :instances
|
17
13
|
it_should_require :stack
|
18
14
|
|
19
15
|
context "with valid arguments" do
|
20
16
|
let(:command) do
|
21
17
|
adapter = described_class.new do |arguments|
|
22
|
-
arguments.app
|
23
|
-
arguments.
|
24
|
-
arguments.
|
25
|
-
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
26
|
-
arguments.stack = "nginx_unicorn"
|
18
|
+
arguments.app = "rackapp"
|
19
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
20
|
+
arguments.stack = "nginx_unicorn"
|
27
21
|
end
|
28
22
|
last_command(adapter)
|
29
23
|
end
|
30
24
|
|
31
25
|
it "invokes exactly the right command" do
|
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(' ')
|
26
|
+
command.should == "engineyard-serverside _#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_ restart --app rackapp --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost --stack nginx_unicorn"
|
44
27
|
end
|
45
28
|
end
|
46
29
|
end
|
data/spec/rollback_spec.rb
CHANGED
@@ -4,16 +4,12 @@ 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"
|
9
7
|
it_should_behave_like "it accepts framework_env"
|
10
8
|
it_should_behave_like "it accepts instances"
|
11
9
|
it_should_behave_like "it accepts stack"
|
12
10
|
it_should_behave_like "it accepts verbose"
|
13
11
|
|
14
12
|
it_should_require :app
|
15
|
-
it_should_require :environment_name
|
16
|
-
it_should_require :account_name
|
17
13
|
it_should_require :framework_env
|
18
14
|
it_should_require :instances
|
19
15
|
it_should_require :stack
|
@@ -21,13 +17,11 @@ describe EY::Serverside::Adapter::Rollback do
|
|
21
17
|
context "with valid arguments" do
|
22
18
|
let(:command) do
|
23
19
|
adapter = described_class.new do |arguments|
|
24
|
-
arguments.app
|
25
|
-
arguments.
|
26
|
-
arguments.
|
27
|
-
arguments.
|
28
|
-
arguments.
|
29
|
-
arguments.stack = "nginx_unicorn"
|
30
|
-
arguments.config = {'a' => 1}
|
20
|
+
arguments.app = "rackapp"
|
21
|
+
arguments.framework_env = 'production'
|
22
|
+
arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
|
23
|
+
arguments.stack = "nginx_unicorn"
|
24
|
+
arguments.config = {'a' => 1}
|
31
25
|
end
|
32
26
|
last_command(adapter)
|
33
27
|
end
|
@@ -37,20 +31,7 @@ describe EY::Serverside::Adapter::Rollback do
|
|
37
31
|
end
|
38
32
|
|
39
33
|
it "invokes exactly the right command" do
|
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(' ')
|
34
|
+
command.should == "engineyard-serverside _#{EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}_ deploy rollback --app rackapp --config '{\"a\":1}' --framework-env production --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost --stack nginx_unicorn"
|
54
35
|
end
|
55
36
|
end
|
56
37
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,14 +7,12 @@ require 'pp'
|
|
7
7
|
module ArgumentsHelpers
|
8
8
|
def valid_options
|
9
9
|
{
|
10
|
-
:app
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:repo => 'git@github.com:engineyard/engineyard-serverside.git',
|
17
|
-
:stack => 'nginx_unicorn',
|
10
|
+
:app => 'rackapp',
|
11
|
+
:framework_env => 'production',
|
12
|
+
:instances => [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}],
|
13
|
+
:ref => 'master',
|
14
|
+
:repo => 'git@github.com:engineyard/engineyard-serverside.git',
|
15
|
+
:stack => 'nginx_unicorn',
|
18
16
|
}
|
19
17
|
end
|
20
18
|
|
@@ -105,14 +103,12 @@ RSpec.configure do |config|
|
|
105
103
|
end
|
106
104
|
|
107
105
|
{
|
108
|
-
:app
|
109
|
-
:
|
110
|
-
:
|
111
|
-
:
|
112
|
-
:
|
113
|
-
:
|
114
|
-
:repo => '--repo',
|
115
|
-
:migrate => '--migrate',
|
106
|
+
:app => '--app',
|
107
|
+
:stack => '--stack',
|
108
|
+
:framework_env => '--framework-env',
|
109
|
+
:ref => '--ref',
|
110
|
+
:repo => '--repo',
|
111
|
+
:migrate => '--migrate',
|
116
112
|
}.each do |arg, switch|
|
117
113
|
shared_examples_for "it accepts #{arg}" do
|
118
114
|
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.6.
|
5
|
-
prerelease:
|
4
|
+
version: 1.6.3
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Martin Emde
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-03-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: escape
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: 0.0.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.0.4
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: json_pure
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,15 @@ dependencies:
|
|
33
38
|
version: '0'
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: rspec
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ~>
|
@@ -44,10 +54,15 @@ dependencies:
|
|
44
54
|
version: '2.0'
|
45
55
|
type: :development
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.0'
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: rake
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,7 +70,12 @@ dependencies:
|
|
55
70
|
version: '0'
|
56
71
|
type: :development
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
59
79
|
description: A separate adapter for speaking the CLI language of the engineyard-serverside
|
60
80
|
gem.
|
61
81
|
email:
|
@@ -103,6 +123,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
123
|
- - ! '>='
|
104
124
|
- !ruby/object:Gem::Version
|
105
125
|
version: '0'
|
126
|
+
segments:
|
127
|
+
- 0
|
128
|
+
hash: -2267632610055367426
|
106
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
130
|
none: false
|
108
131
|
requirements:
|
@@ -111,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
134
|
version: 1.3.6
|
112
135
|
requirements: []
|
113
136
|
rubyforge_project: engineyard-serverside-adapter
|
114
|
-
rubygems_version: 1.8.
|
137
|
+
rubygems_version: 1.8.19
|
115
138
|
signing_key:
|
116
139
|
specification_version: 3
|
117
140
|
summary: Adapter for speaking to engineyard-serverside
|