heroku_deployer 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/amitree/heroku_client.rb +12 -12
- data/lib/amitree/heroku_deployer.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3db83a27010baf2e84d285cef09c3f8f93167617
|
4
|
+
data.tar.gz: c1b3f6dd12f42822df380a4cd6d8cf6c2b2905bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02219466d91190457d41273d26c547aa4c7468d187fa0144f7ae2a8071fe84c3bdb5e50c15fd52aa48eeb6518d605360d39fa696afcdb71e91e00260395ba7b5
|
7
|
+
data.tar.gz: a88632436f76212ccc7d0882b8fddf04b9031c5e1206ce131567e1711b16a436b681908865142eda04294a7081ecd638359a7c5bea685b11edcf5b56b9d94e47
|
@@ -14,7 +14,7 @@ module Amitree
|
|
14
14
|
@heroku_no_cache = PlatformAPI.connect(api_key, cache: Moneta.new(:Null))
|
15
15
|
@staging_app_name = staging_app_name
|
16
16
|
@production_app_name = production_app_name
|
17
|
-
@promoted_release_regexp = /Promote #{@staging_app_name} (
|
17
|
+
@promoted_release_regexp = /Promote #{@staging_app_name} v(\d+)/
|
18
18
|
end
|
19
19
|
|
20
20
|
def get_staging_commit(release)
|
@@ -33,38 +33,38 @@ module Amitree
|
|
33
33
|
get_releases(@production_app_name).reverse.detect{|release| promoted_from_staging?(release)} or raise Error.new "Can't find a production release that was promoted from staging!"
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
36
|
+
def staging_release_version(production_release)
|
37
37
|
unless production_release['description'] =~ @promoted_release_regexp
|
38
38
|
raise Error.new "Production release was not promoted from staging: #{production_release['description']}"
|
39
39
|
end
|
40
|
-
$1
|
40
|
+
$1.to_i
|
41
41
|
end
|
42
42
|
|
43
43
|
def promoted_from_staging?(release)
|
44
44
|
release['description'] =~ @promoted_release_regexp
|
45
45
|
end
|
46
46
|
|
47
|
-
def staging_releases_since(
|
47
|
+
def staging_releases_since(staging_release_version)
|
48
48
|
staging_releases = get_releases(@staging_app_name)
|
49
|
-
index = staging_releases.index { |release| release['
|
49
|
+
index = staging_releases.index { |release| release['version'] == staging_release_version }
|
50
50
|
if index.nil?
|
51
|
-
raise Error.new "Could not find staging release #{
|
51
|
+
raise Error.new "Could not find staging release #{staging_release_version}"
|
52
52
|
end
|
53
53
|
staging_releases.slice(index+1, staging_releases.length)
|
54
54
|
end
|
55
55
|
|
56
|
-
def deploy_to_production(
|
57
|
-
slug = staging_slug(
|
56
|
+
def deploy_to_production(staging_release_version, options={})
|
57
|
+
slug = staging_slug(staging_release_version)
|
58
58
|
puts "Deploying slug to production: #{slug}"
|
59
59
|
unless options[:dry_run]
|
60
|
-
@heroku.release.create(@production_app_name, {'slug' => slug, 'description' => "Promote #{@staging_app_name} #{
|
60
|
+
@heroku.release.create(@production_app_name, {'slug' => slug, 'description' => "Promote #{@staging_app_name} v#{staging_release_version}"})
|
61
61
|
db_migrate_on_production(options)
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
def staging_slug(
|
66
|
-
unless
|
67
|
-
raise Error.new "Unexpected release
|
65
|
+
def staging_slug(staging_release_version)
|
66
|
+
unless staging_release_version.is_a?(Fixnum)
|
67
|
+
raise Error.new "Unexpected release version: #{staging_release_version}"
|
68
68
|
end
|
69
69
|
result = @heroku.release.info(@staging_app_name, $1)
|
70
70
|
result['slug']['id'] || raise(Error.new("Could not find slug in API response: #{result.inspect}"))
|
@@ -50,7 +50,7 @@ module Amitree
|
|
50
50
|
|
51
51
|
result.production_release = @heroku.last_promoted_production_release
|
52
52
|
result.production_promoted_from_staging = @heroku.promoted_from_staging?(result.production_release)
|
53
|
-
staging_releases = @heroku.staging_releases_since(@heroku.
|
53
|
+
staging_releases = @heroku.staging_releases_since(@heroku.staging_release_version(result.production_release))
|
54
54
|
|
55
55
|
prod_commit = @heroku.get_production_commit(result.production_release)
|
56
56
|
puts "Production release is #{prod_commit_full}" if options[:verbose]
|
@@ -63,7 +63,7 @@ module Amitree
|
|
63
63
|
stories = all_stories.values_at(*@git.stories_worked_on_between(prod_commit, staging_commit)).compact
|
64
64
|
story_ids = stories.map(&:id)
|
65
65
|
|
66
|
-
puts "- Trying staging release #{staging_release['
|
66
|
+
puts "- Trying staging release v#{staging_release['version']} with commit #{staging_commit}" if options[:verbose]
|
67
67
|
puts " - Stories: #{story_ids.inspect}" if options[:verbose]
|
68
68
|
|
69
69
|
unaccepted_story_ids = story_ids.select { |story_id| get_tracker_status(story_id) != 'accepted' }
|