engineyard-serverside-adapter 2.3.1 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NGZiMmNkZjNkYmI5NDE1MmZiMWMxMWZmNjY2Y2VmM2FhZmM1ZmM3NQ==
5
- data.tar.gz: !binary |-
6
- NjdiNDA2M2MxZGRmNWZjOWE2YTg5NjY3ZWIxNTlhOGY3YTc1ZTRmMQ==
2
+ SHA1:
3
+ metadata.gz: 27fd65e00c4cfbffdd74b28049bd13a12d1babd4
4
+ data.tar.gz: f97a51e9c09f0b09fa5314bacd083a1fc7c25573
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- OTIyYjJiNzlkNWYzOTdkN2Q1ZmExM2E2MWRmNjNmMGE1MThiOTg2NjYxOGUz
10
- YmUzNDA4OGQwMjg1OTMzODlhMDNlMDg5ODk1MThhYmYwNzFmMmFkNGMxYWFk
11
- MzFiMDk3MDZhODhlN2Y3ZjkxZTVjM2JjNjBhMjJkN2YxOGYyYTk=
12
- data.tar.gz: !binary |-
13
- MzUzY2NhMWNkOTgyOTQxOTNlOWZiNDRiMTA4Mjc2ZDZiZDM4YWUwMWI2MmUz
14
- YzNjOGFiYjVjNTYwZmIzMDFkOGUzZTM3MTZmYmMxMGQ3MzU0ZjgxNDVkZGFl
15
- MTdmZmZjNzkyYjczYjUxNWYyODJlY2M4N2Q5ZTVlN2ExZDlhNjc=
6
+ metadata.gz: ca7bbbf4d0d93bb663177c381d95f987edf66065eede3752dc211e89a2df9e225945b997a788a1f06e2dd20d119cbffad2b5d09d947819568b9e64165c4f3445
7
+ data.tar.gz: 5213ac42d8b9a786938619477b9d17e8969f136e7323a86af60baa60ddbfe4b97b050cd9e8e4d4bbe3e2d9f3e9305c152581cbada908e1eb02989733f7445853
@@ -4,6 +4,10 @@
4
4
 
5
5
  *
6
6
 
7
+ ## v2.4.0 (2014-09-22)
8
+
9
+ * Add MaintenanceStatus action that reports maintenance page up/down.
10
+
7
11
  ## v2.3.1 (2014-06-10)
8
12
 
9
13
  * Fixes a bug where maintenance actions incorrectly did not accept --config options.
@@ -13,6 +13,7 @@ module EY
13
13
  autoload :Deploy, 'engineyard-serverside-adapter/action/deploy'
14
14
  autoload :DisableMaintenance, 'engineyard-serverside-adapter/action/disable_maintenance'
15
15
  autoload :EnableMaintenance, 'engineyard-serverside-adapter/action/enable_maintenance'
16
+ autoload :MaintenanceStatus, 'engineyard-serverside-adapter/action/maintenance_status'
16
17
  autoload :Integrate, 'engineyard-serverside-adapter/action/integrate'
17
18
  autoload :Restart, 'engineyard-serverside-adapter/action/restart'
18
19
  autoload :Rollback, 'engineyard-serverside-adapter/action/rollback'
@@ -36,6 +37,10 @@ module EY
36
37
  EnableMaintenance.new(new_action_args, &b)
37
38
  end
38
39
 
40
+ def maintenance_status(&b)
41
+ MaintenanceStatus.new(new_action_args, &b)
42
+ end
43
+
39
44
  def integrate(&b)
40
45
  Integrate.new(new_action_args, &b)
41
46
  end
@@ -10,6 +10,7 @@ module EY
10
10
  autoload :Deploy, 'engineyard-serverside-adapter/action/deploy'
11
11
  autoload :DisableMaintenance, 'engineyard-serverside-adapter/action/disable_maintenance'
12
12
  autoload :EnableMaintenance, 'engineyard-serverside-adapter/action/enable_maintenance'
13
+ autoload :MaintenanceStatus, 'engineyard-serverside-adapter/action/maintenance_status'
13
14
  autoload :Integrate, 'engineyard-serverside-adapter/action/integrate'
14
15
  autoload :Restart, 'engineyard-serverside-adapter/action/restart'
15
16
  autoload :Rollback, 'engineyard-serverside-adapter/action/rollback'
@@ -35,6 +36,11 @@ module EY
35
36
  validate!
36
37
  end
37
38
 
39
+ def self.version_requirement(version=nil)
40
+ @version_requirement = Gem::Requirement.create(version) if version
41
+ @version_requirement
42
+ end
43
+
38
44
  def call(&block)
39
45
  commands.all? { |cmd| block.call(cmd.to_s) }
40
46
  end
@@ -124,6 +130,10 @@ module EY
124
130
  raise ArgumentError, "Required field [serverside_version] not provided."
125
131
  end
126
132
 
133
+ if self.class.version_requirement && !self.class.version_requirement.satisfied_by?(@serverside_version)
134
+ raise ArgumentError, "This command does not work with #{@serverside_version}. Version must be #{self.class.version_requirement}"
135
+ end
136
+
127
137
  missing = required_options - given_options
128
138
  unless missing.empty?
129
139
  options_s = missing.map{|option| option.name}.join(', ')
@@ -0,0 +1,29 @@
1
+ module EY::Serverside
2
+ class Adapter
3
+ class Action
4
+ class MaintenanceStatus < Action
5
+
6
+ version_requirement '>=2.5.0'
7
+
8
+ option :app, :string, :required => true
9
+ option :account_name, :string, :required => true
10
+ option :config, :json
11
+ option :environment_name, :string, :required => true
12
+ option :instance_names, :hash, :required => true
13
+ option :instance_roles, :hash, :required => true
14
+ option :instances, :array, :required => true
15
+ option :verbose, :boolean
16
+
17
+ private
18
+
19
+ def task
20
+ ['maintenance_status']
21
+ end
22
+
23
+ end
24
+
25
+ # backwards compatibility
26
+ EY::Serverside::Adapter::MaintenanceStatus = MaintenanceStatus
27
+ end
28
+ end
29
+ end
@@ -1,7 +1,7 @@
1
1
  module EY
2
2
  module Serverside
3
3
  class Adapter
4
- VERSION = "2.3.1"
4
+ VERSION = "2.4.0"
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe EY::Serverside::Adapter::MaintenanceStatus do
4
+ let(:serverside_version) { "2.5.0" }
5
+ it_should_behave_like "it installs engineyard-serverside"
6
+
7
+ it_should_behave_like "it accepts app"
8
+ it_should_behave_like "it accepts account_name"
9
+ it_should_behave_like "it accepts environment_name"
10
+ it_should_behave_like "it accepts account_name"
11
+ it_should_behave_like "it accepts instances"
12
+ it_should_behave_like "it accepts verbose"
13
+ it_should_behave_like "it accepts serverside_version", '2.5.1'
14
+
15
+ it_should_require :app
16
+ it_should_require :environment_name
17
+ it_should_require :account_name
18
+ it_should_require :instances
19
+ it_should_require :serverside_version
20
+
21
+ it_should_behave_like "it treats config as optional"
22
+
23
+ context "with valid arguments" do
24
+ let(:command) do
25
+ adapter = described_class.new do |arguments|
26
+ arguments.app = "rackapp"
27
+ arguments.environment_name = "rackapp_production"
28
+ arguments.account_name = "ey"
29
+ arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
30
+ arguments.serverside_version = serverside_version
31
+ end
32
+ last_command(adapter)
33
+ end
34
+
35
+ it "invokes exactly the right command" do
36
+ command.should == [
37
+ "engineyard-serverside",
38
+ "_#{serverside_version}_",
39
+ "maintenance_status",
40
+ "--account-name ey",
41
+ "--app rackapp",
42
+ "--environment-name rackapp_production",
43
+ "--instance-names localhost:chewie",
44
+ "--instance-roles localhost:han,solo",
45
+ "--instances localhost",
46
+ ].join(' ')
47
+ end
48
+
49
+ it "blows up if serverside version is too old" do
50
+ expect do
51
+ described_class.new do |arguments|
52
+ arguments.app = "rackapp"
53
+ arguments.environment_name = "rackapp_production"
54
+ arguments.account_name = "ey"
55
+ arguments.instances = [{:hostname => 'localhost', :roles => %w[han solo], :name => 'chewie'}]
56
+ arguments.serverside_version = "2.4.0"
57
+ end
58
+ end.to raise_error
59
+ end
60
+ end
61
+ end
@@ -233,10 +233,11 @@ RSpec.configure do |config|
233
233
  end
234
234
  end
235
235
 
236
- shared_examples_for "it accepts serverside_version" do
236
+ shared_examples_for "it accepts serverside_version" do |*args|
237
237
  it "puts the _VERSION_ command part in the command line" do
238
- adapter = described_class.new(:arguments => arguments_with(:serverside_version => '1.2.3'))
239
- last_command(adapter).should =~ /engineyard-serverside _1.2.3_/
238
+ version = args[0] || '1.2.3' # ruby 1.8.7 does not allow for default values of block variables
239
+ adapter = described_class.new(:arguments => arguments_with(:serverside_version => version))
240
+ last_command(adapter).should =~ /engineyard-serverside _#{version}_/
240
241
  end
241
242
  end
242
243
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Emde
@@ -9,62 +9,62 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-11 00:00:00.000000000 Z
12
+ date: 2014-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: escape
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: 0.0.4
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: 0.0.4
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: multi_json
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.6'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '1.6'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '2.0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '2.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ! '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ! '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  description: A separate adapter for speaking the CLI language of the engineyard-serverside
@@ -76,8 +76,8 @@ executables: []
76
76
  extensions: []
77
77
  extra_rdoc_files: []
78
78
  files:
79
- - .gitignore
80
- - .travis.yml
79
+ - ".gitignore"
80
+ - ".travis.yml"
81
81
  - ChangeLog.md
82
82
  - Gemfile
83
83
  - Guardfile
@@ -91,6 +91,7 @@ files:
91
91
  - lib/engineyard-serverside-adapter/action/disable_maintenance.rb
92
92
  - lib/engineyard-serverside-adapter/action/enable_maintenance.rb
93
93
  - lib/engineyard-serverside-adapter/action/integrate.rb
94
+ - lib/engineyard-serverside-adapter/action/maintenance_status.rb
94
95
  - lib/engineyard-serverside-adapter/action/restart.rb
95
96
  - lib/engineyard-serverside-adapter/action/rollback.rb
96
97
  - lib/engineyard-serverside-adapter/arguments.rb
@@ -104,6 +105,7 @@ files:
104
105
  - spec/disable_maintenance_spec.rb
105
106
  - spec/enable_maintenance_spec.rb
106
107
  - spec/integrate_spec.rb
108
+ - spec/maintenance_status_spec.rb
107
109
  - spec/restart_spec.rb
108
110
  - spec/rollback_spec.rb
109
111
  - spec/spec_helper.rb
@@ -117,17 +119,17 @@ require_paths:
117
119
  - lib
118
120
  required_ruby_version: !ruby/object:Gem::Requirement
119
121
  requirements:
120
- - - ! '>='
122
+ - - ">="
121
123
  - !ruby/object:Gem::Version
122
124
  version: '0'
123
125
  required_rubygems_version: !ruby/object:Gem::Requirement
124
126
  requirements:
125
- - - ! '>='
127
+ - - ">="
126
128
  - !ruby/object:Gem::Version
127
129
  version: 1.3.6
128
130
  requirements: []
129
131
  rubyforge_project: engineyard-serverside-adapter
130
- rubygems_version: 2.1.10
132
+ rubygems_version: 2.2.2
131
133
  signing_key:
132
134
  specification_version: 4
133
135
  summary: Adapter for speaking to engineyard-serverside