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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27968f17a3e95c34581da21e78f483fc3022c423
4
- data.tar.gz: 9b0e2575ea4d85fc03063364ecd4f5512d60ef5a
3
+ metadata.gz: 3db83a27010baf2e84d285cef09c3f8f93167617
4
+ data.tar.gz: c1b3f6dd12f42822df380a4cd6d8cf6c2b2905bc
5
5
  SHA512:
6
- metadata.gz: b0c8dbc1420dd29e1a964c97ac14c7535c47a54f83239ac903d87a8921b7f3c5163bf469bed553692701a37bb917c70faee832bfdc92d1f1268315323da7fb89
7
- data.tar.gz: 8204e6b73ffa3865de513f1d4052a6944fe05c534f2d595f774f0a12cc8c01b61506c644cff9dabab37e77d737c2764e462954d1884397687025891a6a75609f
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} (v\d+)/
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 staging_release_name(production_release)
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(staging_release_name)
47
+ def staging_releases_since(staging_release_version)
48
48
  staging_releases = get_releases(@staging_app_name)
49
- index = staging_releases.index { |release| release['name'] == staging_release_name }
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 #{staging_release_name}"
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(staging_release_name, options={})
57
- slug = staging_slug(staging_release_name)
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} #{staging_release_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(staging_release_name)
66
- unless staging_release_name =~ /\Av(\d+)\z/
67
- raise Error.new "Unexpected release name: #{staging_release_name}"
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.staging_release_name(result.production_release))
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['name']} with commit #{staging_commit}" if options[:verbose]
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' }
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.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Wargnier