heroku_deployer 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/amitree/heroku_client.rb +14 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1106cf9722f06336b8b2b0d80ca77880c3276249
4
- data.tar.gz: 2c29af4e74cf24df298311dcda7b1c3d6130a27d
3
+ metadata.gz: 90cdcee100cee48c3a5a712688c9b3255bf31242
4
+ data.tar.gz: f9894580ed175898940aabce30dd1684bfa3dd95
5
5
  SHA512:
6
- metadata.gz: 17ff13e4170dedafb6004e3482e26283408e013d697178ebd82bed08105e442f42bcea635a5684e72935707692cc6a43dd5c70f01dd349a40ce2dd4acb9d58c7
7
- data.tar.gz: 3be99d675817bb50aac17e1dbfc5f5993080a34db1dbe16b313c2ac506a722cb84c9027871da5acb2e5eb2cbee7ad88f86990ea93555e235f5963bb2349a9a4f
6
+ metadata.gz: 32f73dad2edc8cd404c53adb1e9a3b05daf6b5e852cdc0ccb8cd8b134555dbe1804cd7d08545cae0ec685769750b67cfb92a3ffafc1b928f4f19fe04ccdce190
7
+ data.tar.gz: 07af7d6e65f1bfa68e055dfd358259faad0cdcb76c9c14c824dfd692139971a26b954b8e126925544c8fd8e689d7ceb32d76a9fada0c37c1e1bd2e9c59c7d449
@@ -7,6 +7,9 @@ module Amitree
7
7
  class Error < StandardError
8
8
  end
9
9
 
10
+ class PostDeploymentError < Error
11
+ end
12
+
10
13
  def initialize(api_key, staging_app_name, production_app_name)
11
14
  @heroku = Heroku::API.new(:api_key => api_key)
12
15
  # We need to use the new API (not currently supported by the heroku-api gem) for deploy_to_production
@@ -61,8 +64,17 @@ module Amitree
61
64
  result.body['slug']['id'] || raise(Error.new("Could not find slug in API response: #{result.inspect}"))
62
65
  end
63
66
 
64
- def db_migrate_on_production
65
- heroku_run(@production_app_name, 'rake db:migrate db:seed')
67
+ def db_migrate_on_production(attempts=0)
68
+ begin
69
+ heroku_run @production_app_name, 'rake db:migrate db:seed'
70
+ rescue => e
71
+ if attempts < 2
72
+ db_migrate_on_production(attempts+1)
73
+ raise PostDeploymentError if attempts == 0
74
+ else
75
+ raise e
76
+ end
77
+ end
66
78
  end
67
79
 
68
80
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Wargnier
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-04 00:00:00.000000000 Z
12
+ date: 2014-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec