engineyard-serverside-adapter 1.3.3 → 1.3.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Engine Yard, Inc
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ EY::Serverside::Adapter
2
+ =======================
3
+
4
+ This library provides an interface bound to the same version of
5
+ engineyard-serverside.
6
+
7
+ It tries very hard to throw an exception whenever the caller does
8
+ anything wrong. The benefit of this is that you can depend on a newer
9
+ version of engineyard-serverside-adapter and run your tests; if they
10
+ pass, you can be fairly confident that your code will work with the
11
+ newer version of engineyard-serverside.
12
+
13
+ engineyard-serverside-adapter provides you with a builder to describe
14
+ a cluster, and yields commands to the block you pass. Because it knows
15
+ nothing about how to connect to a server, only what commands to run,
16
+ it can be used anywhere where interaction with engineyard-serverside
17
+ is needed.
18
+
19
+
20
+ Example
21
+ -------
22
+
23
+ This example is adapted from the engineyard gem:
24
+
25
+ require 'engineyard-serverside-adapter'
26
+
27
+ def adapter(app, verbose)
28
+ EY::Serverside::Adapter.new("/usr/local/ey_resin/ruby/bin") do |args|
29
+ args.app = app.name
30
+ args.repo = app.repository_uri
31
+ args.instances = environment.instances.map { |i| {:hostname => i.public_hostname, :role => i.role, :name => i.name} }
32
+ args.verbose = verbose || ENV['DEBUG']
33
+ args.stack = environment.stack_name
34
+ args.framework_env = environment.framework_env
35
+ end
36
+ end
37
+ private :adapter
38
+
39
+ def deploy(app, ref, migration_command=nil, extra_configuration=nil, verbose=false)
40
+ deploy_command = adapter(app, verbose).deploy do |args|
41
+ args.config = extra_configuration if extra_configuration # anything that can be to_json'd
42
+ args.migrate = migration_command if migration_command
43
+ args.ref = ref
44
+ end
45
+
46
+ deploy_command.call { |command| app_master.ssh(command) }
47
+ end
48
+
49
+ You can set up args in Adapter.new, in Adapter#deploy (#rollback,
50
+ #restart, etc.), or in both. A good idea is to set up common args
51
+ (e.g. app, instances) in Adapter.new and then supply deploy-specific
52
+ args to Adapter#deploy. We hope this lets your code stay DRY while
53
+ also avoiding unnecessary work from generating unnecessary args.
54
+
55
+ Releasing
56
+ ---------
57
+
58
+ Bump the version in lib/engineyard-serverside-adapter/version.rb, commit it, and then run
59
+
60
+ $ rake release
61
+
62
+ This will tag and push for you.
63
+
64
+ The engineyard gem depends on this gem to talk to the server side deploy mechanism.
65
+ Update the version of engineyard-serverside-adapter in engineyard's Gemfile to
66
+ interact with a new version of engineyard-serverside.
@@ -15,9 +15,10 @@ Gem::Specification.new do |s|
15
15
  s.rubyforge_project = "engineyard-serverside-adapter"
16
16
 
17
17
  s.add_dependency "escape", "~> 0.0.4"
18
- s.add_dependency "json_pure", "~> 1.4.6"
18
+ s.add_dependency "json_pure"
19
19
  s.add_development_dependency "bundler", ">= 1.0.0"
20
20
  s.add_development_dependency "rspec", "~> 1.3.0"
21
+ s.add_development_dependency "rake"
21
22
 
22
23
  s.files = `git ls-files`.split("\n")
23
24
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
@@ -14,7 +14,10 @@ module EY
14
14
  autoload :Rollback, 'engineyard-serverside-adapter/rollback'
15
15
  autoload :VERSION, 'engineyard-serverside-adapter/version'
16
16
 
17
- ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || VERSION
17
+ # engineyard-serverside uses major.minor.patch; using a
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('.')
18
21
 
19
22
  def initialize(gem_bin_path = "")
20
23
  @gem_bin_path = Pathname.new(gem_bin_path)
@@ -1,7 +1,7 @@
1
1
  module EY
2
2
  module Serverside
3
3
  class Adapter
4
- VERSION = "1.3.3"
4
+ VERSION = "1.3.3.1"
5
5
  end
6
6
  end
7
7
  end
data/spec/deploy_spec.rb CHANGED
@@ -42,7 +42,7 @@ describe EY::Serverside::Adapter::Deploy do
42
42
  end
43
43
 
44
44
  it "invokes exactly the right command" do
45
- command.should == "engineyard-serverside _#{EY::Serverside::Adapter::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"
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"
46
46
  end
47
47
  end
48
48
  end
@@ -20,7 +20,7 @@ describe EY::Serverside::Adapter::DisableMaintenancePage do
20
20
  end
21
21
 
22
22
  it "invokes exactly the right command" do
23
- command.should == "engineyard-serverside _#{EY::Serverside::Adapter::VERSION}_ deploy disable_maintenance_page --app rackapp --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost"
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"
24
24
  end
25
25
  end
26
26
  end
@@ -21,7 +21,7 @@ describe EY::Serverside::Adapter::EnableMaintenancePage do
21
21
  end
22
22
 
23
23
  it "invokes exactly the right command" do
24
- command.should == "engineyard-serverside _#{EY::Serverside::Adapter::VERSION}_ deploy enable_maintenance_page --app rackapp --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost"
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"
25
25
  end
26
26
  end
27
27
 
@@ -26,7 +26,7 @@ describe EY::Serverside::Adapter::Integrate do
26
26
  end
27
27
 
28
28
  it "invokes exactly the right command" do
29
- command.should == "engineyard-serverside _#{EY::Serverside::Adapter::VERSION}_ integrate --app rackapp --framework-env production --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost --stack nginx_unicorn"
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"
30
30
  end
31
31
  end
32
32
  end
data/spec/restart_spec.rb CHANGED
@@ -23,7 +23,7 @@ describe EY::Serverside::Adapter::Restart do
23
23
  end
24
24
 
25
25
  it "invokes exactly the right command" do
26
- command.should == "engineyard-serverside _#{EY::Serverside::Adapter::VERSION}_ restart --app rackapp --instance-names localhost:chewie --instance-roles localhost:han,solo --instances localhost --stack nginx_unicorn"
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"
27
27
  end
28
28
  end
29
29
  end
@@ -31,7 +31,7 @@ describe EY::Serverside::Adapter::Rollback do
31
31
  end
32
32
 
33
33
  it "invokes exactly the right command" do
34
- command.should == "engineyard-serverside _#{EY::Serverside::Adapter::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"
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"
35
35
  end
36
36
  end
37
37
  end
data/spec/spec_helper.rb CHANGED
@@ -79,7 +79,7 @@ Spec::Runner.configure do |config|
79
79
 
80
80
  installation_command.should =~ /gem list engineyard-serverside/
81
81
  installation_command.should =~ /egrep -q /
82
- installation_command.should =~ /gem install engineyard-serverside.*-v #{Regexp.quote EY::Serverside::Adapter::VERSION}/
82
+ installation_command.should =~ /gem install engineyard-serverside.*-v #{Regexp.quote EY::Serverside::Adapter::ENGINEYARD_SERVERSIDE_VERSION}/
83
83
  end
84
84
  end
85
85
 
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside-adapter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 73
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
9
  - 3
10
- version: 1.3.3
10
+ - 1
11
+ version: 1.3.3.1
11
12
  platform: ruby
12
13
  authors: []
13
14
 
@@ -40,14 +41,12 @@ dependencies:
40
41
  requirement: &id002 !ruby/object:Gem::Requirement
41
42
  none: false
42
43
  requirements:
43
- - - ~>
44
+ - - ">="
44
45
  - !ruby/object:Gem::Version
45
- hash: 11
46
+ hash: 3
46
47
  segments:
47
- - 1
48
- - 4
49
- - 6
50
- version: 1.4.6
48
+ - 0
49
+ version: "0"
51
50
  type: :runtime
52
51
  version_requirements: *id002
53
52
  - !ruby/object:Gem::Dependency
@@ -82,6 +81,20 @@ dependencies:
82
81
  version: 1.3.0
83
82
  type: :development
84
83
  version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ hash: 3
93
+ segments:
94
+ - 0
95
+ version: "0"
96
+ type: :development
97
+ version_requirements: *id005
85
98
  description: A separate adapter for speaking the CLI language of the engineyard-serverside gem.
86
99
  email: []
87
100
 
@@ -94,6 +107,8 @@ extra_rdoc_files: []
94
107
  files:
95
108
  - .gitignore
96
109
  - Gemfile
110
+ - LICENSE
111
+ - README.md
97
112
  - Rakefile
98
113
  - engineyard-serverside-adapter.gemspec
99
114
  - lib/engineyard-serverside-adapter.rb