engineyard 1.4.13 → 1.4.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -52,6 +52,7 @@ module EY
52
52
 
53
53
  class InvalidCredentials < EY::Error; end
54
54
  class RequestFailed < EY::Error; end
55
+ class ResourceNotFound < RequestFailed; end
55
56
 
56
57
  def self.request(path, opts={})
57
58
  require 'rest_client'
@@ -79,7 +80,7 @@ module EY
79
80
  rescue Errno::ECONNREFUSED
80
81
  raise RequestFailed, "Could not reach the cloud API"
81
82
  rescue RestClient::ResourceNotFound
82
- raise RequestFailed, "The requested resource could not be found"
83
+ raise ResourceNotFound, "The requested resource could not be found"
83
84
  rescue RestClient::BadGateway
84
85
  raise RequestFailed, "AppCloud API is temporarily unavailable. Please try again soon."
85
86
  rescue RestClient::RequestFailed => e
@@ -65,7 +65,7 @@ module EY
65
65
 
66
66
  EY.ui.info "Beginning deploy of ref '#{deploy_ref}' for '#{app.name}' in '#{environment.name}' on server..."
67
67
 
68
- deploy_options = {'extras' => options[:extra_deploy_hook_options]}
68
+ deploy_options = {'extras' => {'deployed_by' => api.user.name}.merge(options[:extra_deploy_hook_options])}
69
69
  if options.has_key?('migrate') # thor set migrate => nil when --no-migrate
70
70
  deploy_options['migrate'] = options['migrate'].respond_to?(:to_str) ? options['migrate'] : !!options['migrate']
71
71
  end
@@ -14,6 +14,8 @@ module EY
14
14
  def self.get(app, environment, id, api)
15
15
  response = api.request(api_root(app.id, environment.id) + "/#{id}", :method => :get)
16
16
  load_from_response app, environment, response
17
+ rescue EY::API::ResourceNotFound
18
+ nil
17
19
  end
18
20
 
19
21
  def self.load_from_response(app, environment, response)
@@ -20,7 +20,7 @@ module EY
20
20
  private :adapter
21
21
 
22
22
  def deploy(app, ref, migration_command=nil, extra_configuration=nil, verbose=false)
23
- successful, output = false, ""
23
+ successful, output = false, "Deploy initiated.\n"
24
24
  deployment = Deployment.started(environment, app, ref, migration_command)
25
25
 
26
26
  deploy_command = adapter(app, verbose).deploy do |args|
@@ -30,6 +30,14 @@ module EY
30
30
  end
31
31
 
32
32
  successful = invoke(deploy_command) { |chunk| output << chunk }
33
+ rescue Interrupt
34
+ EY.ui.info "Interrupted. Exiting..."
35
+ output << "Interrupted.\n"
36
+ raise
37
+ rescue StandardError => e
38
+ EY.ui.info "Error encountered during deploy."
39
+ output << "Error encountered during deploy.\n#{e.class} #{e}\n"
40
+ raise
33
41
  ensure
34
42
  if deployment
35
43
  deployment.finished(successful, output)
@@ -80,7 +88,8 @@ module EY
80
88
  exit_code = nil
81
89
  cmd = Escape.shell_command(['bash', '-lc', remote_command])
82
90
  EY.ui.debug(cmd)
83
- puts cmd if verbose
91
+ block.call("Triggering deploy on #{environment.username}@#{hostname}.\n")
92
+ block.call(cmd) if verbose
84
93
  if ENV["NO_SSH"]
85
94
  block.call("NO_SSH is set. No output.")
86
95
  true
@@ -1,7 +1,7 @@
1
1
  module EY
2
2
  class Resolver
3
3
  attr_reader :api
4
-
4
+
5
5
  def initialize(api)
6
6
  @api = api
7
7
  end
@@ -79,7 +79,7 @@ module EY
79
79
  def app_deployments
80
80
  @app_deployments ||= api.apps.map do |app|
81
81
  app.environments.map do |environment|
82
- {
82
+ {
83
83
  :app_name => app.name.downcase,
84
84
  :repository_uri => app.repository_uri,
85
85
  :environment_name => environment.name.downcase,
@@ -1,3 +1,3 @@
1
1
  module EY
2
- VERSION = '1.4.13'
2
+ VERSION = '1.4.14'
3
3
  end
@@ -246,7 +246,7 @@ describe "ey deploy" do
246
246
 
247
247
  it "gets passed along to engineyard-serverside" do
248
248
  fast_ey %w[deploy]
249
- @ssh_commands.last.should =~ /--config '\{\"bert\":\"ernie\"\}'/
249
+ @ssh_commands.last.should =~ /--config \S+"bert":"ernie"/
250
250
  end
251
251
  end
252
252
 
@@ -14,7 +14,7 @@ describe "ey environments" do
14
14
  @out.should =~ /Environment:\s+giblets/
15
15
  @out.should =~ /Ref:\s+HEAD/
16
16
  @out.should =~ /Resolved Ref:\s+HEAD/
17
- @out.should =~ /Deployed by:\s+User/
17
+ @out.should =~ /Deployed by:\s+User Name/
18
18
  @out.should =~ /Created at:/
19
19
  @out.should =~ /Finished at:/
20
20
  @out.should =~ /This deployment was successful/
@@ -10,7 +10,7 @@ describe "ey whoami" do
10
10
 
11
11
  it "outputs the currently logged in user" do
12
12
  ey %w[whoami]
13
- @out.should include("User (test@test.test)")
13
+ @out.should include("User Name (test@test.test)")
14
14
  end
15
15
  end
16
16
 
@@ -31,7 +31,7 @@ describe "ey whoami" do
31
31
  @out.should include("Email:")
32
32
  @out.should include("Password:")
33
33
 
34
- @out.should include("User (test@test.test)")
34
+ @out.should include("User Name (test@test.test)")
35
35
  end
36
36
  end
37
37
  end
@@ -44,7 +44,7 @@ class FakeAwsm < Sinatra::Base
44
44
  end
45
45
 
46
46
  get "/api/v2/current_user" do
47
- { "user" => { "id" => 1, "name" => "User", "email" => "test@test.test" } }.to_json
47
+ { "user" => { "id" => 1, "name" => "User Name", "email" => "test@test.test" } }.to_json
48
48
  end
49
49
 
50
50
  get "/api/v2/apps" do
@@ -111,7 +111,7 @@ class FakeAwsm < Sinatra::Base
111
111
  "ref" => "HEAD",
112
112
  "resolved_ref" => "HEAD",
113
113
  "commit" => 'a'*40,
114
- "user_name" => "User",
114
+ "user_name" => "User Name",
115
115
  "migrate_command" => "rake db:migrate --trace",
116
116
  "created_at" => Time.now.utc - 3600,
117
117
  "finished_at" => Time.now.utc - 3400,
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: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 4
9
- - 13
10
- version: 1.4.13
9
+ - 14
10
+ version: 1.4.14
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-08 00:00:00 Z
18
+ date: 2011-12-14 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement