engineyard 0.5.5 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,7 @@ module EY
41
41
  method_option :app, :type => :string, :aliases => %w(-a),
42
42
  :desc => "Name of the application to deploy"
43
43
  def deploy
44
- app = api.fetch_app!(options[:app]) || api.app_for_repo!(repo)
44
+ app = fetch_app(options[:app])
45
45
  environment = fetch_environment(options[:environment], app)
46
46
  deploy_ref = if options[:app]
47
47
  environment.resolve_branch(options[:ref], options[:force]) ||
@@ -108,11 +108,14 @@ module EY
108
108
  Uses code from previous deploy in the "/data/APP_NAME/releases" directory on
109
109
  remote server(s) to restart application servers.
110
110
  DESC
111
+
111
112
  method_option :environment, :type => :string, :aliases => %w(-e),
112
- :desc => "Environment in which to roll back the current application"
113
+ :desc => "Environment in which to roll back the application"
114
+ method_option :app, :type => :string, :aliases => %w(-a),
115
+ :desc => "Name of the application to roll back"
113
116
  def rollback
114
- app = api.app_for_repo!(repo)
115
- env = fetch_environment(options[:environment])
117
+ app = fetch_app(options[:app])
118
+ env = fetch_environment(options[:environment], app)
116
119
 
117
120
  loudly_check_eysd(env)
118
121
 
@@ -4,9 +4,11 @@ module EY
4
4
  desc "enable [--environment/-e ENVIRONMENT]",
5
5
  "Remove the maintenance page for this application in the given environment."
6
6
  method_option :environment, :type => :string, :aliases => %w(-e),
7
- :desc => "Environment on which to put up the maintenance page"
7
+ :desc => "Environment on which to take down the maintenance page"
8
+ method_option :app, :type => :string, :aliases => %w(-a),
9
+ :desc => "Name of the application whose maintenance page will be removed"
8
10
  def enable
9
- app = api.app_for_repo!(repo)
11
+ app = fetch_app(options[:app])
10
12
  environment = fetch_environment(options[:environment], app)
11
13
  loudly_check_eysd(environment)
12
14
  EY.ui.info "Taking down maintenance page for #{environment.name}"
@@ -27,9 +29,11 @@ module EY
27
29
  * public/system/maintenance.html.default
28
30
  DESC
29
31
  method_option :environment, :type => :string, :aliases => %w(-e),
30
- :desc => "Environment on which to take down the maintenance page"
32
+ :desc => "Environment on which to put up the maintenance page"
33
+ method_option :app, :type => :string, :aliases => %w(-a),
34
+ :desc => "Name of the application whose maintenance page will be put up"
31
35
  def disable
32
- app = api.app_for_repo!(repo)
36
+ app = fetch_app(options[:app])
33
37
  environment = fetch_environment(options[:environment], app)
34
38
  loudly_check_eysd(environment)
35
39
  EY.ui.info "Putting up maintenance page for #{environment.name}"
@@ -3,27 +3,11 @@ require 'escape'
3
3
  module EY
4
4
  module Model
5
5
  class Instance < ApiStruct.new(:id, :role, :name, :status, :amazon_id, :public_hostname, :environment)
6
- EYSD_VERSION = "~>0.6.1"
7
- CHECK_SCRIPT = <<-SCRIPT
8
- require "rubygems"
9
- requirement = Gem::Requirement.new("#{EYSD_VERSION}")
10
- required_version = requirement.requirements.last.last # thanks thanks rubygems rubygems
11
-
12
- # this will be a ["name-version", Gem::Specification] two-element array if present, nil otherwise
13
- ey_deploy_geminfo = Gem.source_index.find{ |(name,_)| name =~ /^ey-deploy-\\\d/ }
14
- exit(104) unless ey_deploy_geminfo
15
-
16
- current_version = ey_deploy_geminfo.last.version
17
- exit(0) if requirement.satisfied_by?(current_version)
18
- exit(70) if required_version > current_version
19
- exit(17) # required_version < current_version
20
- SCRIPT
6
+ EYSD_VERSION = ENV["EY_DEPLOY_VERSION"] || "0.7.0"
21
7
  EXIT_STATUS = Hash.new { |h,k| raise EY::Error, "ey-deploy version checker exited with unknown status code #{k}" }
22
8
  EXIT_STATUS.merge!({
23
9
  255 => :ssh_failed,
24
- 104 => :eysd_missing,
25
- 70 => :too_old,
26
- 17 => :too_new,
10
+ 1 => :eysd_missing,
27
11
  0 => :ok,
28
12
  })
29
13
 
@@ -79,11 +63,6 @@ exit(17) # required_version < current_version
79
63
  when :eysd_missing
80
64
  yield :installing if block_given?
81
65
  install_ey_deploy
82
- when :too_new
83
- raise EnvironmentError, "server-side component too new; please upgrade your copy of the engineyard gem."
84
- when :too_old
85
- yield :upgrading if block_given?
86
- upgrade_ey_deploy
87
66
  when :ok
88
67
  # no action needed
89
68
  else
@@ -92,12 +71,12 @@ exit(17) # required_version < current_version
92
71
  end
93
72
 
94
73
  def ey_deploy_check
95
- require 'base64'
96
- encoded_script = Base64.encode64(CHECK_SCRIPT).gsub(/\n/, '')
97
- ssh "#{ruby_path} -r base64 -e \"eval Base64.decode64(ARGV[0])\" #{encoded_script}", false
74
+ escaped_eysd_version = EYSD_VERSION.gsub(/\./, '\.')
75
+
98
76
  if ENV["NO_SSH"]
99
77
  :ok
100
78
  else
79
+ ssh "#{gem_path} list ey-deploy | grep \"ey-deploy \" | egrep -q '#{escaped_eysd_version}[,)]'"
101
80
  EXIT_STATUS[$?.exitstatus]
102
81
  end
103
82
  end
@@ -111,12 +90,7 @@ exit(17) # required_version < current_version
111
90
  #
112
91
  # rubygems help suggests that --remote will disable this
113
92
  # behavior, but it doesn't.
114
- "cd `mktemp -d` && #{gem_path} install ey-deploy --no-rdoc --no-ri -v '#{EYSD_VERSION}'"]))
115
- end
116
-
117
- def upgrade_ey_deploy
118
- ssh "sudo #{gem_path} uninstall -a -x ey-deploy"
119
- install_ey_deploy
93
+ "cd `mktemp -d` && #{gem_path} install ey-deploy --no-rdoc --no-ri -v #{EYSD_VERSION}"]))
120
94
  end
121
95
 
122
96
  private
@@ -135,7 +109,7 @@ exit(17) # required_version < current_version
135
109
  end
136
110
 
137
111
  def invoke_eysd_deploy(deploy_args)
138
- start = [eysd_path, 'deploy']
112
+ start = [eysd_path, "_#{EYSD_VERSION}_", 'deploy']
139
113
  instance_args = environment.instances.inject(['--instances']) do |command, inst|
140
114
  instance_tuple = [inst.public_hostname, inst.role]
141
115
  instance_tuple << inst.name if inst.name
@@ -101,6 +101,10 @@ module EY
101
101
  end
102
102
  end
103
103
 
104
+ def fetch_app(app_name = nil)
105
+ api.fetch_app!(app_name) || api.app_for_repo!(repo)
106
+ end
107
+
104
108
  def get_apps(all_apps = false)
105
109
  if all_apps
106
110
  api.apps
@@ -1,3 +1,3 @@
1
1
  module EY
2
- VERSION = '0.5.5'
2
+ VERSION = '0.7.0'
3
3
  end
@@ -28,17 +28,20 @@ describe "ey deploy" do
28
28
 
29
29
  def command_to_run(options)
30
30
  cmd = "deploy"
31
- cmd << " -e #{options[:env]}" if options[:env]
31
+ cmd << " --environment #{options[:env]}" if options[:env]
32
+ cmd << " --app #{options[:app]}" if options[:app]
33
+ cmd << " --ref #{options[:ref]}" if options[:ref]
32
34
  cmd
33
35
  end
34
36
 
35
37
  def verify_ran(scenario)
36
38
  @out.should match(/Running deploy for '#{scenario[:environment]}'/)
37
- @ssh_commands.should have_command_like(/eysd deploy/)
39
+ @ssh_commands.should have_command_like(/eysd.*deploy.*--app #{scenario[:application]}/)
38
40
  end
39
41
 
40
42
  # common behavior
41
43
  it_should_behave_like "it takes an environment name"
44
+ it_should_behave_like "it takes an app name"
42
45
  it_should_behave_like "it invokes eysd"
43
46
  end
44
47
 
@@ -84,13 +87,13 @@ describe "ey deploy" do
84
87
 
85
88
  it "defaults to 'rake db:migrate'" do
86
89
  ey "deploy"
87
- @ssh_commands.last.should =~ /eysd deploy/
90
+ @ssh_commands.last.should =~ /eysd.*deploy/
88
91
  @ssh_commands.last.should =~ /--migrate 'rake db:migrate'/
89
92
  end
90
93
 
91
94
  it "can be disabled with --no-migrate" do
92
95
  ey "deploy --no-migrate"
93
- @ssh_commands.last.should =~ /eysd deploy/
96
+ @ssh_commands.last.should =~ /eysd.*deploy/
94
97
  @ssh_commands.last.should_not =~ /--migrate/
95
98
  end
96
99
  end
@@ -215,8 +218,10 @@ describe "ey deploy" do
215
218
  end
216
219
 
217
220
  it "requires that you specify a ref when specifying the application" do
218
- ey "deploy --app rails232app", :expect_failure => true
219
- @err.should match(/you must also specify the ref to deploy/)
221
+ Dir.chdir(File.expand_path("~")) do
222
+ ey "deploy --app rails232app", :expect_failure => true
223
+ @err.should match(/you must also specify the ref to deploy/)
224
+ end
220
225
  end
221
226
  end
222
227
 
@@ -226,7 +231,7 @@ describe "ey deploy" do
226
231
  before(:all) do
227
232
  api_scenario "one app, one environment", "user@git.host:path/to/repo.git"
228
233
  ey "deploy"
229
- @deploy_command = @ssh_commands.find {|c| c =~ /eysd deploy/ }
234
+ @deploy_command = @ssh_commands.find {|c| c =~ /eysd.*deploy/ }
230
235
  end
231
236
 
232
237
  it "passes along the repository URL to eysd" do
@@ -6,16 +6,18 @@ describe "ey rollback" do
6
6
  def command_to_run(opts)
7
7
  cmd = "rollback"
8
8
  cmd << " -e #{opts[:env]}" if opts[:env]
9
+ cmd << " -a #{opts[:app]}" if opts[:app]
9
10
  cmd
10
11
  end
11
12
 
12
13
  def verify_ran(scenario)
13
14
  @out.should match(/Rolling back #{scenario[:environment]}/)
14
15
  @err.should be_empty
15
- @ssh_commands.last.should match(/eysd deploy rollback --app #{scenario[:application]}/)
16
+ @ssh_commands.last.should match(/eysd.*deploy rollback.*--app #{scenario[:application]}/)
16
17
  end
17
18
 
18
19
  it_should_behave_like "it takes an environment name"
20
+ it_should_behave_like "it takes an app name"
19
21
  it_should_behave_like "it invokes eysd"
20
22
 
21
23
  it "passes along the web server stack to eysd" do
@@ -6,13 +6,15 @@ describe "ey web disable" do
6
6
  def command_to_run(opts)
7
7
  cmd = "web disable"
8
8
  cmd << " -e #{opts[:env]}" if opts[:env]
9
+ cmd << " -a #{opts[:app]}" if opts[:app]
9
10
  cmd
10
11
  end
11
12
 
12
13
  def verify_ran(scenario)
13
- @ssh_commands.should have_command_like(/eysd deploy enable_maintenance_page --app #{scenario[:application]}/)
14
+ @ssh_commands.should have_command_like(/eysd.*deploy enable_maintenance_page.*--app #{scenario[:application]}/)
14
15
  end
15
16
 
16
17
  it_should_behave_like "it takes an environment name"
18
+ it_should_behave_like "it takes an app name"
17
19
  it_should_behave_like "it invokes eysd"
18
20
  end
@@ -6,13 +6,15 @@ describe "ey web enable" do
6
6
  def command_to_run(opts)
7
7
  cmd = "web enable"
8
8
  cmd << " -e #{opts[:env]}" if opts[:env]
9
+ cmd << " -a #{opts[:app]}" if opts[:app]
9
10
  cmd
10
11
  end
11
12
 
12
13
  def verify_ran(scenario)
13
- @ssh_commands.should have_command_like(/eysd deploy disable_maintenance_page --app #{scenario[:application]}/)
14
+ @ssh_commands.should have_command_like(/eysd.*deploy disable_maintenance_page.*--app #{scenario[:application]}/)
14
15
  end
15
16
 
16
17
  it_should_behave_like "it takes an environment name"
18
+ it_should_behave_like "it takes an app name"
17
19
  it_should_behave_like "it invokes eysd"
18
20
  end
@@ -26,6 +26,8 @@ class FakeAwsm < Sinatra::Base
26
26
  Scenario::Empty
27
27
  when "one app, one environment, not linked"
28
28
  Scenario::UnlinkedApp
29
+ when "two apps"
30
+ Scenario::TwoApps
29
31
  when "one app, one environment"
30
32
  Scenario::LinkedApp
31
33
  when "one app, one environment, app master red"
@@ -194,6 +196,7 @@ private
194
196
  "public_hostname" => "ec2-184-73-116-228.compute-1.amazonaws.com",
195
197
  }]
196
198
  end
199
+ private :_instances
197
200
 
198
201
  def apps
199
202
  [{"name" => "rails232app",
@@ -326,6 +329,96 @@ private
326
329
  end
327
330
  end # OneAppTwoEnvs
328
331
 
332
+ class TwoApps < Empty
333
+ def railsapp_master
334
+ {
335
+ "status" => "running",
336
+ "name" => nil,
337
+ "role" => "solo",
338
+ "public_hostname" => "ec2-174-129-7-113.compute-1.amazonaws.com",
339
+ "id" => 35707,
340
+ "amazon_id" => "i-0911f063",
341
+ }
342
+ end
343
+ private :railsapp_master
344
+
345
+ def keycollector_master
346
+ {
347
+ "status" => "running",
348
+ "name" => nil,
349
+ "role" => "solo",
350
+ "public_hostname" => "ec2-174-129-198-124.compute-1.amazonaws.com",
351
+ "id" => 75428,
352
+ "amazon_id" => "i-051195b9",
353
+ }
354
+ end
355
+ private :keycollector_master
356
+
357
+ def apps
358
+ [{
359
+ "id" => 3202,
360
+ "name" => "keycollector",
361
+ "repository_uri" => "git@github.com:smerritt/keycollector.git",
362
+ "instances_count" => 0,
363
+ "ssh_username" => "deploy",
364
+ "environments" => [{
365
+ "apps" => [{
366
+ "name" => "keycollector",
367
+ "repository_uri" => "git@github.com:smerritt/keycollector.git",
368
+ "id" => 3202}],
369
+ "name" => "keycollector_production",
370
+ "app_master" => keycollector_master,
371
+ "instances" => [keycollector_master],
372
+ "id" => 4359,
373
+ "stack_name" => "nginx_mongrel"}],
374
+ }, {
375
+ "name" => "rails232app",
376
+ "repository_uri" => "git://github.com/smerritt/rails232app.git",
377
+ "id" => 6125,
378
+ "environments" => [{
379
+ "apps" => [{
380
+ "name" => "rails232app",
381
+ "repository_uri" => "git://github.com/smerritt/rails232app.git",
382
+ "id" => 6125}],
383
+ "instances_count" => 1,
384
+ "ssh_username" => "turkey",
385
+ "name" => "giblets",
386
+ "app_master" => railsapp_master,
387
+ "instances" => [railsapp_master],
388
+ "id" => 200,
389
+ "stack_name" => "nginx_unicorn"}],
390
+ }]
391
+ end
392
+
393
+ def environments
394
+ [{
395
+ "id" => 200,
396
+ "name" => "giblets",
397
+ "ssh_username" => "turkey",
398
+ "instances_count" => 1,
399
+ "instances" => [railsapp_master],
400
+ "app_master" => railsapp_master,
401
+ "stack_name" => "nginx_unicorn",
402
+ "apps" => [{
403
+ "name" => "rails232app",
404
+ "repository_uri" => "git://github.com/smerritt/rails232app.git",
405
+ "id" => 6125}],
406
+ }, {
407
+ "id" => 4359,
408
+ "name" => "keycollector_production",
409
+ "ssh_username" => "deploy",
410
+ "stack_name" => "nginx_mongrel",
411
+ "instances_count" => 1,
412
+ "instances" => [keycollector_master],
413
+ "app_master" => keycollector_master,
414
+ "apps" => [{
415
+ "name" => "keycollector",
416
+ "repository_uri" => "git@github.com:smerritt/keycollector.git",
417
+ "id" => 3202}],
418
+ }]
419
+ end
420
+ end # TwoApps
421
+
329
422
  class OneAppManySimilarlyNamedEnvs < Empty
330
423
  def apps
331
424
  apps = [{
@@ -72,6 +72,44 @@ shared_examples_for "it takes an environment name" do
72
72
  end
73
73
  end
74
74
 
75
+ shared_examples_for "it takes an app name" do
76
+ include Spec::Helpers::SharedIntegrationTestUtils
77
+
78
+ it "allows you to specify a valid app" do
79
+ api_scenario "one app, one environment"
80
+ Dir.chdir(Dir.tmpdir) do
81
+ run_ey({:env => 'giblets', :app => 'rails232app', :ref => 'master'}, {})
82
+ verify_ran(make_scenario({
83
+ :environment => 'giblets',
84
+ :application => 'rails232app',
85
+ :master_hostname => 'ec2-174-129-198-124.compute-1.amazonaws.com',
86
+ :ssh_username => 'turkey',
87
+ }))
88
+ end
89
+ end
90
+
91
+ it "can guess the environment from the app" do
92
+ api_scenario "two apps"
93
+ Dir.chdir(Dir.tmpdir) do
94
+ run_ey({:app => 'rails232app', :ref => 'master'}, {})
95
+ verify_ran(make_scenario({
96
+ :environment => 'giblets',
97
+ :application => 'rails232app',
98
+ :master_hostname => 'ec2-174-129-198-124.compute-1.amazonaws.com',
99
+ :ssh_username => 'turkey',
100
+ }))
101
+ end
102
+ end
103
+
104
+ it "complains when you specify a nonexistant app" do
105
+ api_scenario "one app, one environment"
106
+ run_ey({:env => 'giblets', :app => 'P-time-SAT-solver', :ref => 'master'},
107
+ {:expect_failure => true})
108
+ @err.should =~ /no app.*P-time-SAT-solver/i
109
+ end
110
+
111
+ end
112
+
75
113
  shared_examples_for "it invokes eysd" do
76
114
  include Spec::Helpers::SharedIntegrationTestUtils
77
115
 
@@ -95,7 +133,7 @@ shared_examples_for "it invokes eysd" do
95
133
  @ssh_commands.last.should match(/--instances (#{instance_args.join('|')})/)
96
134
  end
97
135
 
98
- context "eysd install" do
136
+ context "eysd installation" do
99
137
  before(:all) do
100
138
  api_scenario "one app, one environment"
101
139
  end
@@ -109,7 +147,7 @@ shared_examples_for "it invokes eysd" do
109
147
  end
110
148
 
111
149
  def exiting_ssh(exit_code)
112
- "#!/usr/bin/env ruby\n exit!(#{exit_code}) if ARGV.to_s =~ /Base64.decode64/"
150
+ "#!/usr/bin/env ruby\n exit!(#{exit_code}) if ARGV.to_s =~ /gem list ey-deploy/"
113
151
  end
114
152
 
115
153
  it "raises an error if SSH fails" do
@@ -119,7 +157,7 @@ shared_examples_for "it invokes eysd" do
119
157
  end
120
158
 
121
159
  it "installs ey-deploy if it's missing" do
122
- run_ey({:env => 'giblets'}, {:prepend_to_path => {'ssh' => exiting_ssh(104)}})
160
+ run_ey({:env => 'giblets'}, {:prepend_to_path => {'ssh' => exiting_ssh(1)}})
123
161
 
124
162
  gem_install_command = @ssh_commands.find do |command|
125
163
  command =~ /gem install ey-deploy/
@@ -128,25 +166,11 @@ shared_examples_for "it invokes eysd" do
128
166
  gem_install_command.should =~ %r{/usr/local/ey_resin/ruby/bin/gem install.*ey-deploy}
129
167
  end
130
168
 
131
- it "upgrades ey-deploy if it's too old" do
132
- run_ey({:env => 'giblets'}, {:prepend_to_path => {'ssh' => exiting_ssh(70)}})
133
- @ssh_commands.should have_command_like(/gem uninstall -a -x ey-deploy/)
134
- @ssh_commands.should have_command_like(/gem install ey-deploy/)
135
- end
136
-
137
- it "raises an error if ey-deploy is too new" do
138
- run_ey({:env => 'giblets'},
139
- {:prepend_to_path => {'ssh' => exiting_ssh(17)}, :expect_failure => true})
140
- @ssh_commands.should_not have_command_like(/gem install ey-deploy/)
141
- @ssh_commands.should_not have_command_like(/eysd deploy/)
142
- @err.should match(/too new/i)
143
- end
144
-
145
- it "does not change ey-deploy if its version is satisfactory" do
169
+ it "does not try to install ey-deploy if it's already there" do
146
170
  run_ey({:env => 'giblets'}, {:prepend_to_path => {'ssh' => exiting_ssh(0)}})
147
171
  @ssh_commands.should_not have_command_like(/gem install ey-deploy/)
148
- @ssh_commands.should_not have_command_like(/gem uninstall.* ey-deploy/)
149
- @ssh_commands.should have_command_like(/eysd deploy/)
172
+ ver = Regexp.quote(EY::Model::Instance::EYSD_VERSION)
173
+ @ssh_commands.should have_command_like(/eysd _#{ver}_ deploy/)
150
174
  end
151
175
  end
152
176
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 5
8
- - 5
9
- version: 0.5.5
7
+ - 7
8
+ - 0
9
+ version: 0.7.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - EY Cloud Team
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-06-23 00:00:00 -07:00
17
+ date: 2010-06-25 00:00:00 -07:00
18
18
  default_executable: ey
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -196,7 +196,6 @@ test_files:
196
196
  - spec/engineyard/config_spec.rb
197
197
  - spec/engineyard/model/api_struct_spec.rb
198
198
  - spec/engineyard/model/environment_spec.rb
199
- - spec/engineyard/model/instance_spec.rb
200
199
  - spec/engineyard/repo_spec.rb
201
200
  - spec/engineyard_spec.rb
202
201
  - spec/ey/deploy_spec.rb
@@ -1,70 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "EY::Model::Instance's script for checking ey-deploy's version" do
4
-
5
- def fake_out_no_ey_deploy
6
- Gem.should_receive(:source_index).and_return(Gem::SourceIndex.new)
7
- end
8
-
9
- def fake_out_installed_ey_deploy_version(version)
10
- net_sftp_gem = Gem::Specification.new do |s|
11
- s.authors = ["Jamis Buck"]
12
- s.autorequire = "net/sftp"
13
- s.date = Time.utc(2008, 2, 24)
14
- s.email = "jamis@jamisbuck.org"
15
- s.files = ["doc/faq",
16
- # snip
17
- "test/protocol/tc_driver.rb"]
18
- s.homepage = "http://net-ssh.rubyforge.org/sftp"
19
- s.name = "net-sftp"
20
- s.require_paths = ["lib"]
21
- s.rubygems_version = "1.3.5"
22
- s.specification_version = 2
23
- s.summary = "Net::SFTP is a pure-Ruby implementation of the SFTP client protocol."
24
- s.test_files = ["test/ALL-TESTS.rb"]
25
- s.version = Gem::Version.new("1.1.1")
26
- end
27
-
28
- ey_deploy_gem = Gem::Specification.new do |s|
29
- s.name = 'ey-deploy'
30
- s.authors = ["EY Cloud Team"]
31
- s.date = Time.utc(2010, 1, 2)
32
- s.files = ['lib/engineyard/ey-deploy.rb'] # or something
33
- s.specification_version = 2
34
- s.version = Gem::Version.new(version)
35
- end
36
-
37
- fake_source_index = Gem::SourceIndex.new(
38
- 'net-sftp-1.1.1' => net_sftp_gem,
39
- "ey-deploy-#{version}" => ey_deploy_gem
40
- )
41
- Gem.should_receive(:source_index).and_return(fake_source_index)
42
- end
43
-
44
- def script_exit_status
45
- eval EY::Model::Instance::CHECK_SCRIPT
46
- rescue SystemExit => e
47
- return e.status
48
- end
49
-
50
- it "exits 104 if the ey-deploy gem is not installed" do
51
- fake_out_no_ey_deploy
52
- script_exit_status.should == 104
53
- end
54
-
55
- it "exits 70 if the installed ey-deploy is too old" do
56
- fake_out_installed_ey_deploy_version('0.0.1')
57
- script_exit_status.should == 70
58
- end
59
-
60
- it "exits 17 if the installed ey-deploy is too new" do
61
- fake_out_installed_ey_deploy_version('1000.0.0')
62
- script_exit_status.should == 17
63
- end
64
-
65
- it "exits 0 if the version number is correct" do
66
- correct_version = EY::Model::Instance::EYSD_VERSION.gsub(/[^\d\.]/, '')
67
- fake_out_installed_ey_deploy_version(correct_version)
68
- script_exit_status.should == 0
69
- end
70
- end