engineyard 1.4.14 → 1.4.15
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 +1 -1
- data/lib/engineyard/cli.rb +8 -7
- data/lib/engineyard/cli/api.rb +3 -0
- data/lib/engineyard/cli/recipes.rb +1 -1
- data/lib/engineyard/model/environment.rb +12 -4
- data/lib/engineyard/model/instance.rb +1 -1
- data/lib/engineyard/version.rb +1 -1
- data/spec/engineyard/api_spec.rb +1 -1
- data/spec/engineyard/cli/api_spec.rb +6 -0
- data/spec/ey/deploy_spec.rb +7 -2
- metadata +4 -4
data/lib/engineyard/api.rb
CHANGED
@@ -82,7 +82,7 @@ module EY
|
|
82
82
|
rescue RestClient::ResourceNotFound
|
83
83
|
raise ResourceNotFound, "The requested resource could not be found"
|
84
84
|
rescue RestClient::BadGateway
|
85
|
-
raise RequestFailed, "
|
85
|
+
raise RequestFailed, "EY Cloud API is temporarily unavailable. Please try again soon."
|
86
86
|
rescue RestClient::RequestFailed => e
|
87
87
|
raise RequestFailed, "#{e.message} #{e.response}"
|
88
88
|
rescue OpenSSL::SSL::SSLError
|
data/lib/engineyard/cli.rb
CHANGED
@@ -30,8 +30,9 @@ module EY
|
|
30
30
|
command can be specified via --migrate "ruby do_migrations.rb". Migrations
|
31
31
|
can also be skipped entirely by using --no-migrate.
|
32
32
|
DESC
|
33
|
-
method_option :
|
34
|
-
:
|
33
|
+
method_option :force_ref, :type => :string, :aliases => %w(--ignore-default-branch -R),
|
34
|
+
:lazy_default => true,
|
35
|
+
:desc => "Force a deploy of the specified git ref even if a default is set in ey.yml."
|
35
36
|
method_option :ignore_bad_master, :type => :boolean,
|
36
37
|
:desc => "Force a deploy even if the master is in a bad state"
|
37
38
|
method_option :migrate, :type => :string, :aliases => %w(-m),
|
@@ -40,7 +41,7 @@ module EY
|
|
40
41
|
method_option :environment, :type => :string, :aliases => %w(-e),
|
41
42
|
:desc => "Environment in which to deploy this application"
|
42
43
|
method_option :ref, :type => :string, :aliases => %w(-r --branch --tag),
|
43
|
-
:desc => "Git ref to deploy. May be a branch, a tag, or a SHA."
|
44
|
+
:desc => "Git ref to deploy. May be a branch, a tag, or a SHA. Use -R to deploy a different ref if a default is set."
|
44
45
|
method_option :app, :type => :string, :aliases => %w(-a),
|
45
46
|
:desc => "Name of the application to deploy"
|
46
47
|
method_option :account, :type => :string, :aliases => %w(-c),
|
@@ -55,10 +56,10 @@ module EY
|
|
55
56
|
app, environment = fetch_app_and_environment(options[:app], options[:environment], options[:account])
|
56
57
|
environment.ignore_bad_master = options[:ignore_bad_master]
|
57
58
|
deploy_ref = if options[:app]
|
58
|
-
environment.resolve_branch(options[:ref], options[:
|
59
|
+
environment.resolve_branch(options[:ref], options[:force_ref]) ||
|
59
60
|
raise(EY::Error, "When specifying the application, you must also specify the ref to deploy\nUsage: ey deploy --app <app name> --ref <branch|tag|ref>")
|
60
61
|
else
|
61
|
-
environment.resolve_branch(options[:ref], options[:
|
62
|
+
environment.resolve_branch(options[:ref], options[:force_ref]) ||
|
62
63
|
repo.current_branch ||
|
63
64
|
raise(DeployArgumentError)
|
64
65
|
end
|
@@ -124,7 +125,7 @@ module EY
|
|
124
125
|
apps = api.apps_for_repo(repo)
|
125
126
|
|
126
127
|
if apps.size > 1
|
127
|
-
message = "This git repo matches multiple Applications in
|
128
|
+
message = "This git repo matches multiple Applications in EY Cloud:\n"
|
128
129
|
apps.each { |app| message << "\t#{app.name}\n" }
|
129
130
|
message << "The following environments contain those applications:\n\n"
|
130
131
|
EY.ui.warn(message)
|
@@ -342,7 +343,7 @@ module EY
|
|
342
343
|
|
343
344
|
desc "launch [--environment ENVIRONMENT] [--account ACCOUNT]", "Open application in browser."
|
344
345
|
method_option :environment, :type => :string, :aliases => %w(-e),
|
345
|
-
:desc => "
|
346
|
+
:desc => "Name of the environment"
|
346
347
|
method_option :account, :type => :string, :aliases => %w(-c),
|
347
348
|
:desc => "Name of the account in which the environment can be found"
|
348
349
|
def launch
|
data/lib/engineyard/cli/api.rb
CHANGED
@@ -7,6 +7,9 @@ module EY
|
|
7
7
|
|
8
8
|
def initialize(token = nil)
|
9
9
|
@token = token
|
10
|
+
if ENV['ENGINEYARD_API_TOKEN']
|
11
|
+
@token = ENV['ENGINEYARD_API_TOKEN']
|
12
|
+
end
|
10
13
|
@token ||= EY::EYRC.load.api_token
|
11
14
|
@token ||= self.class.fetch_token
|
12
15
|
raise EY::Error, "Sorry, we couldn't get your API token." unless @token
|
@@ -24,7 +24,7 @@ module EY
|
|
24
24
|
"Upload custom chef recipes to specified environment so they can be applied."
|
25
25
|
long_desc <<-DESC
|
26
26
|
Make an archive of the "cookbooks/" subdirectory in your current working
|
27
|
-
directory and upload it to
|
27
|
+
directory and upload it to EY Cloud's recipe storage.
|
28
28
|
|
29
29
|
Alternatively, specify a .tgz of a cookbooks/ directory yourself as follows:
|
30
30
|
|
@@ -115,11 +115,19 @@ module EY
|
|
115
115
|
})
|
116
116
|
end
|
117
117
|
|
118
|
-
|
119
|
-
|
120
|
-
|
118
|
+
# If force_ref is a string, use it as the ref, otherwise use it as a boolean.
|
119
|
+
def resolve_branch(ref, force_ref=false)
|
120
|
+
if String === force_ref
|
121
|
+
ref, force_ref = force_ref, true
|
122
|
+
end
|
123
|
+
|
124
|
+
if !ref
|
125
|
+
default_branch
|
126
|
+
elsif force_ref || !default_branch || ref == default_branch
|
127
|
+
ref
|
128
|
+
else
|
129
|
+
raise BranchMismatchError.new(default_branch, ref)
|
121
130
|
end
|
122
|
-
branch || default_branch
|
123
131
|
end
|
124
132
|
|
125
133
|
def configuration
|
@@ -41,7 +41,7 @@ module EY
|
|
41
41
|
ensure
|
42
42
|
if deployment
|
43
43
|
deployment.finished(successful, output)
|
44
|
-
EY.ui.info "#{successful ? 'Successful' : 'Failed'} deployment recorded in
|
44
|
+
EY.ui.info "#{successful ? 'Successful' : 'Failed'} deployment recorded in EY Cloud"
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
data/lib/engineyard/version.rb
CHANGED
data/spec/engineyard/api_spec.rb
CHANGED
@@ -15,6 +15,12 @@ describe EY::CLI::API do
|
|
15
15
|
EY::CLI::API.new.should == EY::CLI::API.new("asdf")
|
16
16
|
end
|
17
17
|
|
18
|
+
it "uses the token from $ENGINEYARD_API_TOKEN if set" do
|
19
|
+
ENV['ENGINEYARD_API_TOKEN'] = 'envtoken'
|
20
|
+
EY::CLI::API.new.token.should == 'envtoken'
|
21
|
+
ENV.delete('ENGINEYARD_API_TOKEN')
|
22
|
+
end
|
23
|
+
|
18
24
|
context "without saved api token" do
|
19
25
|
before(:each) do
|
20
26
|
FakeWeb.register_uri(:post, "https://cloud.engineyard.com/api/v2/authenticate", :body => %|{"api_token": "asdf"}|, :content_type => 'application/json')
|
data/spec/ey/deploy_spec.rb
CHANGED
@@ -37,7 +37,7 @@ describe "ey deploy" do
|
|
37
37
|
|
38
38
|
def verify_ran(scenario)
|
39
39
|
@out.should match(/Beginning deploy of ref '[^']+' for '#{scenario[:application]}' in '#{scenario[:environment]}'/)
|
40
|
-
@out.should match(/deployment recorded
|
40
|
+
@out.should match(/deployment recorded/i)
|
41
41
|
@ssh_commands.should have_command_like(/engineyard-serverside.*deploy.*--app #{scenario[:application]}/)
|
42
42
|
end
|
43
43
|
|
@@ -264,7 +264,7 @@ describe "ey deploy" do
|
|
264
264
|
@ssh_commands.last.should =~ /--ref resolved-master/
|
265
265
|
end
|
266
266
|
|
267
|
-
it "complains about a non-default branch without --ignore-
|
267
|
+
it "complains about a non-default branch without --ignore-default-branch" do
|
268
268
|
fast_failing_ey %w[deploy -r current-branch]
|
269
269
|
@err.should =~ /deploy branch is set to "master"/
|
270
270
|
end
|
@@ -273,6 +273,11 @@ describe "ey deploy" do
|
|
273
273
|
fast_ey %w[deploy -r current-branch --ignore-default-branch]
|
274
274
|
@ssh_commands.last.should =~ /--ref resolved-current-branch/
|
275
275
|
end
|
276
|
+
|
277
|
+
it "deploys a non-default branch with --R ref" do
|
278
|
+
fast_ey %w[deploy -R current-branch]
|
279
|
+
@ssh_commands.last.should =~ /--ref resolved-current-branch/
|
280
|
+
end
|
276
281
|
end
|
277
282
|
end
|
278
283
|
|
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:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 1.4.
|
9
|
+
- 15
|
10
|
+
version: 1.4.15
|
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: 2011-12-
|
18
|
+
date: 2011-12-15 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|