heroku_deployer 0.7.11 → 0.7.13
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 +4 -7
- data/lib/amitree/heroku_deployer.rb +26 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 913df55faa73f62f743bd022ae4e7a2bff0b80f0
|
4
|
+
data.tar.gz: ca9e00e1fefac6ade5dcec3bef5a1aa792e4df6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 539cdb3bacf5fe8dbd45df4fa8822bc4ed42e7ce01a93b36137b2e3178bb5c358036d94d6237bfb95bb94363505ade9674b69b79091c0300be0ebb48150d709d
|
7
|
+
data.tar.gz: c5584ea06036e1d9e8437b2fd627e32843fef7ace243e1389a85405e4ad56a14f5070593bc02c9601c24813ca0fa068c0ab04939f28565246d5f0eee8b2a9cb7
|
@@ -11,7 +11,6 @@ module Amitree
|
|
11
11
|
|
12
12
|
def initialize(api_key, staging_app_name, production_app_name)
|
13
13
|
@heroku = PlatformAPI.connect(api_key)
|
14
|
-
@heroku_no_cache = PlatformAPI.connect(api_key, cache: Moneta.new(:Null))
|
15
14
|
@staging_app_name = staging_app_name
|
16
15
|
@production_app_name = production_app_name
|
17
16
|
@promoted_release_regexp = /Promote #{@staging_app_name} v(\d+)/
|
@@ -26,11 +25,11 @@ module Amitree
|
|
26
25
|
end
|
27
26
|
|
28
27
|
def current_production_release
|
29
|
-
get_releases(@production_app_name)
|
28
|
+
get_releases(@production_app_name).to_a.last
|
30
29
|
end
|
31
30
|
|
32
31
|
def last_promoted_production_release
|
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!"
|
32
|
+
get_releases(@production_app_name).to_a.reverse.detect{|release| promoted_from_staging?(release)} or raise Error.new "Can't find a production release that was promoted from staging!"
|
34
33
|
end
|
35
34
|
|
36
35
|
def staging_release_version(production_release)
|
@@ -46,7 +45,7 @@ module Amitree
|
|
46
45
|
|
47
46
|
def staging_releases_since(production_release)
|
48
47
|
staging_release_version = self.staging_release_version(production_release)
|
49
|
-
staging_releases = get_releases(@staging_app_name)
|
48
|
+
staging_releases = get_releases(@staging_app_name).to_a
|
50
49
|
index = staging_releases.index { |release| release['version'] == staging_release_version }
|
51
50
|
if index.nil?
|
52
51
|
raise Error.new "Could not find staging release #{staging_release_version}"
|
@@ -92,9 +91,7 @@ module Amitree
|
|
92
91
|
|
93
92
|
private
|
94
93
|
def get_releases(app_name)
|
95
|
-
|
96
|
-
@release_cache ||= {}
|
97
|
-
@release_cache[app_name] ||= @heroku_no_cache.release.list(app_name).to_a
|
94
|
+
@heroku.release.list(app_name)
|
98
95
|
end
|
99
96
|
|
100
97
|
def heroku_run(app_name, command)
|
@@ -54,32 +54,39 @@ module Amitree
|
|
54
54
|
all_stories = Hash[result.stories.map{|story| [story.id, story]}]
|
55
55
|
|
56
56
|
staging_releases.reverse.each do |staging_release|
|
57
|
-
|
58
|
-
|
59
|
-
story_ids = stories.map(&:id)
|
57
|
+
begin
|
58
|
+
staging_commit = @heroku.get_staging_commit(staging_release)
|
60
59
|
|
61
|
-
|
62
|
-
puts " - Stories: #{story_ids.inspect}" if options[:verbose]
|
60
|
+
puts "- Trying staging release #{@heroku.version(staging_release)} with commit #{staging_commit}" if options[:verbose]
|
63
61
|
|
64
|
-
|
62
|
+
stories = all_stories.values_at(*@git.stories_worked_on_between(prod_commit, staging_commit)).compact
|
63
|
+
story_ids = stories.map(&:id)
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
else
|
72
|
-
story_ids_referenced_later = story_ids & @git.stories_worked_on_between(staging_commit, 'HEAD')
|
73
|
-
if story_ids_referenced_later.length > 0
|
74
|
-
puts " - Some stories have been worked on in a later commit: #{story_ids_referenced_later}" if options[:verbose]
|
75
|
-
else
|
65
|
+
puts " - Stories: #{story_ids.inspect}" if options[:verbose]
|
66
|
+
|
67
|
+
unaccepted_story_ids = story_ids.select { |story_id| get_tracker_status(story_id) != 'accepted' }
|
68
|
+
|
69
|
+
if unaccepted_story_ids.length > 0
|
76
70
|
stories.each do |story|
|
77
71
|
story.blocked_by = unaccepted_story_ids
|
78
72
|
end
|
79
|
-
puts " -
|
80
|
-
|
81
|
-
|
73
|
+
puts " - Some stories are not yet accepted: #{unaccepted_story_ids.inspect}" if options[:verbose]
|
74
|
+
else
|
75
|
+
story_ids_referenced_later = story_ids & @git.stories_worked_on_between(staging_commit, 'HEAD')
|
76
|
+
if story_ids_referenced_later.length > 0
|
77
|
+
puts " - Some stories have been worked on in a later commit: #{story_ids_referenced_later}" if options[:verbose]
|
78
|
+
else
|
79
|
+
stories.each do |story|
|
80
|
+
story.blocked_by = unaccepted_story_ids
|
81
|
+
end
|
82
|
+
puts " - This release is good to go!" if options[:verbose]
|
83
|
+
result.staging_release_to_deploy = staging_release
|
84
|
+
break
|
85
|
+
end
|
82
86
|
end
|
87
|
+
rescue => error
|
88
|
+
puts " - Skipping candidate staging release because an error was encountered"
|
89
|
+
puts "\n#{error.class} (#{error.message}):\n " + error.backtrace.join("\n ") + "\n"
|
83
90
|
end
|
84
91
|
end
|
85
92
|
|
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.7.
|
4
|
+
version: 0.7.13
|
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: 2016-
|
12
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|