engineyard-serverside 1.3.7 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
1
  module EY
2
- VERSION = '1.3.7'
2
+ module Serverside
3
+ VERSION = '1.4.0'
4
+ end
3
5
  end
@@ -1,8 +1,8 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
- describe "the EY::Deploy API" do
3
+ describe "the EY::Serverside::Deploy API" do
4
4
  it "calls tasks in the right order" do
5
- class TestDeploy < EY::Deploy
5
+ class TestDeploy < EY::Serverside::Deploy
6
6
  # This happens before require_custom_tasks, so it's not
7
7
  # overrideable. That's why it's not in @call_order.
8
8
  def update_repository_cache() end
@@ -31,7 +31,7 @@ describe "the EY::Deploy API" do
31
31
  def disable_maintenance_page() @call_order << 'disable_maintenance_page' end
32
32
  end
33
33
 
34
- td = TestDeploy.new(EY::Deploy::Configuration.new)
34
+ td = TestDeploy.new(EY::Serverside::Deploy::Configuration.new)
35
35
  td.deploy
36
36
  td.call_order.should == %w(
37
37
  push_code
@@ -48,13 +48,13 @@ describe "the EY::Deploy API" do
48
48
  end
49
49
 
50
50
  describe "task overrides" do
51
- class TestQuietDeploy < EY::Deploy
51
+ class TestQuietDeploy < EY::Serverside::Deploy
52
52
  def puts(*_) 'quiet' end
53
53
  end
54
54
 
55
55
  before(:each) do
56
56
  @tempdir = `mktemp -d -t custom_deploy_spec.XXXXX`.strip
57
- @config = EY::Deploy::Configuration.new('repository_cache' => @tempdir)
57
+ @config = EY::Serverside::Deploy::Configuration.new('repository_cache' => @tempdir)
58
58
  @deploy = TestQuietDeploy.new(@config)
59
59
  end
60
60
 
@@ -2,8 +2,8 @@ require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe "the deploy-hook API" do
4
4
  before(:each) do
5
- @hook = EY::DeployHook.new(options)
6
- @callback_context = EY::DeployHook::CallbackContext.new(@hook.config)
5
+ @hook = EY::Serverside::DeployHook.new(options)
6
+ @callback_context = EY::Serverside::DeployHook::CallbackContext.new(@hook.config)
7
7
  end
8
8
 
9
9
  def run_hook(options={}, &blk)
@@ -66,7 +66,7 @@ describe "the deploy-hook API" do
66
66
 
67
67
  context "the @node ivar" do
68
68
  before(:each) do
69
- EY.dna_json = {
69
+ EY::Serverside.dna_json = {
70
70
  'instance_role' => 'solo',
71
71
  'applications' => {
72
72
  'myapp' => {
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+
3
+ describe EY::Serverside do
4
+
5
+ it "preserves the old constants" do
6
+ EY::BundleInstaller.should == EY::Serverside::BundleInstaller
7
+ EY::CLI.should == EY::Serverside::CLI
8
+ EY::Deploy.should == EY::Serverside::Deploy
9
+ EY::DeployBase.should == EY::Serverside::DeployBase
10
+ EY::Deploy::Configuration.should == EY::Serverside::Deploy::Configuration
11
+ EY::DeployHook.should == EY::Serverside::DeployHook
12
+ EY::LockfileParser.should == EY::Serverside::LockfileParser
13
+ EY::LoggedOutput.should == EY::Serverside::LoggedOutput
14
+ EY::Server.should == EY::Serverside::Server
15
+ EY::Task.should == EY::Serverside::Task
16
+ EY::Strategies.should == EY::Serverside::Strategies
17
+ EY::Strategies::Git.should == EY::Serverside::Strategies::Git
18
+
19
+ lambda{ EY::WTFNotDefined }.should raise_error(NameError, /uninitialized constant EY::WTFNotDefined/)
20
+
21
+ #TODO: what about EY.node and EY.dna..
22
+
23
+ end
24
+
25
+ end
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe "the git deploy strategy" do
4
4
  subject do
5
- EY::Strategies::Git.new(:repo => File.expand_path("../fixtures/gitrepo/.git", __FILE__),
5
+ EY::Serverside::Strategies::Git.new(:repo => File.expand_path("../fixtures/gitrepo/.git", __FILE__),
6
6
  :repository_cache => File.expand_path("../fixtures/gitrepo", __FILE__),
7
7
  :ref => "master"
8
8
  )
@@ -3,12 +3,12 @@ require File.dirname(__FILE__) + '/spec_helper'
3
3
  describe "the bundler version retrieved from the lockfile" do
4
4
  def get_version(file)
5
5
  full_path = File.expand_path("../support/lockfiles/#{file}", __FILE__)
6
- @config = EY::Deploy::Configuration.new('deploy_to' => 'dontcare')
7
- EY::DeployBase.new(@config).get_bundler_installer(full_path).version
6
+ @config = EY::Serverside::Deploy::Configuration.new('deploy_to' => 'dontcare')
7
+ EY::Serverside::DeployBase.new(@config).get_bundler_installer(full_path).version
8
8
  end
9
9
 
10
10
  it "returns the default version for an 0.9 lockfile without a bundler dependency" do
11
- get_version('0.9-no-bundler').should == EY::DeployBase.new(@config).send(:default_09_bundler)
11
+ get_version('0.9-no-bundler').should == EY::Serverside::DeployBase.new(@config).send(:default_09_bundler)
12
12
  end
13
13
 
14
14
  it "gets the version from an 0.9 lockfile with a bundler dependency" do
@@ -16,7 +16,7 @@ describe "the bundler version retrieved from the lockfile" do
16
16
  end
17
17
 
18
18
  it "returns the default version for a 1.0 lockfile without a bundler dependency" do
19
- get_version('1.0-no-bundler').should == EY::DeployBase.new(@config).send(:default_10_bundler)
19
+ get_version('1.0-no-bundler').should == EY::Serverside::DeployBase.new(@config).send(:default_10_bundler)
20
20
  end
21
21
 
22
22
  it "gets the version from a 1.0.0.rc.1 lockfile w/dependency on 1.0.0.rc.1" do
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
- module EY::Strategies::IntegrationSpec
3
+ module EY::Serverside::Strategies::IntegrationSpec
4
4
  module Helpers
5
5
 
6
6
  def update_repository_cache
@@ -61,7 +61,7 @@ EOF
61
61
  end
62
62
 
63
63
  describe "deploying an application" do
64
- class FullTestDeploy < EY::Deploy
64
+ class FullTestDeploy < EY::Serverside::Deploy
65
65
  attr_reader :infos, :debugs, :commands
66
66
 
67
67
  def initialize(*)
@@ -134,12 +134,12 @@ describe "deploying an application" do
134
134
  before(:all) do
135
135
  @deploy_dir = File.join(Dir.tmpdir, "serverside-deploy-#{Time.now.to_i}-#{$$}")
136
136
 
137
- # set up EY::Server like we're on a solo
138
- EY::Server.reset
139
- EY::Server.add(:hostname => 'localhost', :roles => %w[solo])
137
+ # set up EY::Serverside::Server like we're on a solo
138
+ EY::Serverside::Server.reset
139
+ EY::Serverside::Server.add(:hostname => 'localhost', :roles => %w[solo])
140
140
 
141
141
  # run a deploy
142
- config = EY::Deploy::Configuration.new({
142
+ config = EY::Serverside::Deploy::Configuration.new({
143
143
  "strategy" => "IntegrationSpec",
144
144
  "deploy_to" => @deploy_dir,
145
145
  "group" => `id -gn`.strip,
@@ -149,11 +149,17 @@ describe "deploying an application" do
149
149
  'framework_env' => 'staging'
150
150
  })
151
151
 
152
- $0 = File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin', 'engineyard-serverside'))
152
+ @binpath = $0 = File.expand_path(File.join(File.dirname(__FILE__), '..', 'bin', 'engineyard-serverside'))
153
153
  @deployer = FullTestDeploy.new(config)
154
154
  @deployer.deploy
155
155
  end
156
156
 
157
+ it "runs the right bundler command" do
158
+ install_bundler_command_ran = @deployer.commands.detect{ |command| command.index("install_bundler") }
159
+ install_bundler_command_ran.should_not be_nil
160
+ install_bundler_command_ran.should == "#{@binpath} _#{EY::Serverside::VERSION}_ install_bundler 1.0.0"
161
+ end
162
+
157
163
  it "creates a REVISION file" do
158
164
  File.exist?(File.join(@deploy_dir, 'current', 'REVISION')).should be_true
159
165
  end
data/spec/restart_spec.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
- class TestRestartDeploy < EY::Deploy
3
+ class TestRestartDeploy < EY::Serverside::Deploy
4
4
  attr_reader :call_order
5
5
  def initialize(*a)
6
6
  super
@@ -13,14 +13,14 @@ class TestRestartDeploy < EY::Deploy
13
13
  def disable_maintenance_page() @call_order << 'disable_maintenance_page' end
14
14
  end
15
15
 
16
- describe "EY::Deploy#restart_with_maintenance_page" do
16
+ describe "EY::Serverside::Deploy#restart_with_maintenance_page" do
17
17
 
18
18
  class TestRestartWithMaintenancePage < TestRestartDeploy
19
19
  def conditionally_enable_maintenance_page() @call_order << 'conditionally_enable_maintenance_page' end
20
20
  end
21
21
 
22
22
  it "puts up the maintenance page if necessary, restarts, and takes down the maintenance page" do
23
- deployer = TestRestartWithMaintenancePage.new(EY::Deploy::Configuration.new)
23
+ deployer = TestRestartWithMaintenancePage.new(EY::Serverside::Deploy::Configuration.new)
24
24
  deployer.restart_with_maintenance_page
25
25
  deployer.call_order.should == %w(
26
26
  require_custom_tasks
@@ -34,7 +34,7 @@ end
34
34
  describe "glassfish stack" do
35
35
 
36
36
  it "requires a maintenance page" do
37
- config = EY::Deploy::Configuration.new(:stack => 'glassfish')
37
+ config = EY::Serverside::Deploy::Configuration.new(:stack => 'glassfish')
38
38
  deployer = TestRestartDeploy.new(config)
39
39
  deployer.restart_with_maintenance_page
40
40
  deployer.call_order.should include('enable_maintenance_page')
data/spec/server_spec.rb CHANGED
@@ -1,76 +1,76 @@
1
1
  require File.dirname(__FILE__) + "/spec_helper"
2
2
 
3
- describe EY::Server do
3
+ describe EY::Serverside::Server do
4
4
  before(:each) do
5
- EY::Server.reset
5
+ EY::Serverside::Server.reset
6
6
  end
7
7
 
8
8
  context ".all" do
9
9
  it "starts off empty" do
10
- EY::Server.all.should be_empty
10
+ EY::Serverside::Server.all.should be_empty
11
11
  end
12
12
 
13
13
  it "is added to with .add" do
14
- EY::Server.add(:hostname => 'otherhost', :roles => %w[fire water])
15
- EY::Server.all.size.should == 1
14
+ EY::Serverside::Server.add(:hostname => 'otherhost', :roles => %w[fire water])
15
+ EY::Serverside::Server.all.size.should == 1
16
16
 
17
- EY::Server.by_hostname('otherhost').should_not be_nil
17
+ EY::Serverside::Server.by_hostname('otherhost').should_not be_nil
18
18
  end
19
19
 
20
20
  it "rejects duplicates" do
21
- EY::Server.add(:hostname => 'otherhost')
21
+ EY::Serverside::Server.add(:hostname => 'otherhost')
22
22
  lambda do
23
- EY::Server.add(:hostname => 'otherhost')
24
- end.should raise_error(EY::Server::DuplicateHostname)
23
+ EY::Serverside::Server.add(:hostname => 'otherhost')
24
+ end.should raise_error(EY::Serverside::Server::DuplicateHostname)
25
25
  end
26
26
  end
27
27
 
28
28
  it "makes sure your roles are symbols at creation time" do
29
- EY::Server.add(:hostname => 'otherhost', :roles => ['beerguy'])
29
+ EY::Serverside::Server.add(:hostname => 'otherhost', :roles => ['beerguy'])
30
30
 
31
- EY::Server.by_hostname('otherhost').roles.should == [:beerguy]
31
+ EY::Serverside::Server.by_hostname('otherhost').roles.should == [:beerguy]
32
32
  end
33
33
 
34
34
  it "makes sure your roles are symbols when updated" do
35
- EY::Server.add(:hostname => 'otherhost')
35
+ EY::Serverside::Server.add(:hostname => 'otherhost')
36
36
 
37
- server = EY::Server.by_hostname('otherhost')
37
+ server = EY::Serverside::Server.by_hostname('otherhost')
38
38
  server.roles = %w[bourbon scotch beer]
39
39
  server.roles.should == [:bourbon, :scotch, :beer]
40
40
  end
41
41
 
42
42
  context ".from_roles" do
43
43
  before(:each) do
44
- @localhost = EY::Server.add(:hostname => 'localhost', :roles => [:ice, :cold])
45
- @host1 = EY::Server.add(:hostname => 'host1', :roles => [:fire, :water])
46
- @host2 = EY::Server.add(:hostname => 'host2', :roles => [:ice, :water])
44
+ @localhost = EY::Serverside::Server.add(:hostname => 'localhost', :roles => [:ice, :cold])
45
+ @host1 = EY::Serverside::Server.add(:hostname => 'host1', :roles => [:fire, :water])
46
+ @host2 = EY::Serverside::Server.add(:hostname => 'host2', :roles => [:ice, :water])
47
47
  end
48
48
 
49
49
  it "works with strings or symbols" do
50
- EY::Server.from_roles(:fire).should == [@host1]
51
- EY::Server.from_roles('fire').should == [@host1]
50
+ EY::Serverside::Server.from_roles(:fire).should == [@host1]
51
+ EY::Serverside::Server.from_roles('fire').should == [@host1]
52
52
  end
53
53
 
54
54
  it "finds all servers with the specified role" do
55
- EY::Server.from_roles('ice').size.should == 2
56
- EY::Server.from_roles('ice').sort do |a, b|
55
+ EY::Serverside::Server.from_roles('ice').size.should == 2
56
+ EY::Serverside::Server.from_roles('ice').sort do |a, b|
57
57
  a.hostname <=> b.hostname
58
58
  end.should == [@host2, @localhost]
59
59
  end
60
60
 
61
61
  it "finds all servers with any of the specified roles" do
62
- EY::Server.from_roles(:ice, :water).should == EY::Server.all
62
+ EY::Serverside::Server.from_roles(:ice, :water).should == EY::Serverside::Server.all
63
63
  end
64
64
 
65
65
  it "returns everything when asked for :all" do
66
- EY::Server.from_roles(:all).should == EY::Server.all
66
+ EY::Serverside::Server.from_roles(:all).should == EY::Serverside::Server.all
67
67
  end
68
68
  end
69
69
 
70
70
  context "#local?" do
71
71
  it "is true only for localhost" do
72
- EY::Server.new('localhost').should be_local
73
- EY::Server.new('neighborhost').should_not be_local
72
+ EY::Serverside::Server.new('localhost').should be_local
73
+ EY::Serverside::Server.new('neighborhost').should_not be_local
74
74
  end
75
75
  end
76
76
  end
data/spec/spec_helper.rb CHANGED
@@ -5,22 +5,24 @@ require 'pp'
5
5
  require 'engineyard-serverside'
6
6
 
7
7
  module EY
8
- def self.dna_json=(j)
9
- @dna_json = j;
10
- @node = nil
11
- j
12
- end
8
+ module Serverside
9
+ def self.dna_json=(j)
10
+ @dna_json = j;
11
+ @node = nil
12
+ j
13
+ end
13
14
 
14
- module LoggedOutput
15
- def info(_) end
15
+ module LoggedOutput
16
+ def info(_) end
16
17
 
17
- def logged_system(cmd)
18
- system("#{cmd} 2>/dev/null")
18
+ def logged_system(cmd)
19
+ system("#{cmd} 2>/dev/null")
20
+ end
19
21
  end
20
- end
21
22
 
22
- class Strategies::Git
23
- def short_log_message(_) "" end
23
+ class Strategies::Git
24
+ def short_log_message(_) "" end
25
+ end
24
26
  end
25
27
  end
26
28
 
@@ -32,6 +34,6 @@ Kernel.system "tar xzf #{GITREPO_DIR}.tar.gz -C #{FIXTURES_DIR}"
32
34
 
33
35
  Spec::Runner.configure do |config|
34
36
  config.before(:all) do
35
- EY.dna_json = {}.to_json
37
+ EY::Serverside.dna_json = {}.to_json
36
38
  end
37
39
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
- - 3
9
- - 7
10
- version: 1.3.7
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - EY Cloud Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-17 00:00:00 -08:00
18
+ date: 2010-11-18 00:00:00 -08:00
19
19
  default_executable: engineyard-serverside
20
20
  dependencies: []
21
21
 
@@ -35,6 +35,7 @@ files:
35
35
  - lib/engineyard-serverside/default_maintenance_page.html
36
36
  - lib/engineyard-serverside/deploy.rb
37
37
  - lib/engineyard-serverside/deploy_hook.rb
38
+ - lib/engineyard-serverside/deprecation.rb
38
39
  - lib/engineyard-serverside/lockfile_parser.rb
39
40
  - lib/engineyard-serverside/logged_output.rb
40
41
  - lib/engineyard-serverside/server.rb
@@ -235,6 +236,7 @@ files:
235
236
  - LICENSE
236
237
  - spec/custom_deploy_spec.rb
237
238
  - spec/deploy_hook_spec.rb
239
+ - spec/deprecation_spec.rb
238
240
  - spec/fixtures/gitrepo/foo
239
241
  - spec/fixtures/gitrepo.tar.gz
240
242
  - spec/fixtures/invalid_hook.rb
@@ -291,6 +293,7 @@ summary: A gem that deploys ruby applications on EY Cloud instances
291
293
  test_files:
292
294
  - spec/custom_deploy_spec.rb
293
295
  - spec/deploy_hook_spec.rb
296
+ - spec/deprecation_spec.rb
294
297
  - spec/fixtures/gitrepo/foo
295
298
  - spec/fixtures/gitrepo.tar.gz
296
299
  - spec/fixtures/invalid_hook.rb