heroku_rails_deploy 0.1.0 → 0.2.1

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: 9735e2adea62cb3eb911e797afeaf47803517e44
4
- data.tar.gz: db9355ebc07bf1013ef783aa782a4decd366cdd7
3
+ metadata.gz: da83d3ca23cb65b722b0c91013bcb2c1a6b0ff2d
4
+ data.tar.gz: 47aa5f6bf6c60d75df5ce9e4e39e4a23917fb179
5
5
  SHA512:
6
- metadata.gz: 240b8f705fc58112e1616a92147befa4469d545828aa14989eb84ce0bbae892b61a1c53778dc4fb3f9e47bf5b6fd26fdd6d5d6fb584728e3ade96af1b29a4a6b
7
- data.tar.gz: abb3a2c9cc963ad7be67bea6c9bd924721fd4c41752dade7b2107590fcd778f67502498514560dbac3a304d6f190345c74e127fd9f101ad9f08ba9146482f159
6
+ metadata.gz: d11f4dc879f0b65d01908dde8afa15795c03248dc6ea6bc1e66fcac95ecf3bf8da37af946a5dffa4d458de24966fa5a42d8d011a6a0da3cafdd6d92c737c1497
7
+ data.tar.gz: 70ec25ed4983969c61c26d6782f93499eb682a09a5b8e8390e81fb8cf8c58749acb3b689c975f5217ee89a653743b82b298f6ae644012b451c38ff648b2e9a29
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
1
  # heroku_rails_deploy
2
2
 
3
+ ## v0.2.1
4
+ - Fixes bug in checking for valid production deploy
5
+
6
+ ## v0.2.0
7
+ - Can only deploy master or gitflow prefixed branches (hotfix/.+ and release/.+)
8
+
3
9
  ## v0.1.0
4
10
  - Initial version
data/README.md CHANGED
@@ -12,7 +12,7 @@ Add this line to your application's Gemfile:
12
12
 
13
13
  ```ruby
14
14
  group :development do
15
- gem 'heroku_rails_deploy'
15
+ gem 'heroku_rails_deploy', require: false
16
16
  end
17
17
  ```
18
18
 
@@ -3,6 +3,8 @@ require 'yaml'
3
3
 
4
4
  module HerokuRailsDeploy
5
5
  class Deployer
6
+ PRODUCTION_BRANCH_REGEX = /\A((master)|(release\/.+)|(hotfix\/.+))\z/
7
+
6
8
  attr_reader :config_file, :args
7
9
 
8
10
  class Options < Struct.new(:environment, :revision)
@@ -45,6 +47,8 @@ module HerokuRailsDeploy
45
47
  "Must be in #{app_registry.keys.join(', ')}")
46
48
  end
47
49
 
50
+ raise 'Only master, release or hotfix branches can be deployed to production' if options.environment == 'production' && !production_branch?
51
+
48
52
  puts "Pushing code to Heroku app #{app_name} for environment #{options.environment}"
49
53
  push_code(app_name, options.revision)
50
54
 
@@ -59,10 +63,18 @@ module HerokuRailsDeploy
59
63
  end
60
64
  end
61
65
 
66
+ def production_branch?
67
+ git_branch_name.match(PRODUCTION_BRANCH_REGEX)
68
+ end
69
+
62
70
  def push_code(app_name, revision)
63
71
  run_command!("git push --force git@heroku.com:#{app_name}.git #{revision}:master")
64
72
  end
65
73
 
74
+ def git_branch_name
75
+ run_command('git rev-parse --abbrev-ref HEAD')
76
+ end
77
+
66
78
  def run_migrations(app_name)
67
79
  run_heroku_command!(app_name, 'run rake db:migrate')
68
80
  end
@@ -1,3 +1,3 @@
1
1
  module HerokuRailsDeploy
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.1'.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.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-01 00:00:00.000000000 Z
11
+ date: 2017-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  version: '0'
157
157
  requirements: []
158
158
  rubyforge_project:
159
- rubygems_version: 2.5.1
159
+ rubygems_version: 2.4.8
160
160
  signing_key:
161
161
  specification_version: 4
162
162
  summary: Simple deployment of Rails app to Heroku