engineyard 1.2.2 → 1.2.3
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.
- data/lib/engineyard/api.rb +5 -1
- data/lib/engineyard/cli.rb +6 -0
- data/lib/engineyard/thor.rb +1 -5
- data/lib/engineyard/version.rb +1 -1
- data/spec/ey/list_environments_spec.rb +8 -2
- data/spec/support/shared_behavior.rb +5 -1
- metadata +42 -47
- data/lib/engineyard/model/#api_struct.rb# +0 -31
- data/spec/engineyard/#resolver_spec.rb# +0 -41
- data/spec/support/#shared_behavior.rb# +0 -275
data/lib/engineyard/api.rb
CHANGED
@@ -30,8 +30,12 @@ module EY
|
|
30
30
|
@apps ||= EY::Model::App.from_array(request('/apps')["apps"], :api => self)
|
31
31
|
end
|
32
32
|
|
33
|
+
def apps_for_repo(repo)
|
34
|
+
apps.find_all {|a| repo.urls.include?(a.repository_uri) }
|
35
|
+
end
|
36
|
+
|
33
37
|
def app_for_repo(repo)
|
34
|
-
candidates =
|
38
|
+
candidates = apps_for_repo(repo)
|
35
39
|
if candidates.size > 1
|
36
40
|
raise EY::AmbiguousGitUriError.new(repo.urls, candidates.map{|x| x.name})
|
37
41
|
end
|
data/lib/engineyard/cli.rb
CHANGED
@@ -102,6 +102,12 @@ module EY
|
|
102
102
|
end
|
103
103
|
else
|
104
104
|
apps = get_apps(options[:all])
|
105
|
+
if !options[:all] && apps.size > 1
|
106
|
+
message = "This git repo matches multiple Applications in AppCloud:\n"
|
107
|
+
apps.each { |app| message << "\t#{app.name}\n" }
|
108
|
+
message << "The following environments contain those applications:\n\n"
|
109
|
+
EY.ui.warn(message)
|
110
|
+
end
|
105
111
|
EY.ui.warn(NoAppError.new(repo).message) unless apps.any? || options[:all]
|
106
112
|
EY.ui.print_envs(apps, EY.config.default_environment, options[:simple])
|
107
113
|
end
|
data/lib/engineyard/thor.rb
CHANGED
data/lib/engineyard/version.rb
CHANGED
@@ -42,6 +42,12 @@ end
|
|
42
42
|
|
43
43
|
describe "ey environments with an ambiguous git repo" do
|
44
44
|
given "integration"
|
45
|
-
|
46
|
-
|
45
|
+
it_should_behave_like "it has an ambiguous git repo"
|
46
|
+
|
47
|
+
it "lists environments from all apps using the git repo" do
|
48
|
+
ey "environments"
|
49
|
+
@out.should =~ /git repo matches multiple/i
|
50
|
+
@out.should include("giblets")
|
51
|
+
@out.should include("keycollector_production")
|
52
|
+
end
|
47
53
|
end
|
@@ -22,7 +22,7 @@ module Spec
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
shared_examples_for "it
|
25
|
+
shared_examples_for "it has an ambiguous git repo" do
|
26
26
|
include Spec::Helpers::SharedIntegrationTestUtils
|
27
27
|
|
28
28
|
define_git_repo('dup test') do
|
@@ -34,6 +34,10 @@ shared_examples_for "it requires an unambiguous git repo" do
|
|
34
34
|
before(:all) do
|
35
35
|
api_scenario "two apps, same git uri"
|
36
36
|
end
|
37
|
+
end
|
38
|
+
|
39
|
+
shared_examples_for "it requires an unambiguous git repo" do
|
40
|
+
it_should_behave_like "it has an ambiguous git repo"
|
37
41
|
|
38
42
|
it "lists disambiguating environments to choose from" do
|
39
43
|
run_ey({}, {:expect_failure => true})
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 3
|
10
|
+
version: 1.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- EY Cloud Team
|
@@ -19,96 +19,96 @@ date: 2010-08-31 00:00:00 -07:00
|
|
19
19
|
default_executable: ey
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
22
23
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
23
24
|
none: false
|
24
25
|
requirements:
|
25
26
|
- - ~>
|
26
27
|
- !ruby/object:Gem::Version
|
27
|
-
hash:
|
28
|
+
hash: 7
|
28
29
|
segments:
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
32
|
-
version:
|
30
|
+
- 1
|
31
|
+
- 5
|
32
|
+
- 2
|
33
|
+
version: 1.5.2
|
33
34
|
requirement: *id001
|
34
35
|
type: :runtime
|
35
|
-
name:
|
36
|
-
prerelease: false
|
36
|
+
name: highline
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
|
+
prerelease: false
|
38
39
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
40
|
none: false
|
40
41
|
requirements:
|
41
42
|
- - ~>
|
42
43
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
44
|
+
hash: 39
|
44
45
|
segments:
|
45
|
-
-
|
46
|
-
-
|
47
|
-
|
46
|
+
- 0
|
47
|
+
- 14
|
48
|
+
- 0
|
49
|
+
version: 0.14.0
|
48
50
|
requirement: *id002
|
49
51
|
type: :runtime
|
50
|
-
name:
|
51
|
-
prerelease: false
|
52
|
+
name: thor
|
52
53
|
- !ruby/object:Gem::Dependency
|
54
|
+
prerelease: false
|
53
55
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
56
|
none: false
|
55
57
|
requirements:
|
56
|
-
- -
|
58
|
+
- - ">="
|
57
59
|
- !ruby/object:Gem::Version
|
58
|
-
hash:
|
60
|
+
hash: 3
|
59
61
|
segments:
|
60
|
-
-
|
61
|
-
|
62
|
-
- 2
|
63
|
-
version: 1.5.2
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
64
|
requirement: *id003
|
65
65
|
type: :runtime
|
66
|
-
name:
|
67
|
-
prerelease: false
|
66
|
+
name: ruby-termios
|
68
67
|
- !ruby/object:Gem::Dependency
|
68
|
+
prerelease: false
|
69
69
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
70
70
|
none: false
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ~>
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
hash:
|
74
|
+
hash: 23
|
75
75
|
segments:
|
76
76
|
- 0
|
77
|
-
|
77
|
+
- 0
|
78
|
+
- 4
|
79
|
+
version: 0.0.4
|
78
80
|
requirement: *id004
|
79
81
|
type: :runtime
|
80
|
-
name:
|
81
|
-
prerelease: false
|
82
|
+
name: escape
|
82
83
|
- !ruby/object:Gem::Dependency
|
84
|
+
prerelease: false
|
83
85
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
84
86
|
none: false
|
85
87
|
requirements:
|
86
|
-
- -
|
88
|
+
- - ~>
|
87
89
|
- !ruby/object:Gem::Version
|
88
|
-
hash:
|
90
|
+
hash: 7
|
89
91
|
segments:
|
90
|
-
-
|
91
|
-
|
92
|
+
- 1
|
93
|
+
- 4
|
94
|
+
version: "1.4"
|
92
95
|
requirement: *id005
|
93
96
|
type: :runtime
|
94
|
-
name:
|
95
|
-
prerelease: false
|
97
|
+
name: rest-client
|
96
98
|
- !ruby/object:Gem::Dependency
|
99
|
+
prerelease: false
|
97
100
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
98
101
|
none: false
|
99
102
|
requirements:
|
100
|
-
- -
|
103
|
+
- - ">="
|
101
104
|
- !ruby/object:Gem::Version
|
102
|
-
hash:
|
105
|
+
hash: 3
|
103
106
|
segments:
|
104
107
|
- 0
|
105
|
-
|
106
|
-
- 4
|
107
|
-
version: 0.0.4
|
108
|
+
version: "0"
|
108
109
|
requirement: *id006
|
109
110
|
type: :runtime
|
110
|
-
name:
|
111
|
-
prerelease: false
|
111
|
+
name: json_pure
|
112
112
|
description: This gem allows you to deploy your rails application to the Engine Yard cloud directly from the command line.
|
113
113
|
email: cloud@engineyard.com
|
114
114
|
executables:
|
@@ -131,7 +131,6 @@ files:
|
|
131
131
|
- lib/engineyard/collection.rb
|
132
132
|
- lib/engineyard/config.rb
|
133
133
|
- lib/engineyard/error.rb
|
134
|
-
- lib/engineyard/model/#api_struct.rb#
|
135
134
|
- lib/engineyard/model/api_struct.rb
|
136
135
|
- lib/engineyard/model/app.rb
|
137
136
|
- lib/engineyard/model/environment.rb
|
@@ -146,7 +145,6 @@ files:
|
|
146
145
|
- lib/engineyard.rb
|
147
146
|
- LICENSE
|
148
147
|
- README.rdoc
|
149
|
-
- spec/engineyard/#resolver_spec.rb#
|
150
148
|
- spec/engineyard/api_spec.rb
|
151
149
|
- spec/engineyard/cli/api_spec.rb
|
152
150
|
- spec/engineyard/cli_spec.rb
|
@@ -171,7 +169,6 @@ files:
|
|
171
169
|
- spec/ey/web/disable_spec.rb
|
172
170
|
- spec/ey/web/enable_spec.rb
|
173
171
|
- spec/spec_helper.rb
|
174
|
-
- spec/support/#shared_behavior.rb#
|
175
172
|
- spec/support/bundled_ey
|
176
173
|
- spec/support/fake_awsm.ru
|
177
174
|
- spec/support/git_repo.rb
|
@@ -213,7 +210,6 @@ signing_key:
|
|
213
210
|
specification_version: 3
|
214
211
|
summary: Command-line deployment for the Engine Yard cloud
|
215
212
|
test_files:
|
216
|
-
- spec/engineyard/#resolver_spec.rb#
|
217
213
|
- spec/engineyard/api_spec.rb
|
218
214
|
- spec/engineyard/cli/api_spec.rb
|
219
215
|
- spec/engineyard/cli_spec.rb
|
@@ -238,7 +234,6 @@ test_files:
|
|
238
234
|
- spec/ey/web/disable_spec.rb
|
239
235
|
- spec/ey/web/enable_spec.rb
|
240
236
|
- spec/spec_helper.rb
|
241
|
-
- spec/support/#shared_behavior.rb#
|
242
237
|
- spec/support/bundled_ey
|
243
238
|
- spec/support/fake_awsm.ru
|
244
239
|
- spec/support/git_repo.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
module EY
|
2
|
-
module Model
|
3
|
-
class ApiStruct < Struct
|
4
|
-
|
5
|
-
def self.new(*args, &block)
|
6
|
-
super(*args) do |*block_args|
|
7
|
-
block.call(*block_args) if block
|
8
|
-
|
9
|
-
def self.from_array(array, common_values = {})
|
10
|
-
array.map do |values|
|
11
|
-
from_hash(values.merge(common_values))
|
12
|
-
end if array
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.from_hash(hash)
|
16
|
-
return nil unless hash
|
17
|
-
members = new.members
|
18
|
-
values = members.map{|a| hash.has_key?(a.to_sym) ? hash[a.to_sym] : hash[a] }
|
19
|
-
new(*values)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def api_get(uri, options = {})
|
26
|
-
api.request(uri, options.merge(:method => :get))
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'engineyard/cli'
|
3
|
-
|
4
|
-
describe EY::Resolver do
|
5
|
-
|
6
|
-
let(:repo) { 'git://engineyard/ey-cloud.git' }
|
7
|
-
|
8
|
-
let(:ey) do
|
9
|
-
EY::Deployment.new(:account => 'ey',
|
10
|
-
:repo => repo,
|
11
|
-
:app => 'ey-cloud',
|
12
|
-
:environment => 'production')
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:me) do
|
16
|
-
EY::Deployment.new(:account => 'me',
|
17
|
-
:repo => repo,
|
18
|
-
:app => 'my-app',
|
19
|
-
:environment => 'production')
|
20
|
-
end
|
21
|
-
|
22
|
-
context "ambiguous account" do
|
23
|
-
it do
|
24
|
-
resolver = EY::Resolver.new([one, two], :repo => repo)
|
25
|
-
resolver.resolve.should be_nil
|
26
|
-
resolver.optoins.should == []
|
27
|
-
end
|
28
|
-
|
29
|
-
it do
|
30
|
-
EY::Resolver.new([one, two], :repo => repo, :account => 'me').resolve.should == me
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
deployments = EY::Deployment::Collection.new(get_deployments)
|
38
|
-
matched_deps = deployments.resolve(params)
|
39
|
-
|
40
|
-
matched_deps.message.should == "no matches"
|
41
|
-
|
@@ -1,275 +0,0 @@
|
|
1
|
-
module Spec
|
2
|
-
module Helpers
|
3
|
-
module SharedIntegrationTestUtils
|
4
|
-
|
5
|
-
def run_ey(command_options, ey_options={})
|
6
|
-
if respond_to?(:extra_ey_options) # needed for ssh tests
|
7
|
-
ey_options.merge!(extra_ey_options)
|
8
|
-
end
|
9
|
-
|
10
|
-
ey(command_to_run(command_options), ey_options)
|
11
|
-
end
|
12
|
-
|
13
|
-
def make_scenario(hash)
|
14
|
-
# since nil will silently turn to empty string when interpolated,
|
15
|
-
# and there's a lot of string matching involved in integration
|
16
|
-
# testing, it would be nice to have early notification of typos.
|
17
|
-
scenario = Hash.new { |h,k| raise "Tried to get key #{k.inspect}, but it's missing!" }
|
18
|
-
scenario.merge!(hash)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
shared_examples_for "it requires an unambiguous git repo" do
|
26
|
-
include Spec::Helpers::SharedIntegrationTestUtils
|
27
|
-
|
28
|
-
define_git_repo("dup test") do
|
29
|
-
system("git remote add dup git://github.com/engineyard/dup.git")
|
30
|
-
end
|
31
|
-
|
32
|
-
use_git_repo("dup test")
|
33
|
-
|
34
|
-
before(:all) do
|
35
|
-
api_scenario "two apps, same git uri"
|
36
|
-
end
|
37
|
-
|
38
|
-
it "lists disambiguating environments to choose from" do
|
39
|
-
run_ey({}, {:expect_failure => true})
|
40
|
-
@err.should =~ /ambiguous/
|
41
|
-
@err.should =~ /specify one of the following environments/
|
42
|
-
@err.should =~ /giblets/
|
43
|
-
@err.should =~ /keycollector_production/
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
shared_examples_for "it takes an environment name" do
|
48
|
-
include Spec::Helpers::SharedIntegrationTestUtils
|
49
|
-
|
50
|
-
it "operates on the current environment by default" do
|
51
|
-
api_scenario "one app, one environment"
|
52
|
-
run_ey({:env => nil}, {:debug => true})
|
53
|
-
verify_ran(make_scenario({
|
54
|
-
:environment => 'giblets',
|
55
|
-
:application => 'rails232app',
|
56
|
-
:master_hostname => 'app_master_hostname.compute-1.amazonaws.com',
|
57
|
-
:ssh_username => 'turkey',
|
58
|
-
}))
|
59
|
-
end
|
60
|
-
|
61
|
-
it "complains when you specify a nonexistent environment" do
|
62
|
-
api_scenario "one app, one environment"
|
63
|
-
run_ey({:env => 'typo-happens-here'}, {:expect_failure => true})
|
64
|
-
@err.should match(/no environment named 'typo-happens-here'/i)
|
65
|
-
end
|
66
|
-
|
67
|
-
context "given a piece of the environment name" do
|
68
|
-
before(:all) do
|
69
|
-
api_scenario "one app, many similarly-named environments"
|
70
|
-
end
|
71
|
-
|
72
|
-
it "complains when the substring is ambiguous" do
|
73
|
-
run_ey({:env => 'staging'}, {:expect_failure => true})
|
74
|
-
@err.should match(/'staging' is ambiguous/)
|
75
|
-
end
|
76
|
-
|
77
|
-
it "works when the substring is unambiguous" do
|
78
|
-
api_scenario "one app, many similarly-named environments"
|
79
|
-
run_ey({:env => 'prod'}, {:debug => true})
|
80
|
-
verify_ran(make_scenario({
|
81
|
-
:environment => 'railsapp_production',
|
82
|
-
:application => 'rails232app',
|
83
|
-
:master_hostname => 'app_master_hostname.compute-1.amazonaws.com',
|
84
|
-
:ssh_username => 'turkey',
|
85
|
-
}))
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
it "complains when it can't guess the environment and its name isn't specified" do
|
90
|
-
api_scenario "one app, one environment, not linked"
|
91
|
-
run_ey({:env => nil}, {:expect_failure => true})
|
92
|
-
@err.should =~ /single environment/i
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
shared_examples_for "it takes an app name" do
|
97
|
-
include Spec::Helpers::SharedIntegrationTestUtils
|
98
|
-
|
99
|
-
it "allows you to specify a valid app" do
|
100
|
-
api_scenario "one app, one environment"
|
101
|
-
Dir.chdir(Dir.tmpdir) do
|
102
|
-
run_ey({:env => 'giblets', :app => 'rails232app', :ref => 'master'}, {})
|
103
|
-
verify_ran(make_scenario({
|
104
|
-
:environment => 'giblets',
|
105
|
-
:application => 'rails232app',
|
106
|
-
:master_hostname => 'app_master_hostname.compute-1.amazonaws.com',
|
107
|
-
:ssh_username => 'turkey',
|
108
|
-
}))
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
it "can guess the environment from the app" do
|
113
|
-
api_scenario "two apps"
|
114
|
-
Dir.chdir(Dir.tmpdir) do
|
115
|
-
run_ey({:app => 'rails232app', :ref => 'master'}, {})
|
116
|
-
verify_ran(make_scenario({
|
117
|
-
:environment => 'giblets',
|
118
|
-
:application => 'rails232app',
|
119
|
-
:master_hostname => 'app_master_hostname.compute-1.amazonaws.com',
|
120
|
-
:ssh_username => 'turkey',
|
121
|
-
}))
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
it "complains when you specify a nonexistant app" do
|
126
|
-
api_scenario "one app, one environment"
|
127
|
-
run_ey({:env => 'giblets', :app => 'P-time-SAT-solver', :ref => 'master'},
|
128
|
-
{:expect_failure => true})
|
129
|
-
@err.should =~ /no app.*P-time-SAT-solver/i
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
133
|
-
|
134
|
-
shared_examples_for "it invokes engineyard-serverside" do
|
135
|
-
include Spec::Helpers::SharedIntegrationTestUtils
|
136
|
-
|
137
|
-
context "with arguments" do
|
138
|
-
before(:all) do
|
139
|
-
api_scenario "one app, one environment"
|
140
|
-
run_ey({:env => 'giblets', :verbose => true})
|
141
|
-
end
|
142
|
-
|
143
|
-
it "passes --verbose to engineyard-serverside" do
|
144
|
-
@ssh_commands.should have_command_like(/engineyard-serverside.*deploy.*--verbose/)
|
145
|
-
end
|
146
|
-
|
147
|
-
it "passes along instance information to engineyard-serverside" do
|
148
|
-
instance_args = [
|
149
|
-
Regexp.quote("app_master_hostname.compute-1.amazonaws.com,app_master"),
|
150
|
-
Regexp.quote("app_hostname.compute-1.amazonaws.com,app"),
|
151
|
-
Regexp.quote("util_fluffy_hostname.compute-1.amazonaws.com,util,fluffy"),
|
152
|
-
]
|
153
|
-
|
154
|
-
db_instance = Regexp.quote("db_master_hostname.compute-1.amazonaws.com,db_master")
|
155
|
-
|
156
|
-
# apps + utilities are all mentioned
|
157
|
-
instance_args.each do |i|
|
158
|
-
@ssh_commands.last.should =~ /#{i}/
|
159
|
-
end
|
160
|
-
|
161
|
-
# but not database instances
|
162
|
-
@ssh_commands.last.should_not =~ /#{db_instance}/
|
163
|
-
|
164
|
-
# and it's all after the option '--instances'
|
165
|
-
@ssh_commands.last.should match(/--instances (#{instance_args.join('|')})/)
|
166
|
-
end
|
167
|
-
|
168
|
-
it "passes the framework environment" do
|
169
|
-
@ssh_commands.last.should match(/--framework-env production/)
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
|
175
|
-
context "engineyard-serverside installation" do
|
176
|
-
before(:all) do
|
177
|
-
api_scenario "one app, one environment"
|
178
|
-
end
|
179
|
-
|
180
|
-
before(:each) do
|
181
|
-
ENV.delete "NO_SSH"
|
182
|
-
end
|
183
|
-
|
184
|
-
after(:each) do
|
185
|
-
ENV['NO_SSH'] = "true"
|
186
|
-
end
|
187
|
-
|
188
|
-
def exiting_ssh(exit_code)
|
189
|
-
"#!/usr/bin/env ruby\n exit!(#{exit_code}) if ARGV.to_s =~ /gem list engineyard-serverside/"
|
190
|
-
end
|
191
|
-
|
192
|
-
it "raises an error if SSH fails" do
|
193
|
-
run_ey({:env => 'giblets'},
|
194
|
-
{:prepend_to_path => {'ssh' => exiting_ssh(255)}, :expect_failure => true})
|
195
|
-
@err.should =~ /SSH connection to \S+ failed/
|
196
|
-
end
|
197
|
-
|
198
|
-
it "installs engineyard-serverside if it's missing" do
|
199
|
-
run_ey({:env => 'giblets'}, {:prepend_to_path => {'ssh' => exiting_ssh(1)}})
|
200
|
-
|
201
|
-
gem_install_command = @ssh_commands.find do |command|
|
202
|
-
command =~ /gem install engineyard-serverside/
|
203
|
-
end
|
204
|
-
gem_install_command.should_not be_nil
|
205
|
-
gem_install_command.should =~ %r{/usr/local/ey_resin/ruby/bin/gem install.*engineyard-serverside}
|
206
|
-
end
|
207
|
-
|
208
|
-
it "does not try to install engineyard-serverside if it's already there" do
|
209
|
-
run_ey({:env => 'giblets'}, {:prepend_to_path => {'ssh' => exiting_ssh(0)}})
|
210
|
-
@ssh_commands.should_not have_command_like(/gem install engineyard-serverside/)
|
211
|
-
ver = Regexp.quote(EY::ENGINEYARD_SERVERSIDE_VERSION)
|
212
|
-
@ssh_commands.should have_command_like(/engineyard-serverside _#{ver}_ deploy/)
|
213
|
-
end
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
shared_examples_for "model collections" do
|
218
|
-
describe "#match_one" do
|
219
|
-
it "works when given an unambiguous substring" do
|
220
|
-
@collection.match_one("prod").name.should == "app_production"
|
221
|
-
end
|
222
|
-
|
223
|
-
it "raises an error when given an ambiguous substring" do
|
224
|
-
lambda {
|
225
|
-
@collection.match_one("staging")
|
226
|
-
}.should raise_error(@collection_class.ambiguous_error)
|
227
|
-
end
|
228
|
-
|
229
|
-
it "returns an exact match if one exists" do
|
230
|
-
@collection.match_one("app_staging").name.should == "app_staging"
|
231
|
-
end
|
232
|
-
|
233
|
-
it "returns nil when it can't find anything" do
|
234
|
-
@collection.match_one("dev-and-production").should be_nil
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
describe "#match_one!" do
|
239
|
-
it "works when given an unambiguous substring" do
|
240
|
-
@collection.match_one!("prod").name.should == "app_production"
|
241
|
-
end
|
242
|
-
|
243
|
-
it "raises an error when given an ambiguous substring" do
|
244
|
-
lambda {
|
245
|
-
@collection.match_one!("staging")
|
246
|
-
}.should raise_error(@collection_class.ambiguous_error)
|
247
|
-
end
|
248
|
-
|
249
|
-
it "returns an exact match if one exists" do
|
250
|
-
@collection.match_one!("app_staging").name.should == "app_staging"
|
251
|
-
end
|
252
|
-
|
253
|
-
it "raises an error when given an ambiguous exact string" do
|
254
|
-
lambda {
|
255
|
-
@collection.match_one!("app_duplicate")
|
256
|
-
}.should raise_error(@collection_class.ambiguous_error)
|
257
|
-
end
|
258
|
-
|
259
|
-
it "raises an error when it can't find anything" do
|
260
|
-
lambda {
|
261
|
-
@collection.match_one!("dev-and-production")
|
262
|
-
}.should raise_error(@collection_class.invalid_error)
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
describe "#named" do
|
267
|
-
it "finds matching by name" do
|
268
|
-
@collection.named("app_staging").name.should == "app_staging"
|
269
|
-
end
|
270
|
-
|
271
|
-
it "returns nil when no name matches" do
|
272
|
-
@collection.named("something else").should be_nil
|
273
|
-
end
|
274
|
-
end
|
275
|
-
end
|