heroku_rails_deploy 0.2.1 → 0.2.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: da83d3ca23cb65b722b0c91013bcb2c1a6b0ff2d
4
- data.tar.gz: 47aa5f6bf6c60d75df5ce9e4e39e4a23917fb179
3
+ metadata.gz: bc3e6f646b7ef7c41f69b59029b2c1fdee7cff1c
4
+ data.tar.gz: 2f6e0b9b32170b947a47980f1d671118fd5ef3cb
5
5
  SHA512:
6
- metadata.gz: d11f4dc879f0b65d01908dde8afa15795c03248dc6ea6bc1e66fcac95ecf3bf8da37af946a5dffa4d458de24966fa5a42d8d011a6a0da3cafdd6d92c737c1497
7
- data.tar.gz: 70ec25ed4983969c61c26d6782f93499eb682a09a5b8e8390e81fb8cf8c58749acb3b689c975f5217ee89a653743b82b298f6ae644012b451c38ff648b2e9a29
6
+ metadata.gz: 8dbf1c200f8e9647d867a5ece168149fa2c1999d23e42842262a1f1ef76b7ab57b1f4419af1ea49d5a0724cdf213d1aafe834dc3ed8515a7a9a801f6504f023f
7
+ data.tar.gz: a6c5700adc7fd2b6e1b20567896a7dfaca655440978addd2bdada60aa0999c254d42fd1ea5416711a17b05cf56da213d305b1469e3e169ba2d5ecd10310196ff
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # heroku_rails_deploy
2
2
 
3
+ ## v0.2.2
4
+ - Fixes bug in getting branch name from executing system command
5
+
3
6
  ## v0.2.1
4
7
  - Fixes bug in checking for valid production deploy
5
8
 
@@ -1,4 +1,5 @@
1
1
  require 'optparse'
2
+ require 'shellwords'
2
3
  require 'yaml'
3
4
 
4
5
  module HerokuRailsDeploy
@@ -47,7 +48,7 @@ module HerokuRailsDeploy
47
48
  "Must be in #{app_registry.keys.join(', ')}")
48
49
  end
49
50
 
50
- raise 'Only master, release or hotfix branches can be deployed to production' if options.environment == 'production' && !production_branch?
51
+ raise 'Only master, release or hotfix branches can be deployed to production' if options.environment == 'production' && !production_branch?(options.revision)
51
52
 
52
53
  puts "Pushing code to Heroku app #{app_name} for environment #{options.environment}"
53
54
  push_code(app_name, options.revision)
@@ -63,16 +64,18 @@ module HerokuRailsDeploy
63
64
  end
64
65
  end
65
66
 
66
- def production_branch?
67
- git_branch_name.match(PRODUCTION_BRANCH_REGEX)
67
+ def production_branch?(revision)
68
+ git_branch_name(revision).match(PRODUCTION_BRANCH_REGEX)
68
69
  end
69
70
 
70
71
  def push_code(app_name, revision)
71
72
  run_command!("git push --force git@heroku.com:#{app_name}.git #{revision}:master")
72
73
  end
73
74
 
74
- def git_branch_name
75
- run_command('git rev-parse --abbrev-ref HEAD')
75
+ def git_branch_name(revision)
76
+ branch_name = `git rev-parse --abbrev-ref #{Shellwords.escape(revision)}`.strip
77
+ raise "Unable to get branch for #{revision}" unless $?.to_i == 0
78
+ branch_name
76
79
  end
77
80
 
78
81
  def run_migrations(app_name)
@@ -1,3 +1,3 @@
1
1
  module HerokuRailsDeploy
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_rails_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-11 00:00:00.000000000 Z
11
+ date: 2017-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails