heroku_rails_deploy 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +1 -1
- data/lib/heroku_rails_deploy/deployer.rb +12 -0
- data/lib/heroku_rails_deploy/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da83d3ca23cb65b722b0c91013bcb2c1a6b0ff2d
|
4
|
+
data.tar.gz: 47aa5f6bf6c60d75df5ce9e4e39e4a23917fb179
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d11f4dc879f0b65d01908dde8afa15795c03248dc6ea6bc1e66fcac95ecf3bf8da37af946a5dffa4d458de24966fa5a42d8d011a6a0da3cafdd6d92c737c1497
|
7
|
+
data.tar.gz: 70ec25ed4983969c61c26d6782f93499eb682a09a5b8e8390e81fb8cf8c58749acb3b689c975f5217ee89a653743b82b298f6ae644012b451c38ff648b2e9a29
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -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
|
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
|
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:
|
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.
|
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
|