heroku_feature_deployments 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +85 -4
- data/heroku_feature_deployments.gemspec +1 -1
- data/lib/heroku_feature_deployments.rb +1 -1
- data/lib/heroku_feature_deployments/deployer.rb +12 -22
- data/lib/heroku_feature_deployments/pull_request_creator.rb +11 -6
- data/lib/heroku_feature_deployments/version.rb +1 -1
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 165d736d7cde071a603fe78b93b9fdba7984e3ff
|
4
|
+
data.tar.gz: 0413433e420dca5aa2ecf0660f64d4f4ccd77dea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcc28da513377950068e88b413b5f15ae9e5bcf85f69ceda28f45d5cea0150d8bb309fa033642258343492cffe87773528bdbe8ae3e07b86843c9cbbf81fbb71
|
7
|
+
data.tar.gz: 8904efc4fc869b811884c850653b20fc2a0c187b98d51f2e9f10a5ac7e749eef7bf295531a958a2b2c889266fa5c0eb9896ce9c043138f3299f0067a69376a29
|
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
#
|
1
|
+
# Heroku Feature Deployments
|
2
2
|
|
3
|
-
|
3
|
+
A very simple gem to automate deployment of the current git branch to Heroku,
|
4
|
+
configure DNS, notify PivotalTracker, etc. For more information, [see this blog
|
5
|
+
post](http://mattbeedle.name/posts/deploy-feature-branches-to-heroku-with-heroku-feature-deployments/)
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
8
10
|
|
9
|
-
gem 'heroku_feature_deployments'
|
11
|
+
gem 'heroku_feature_deployments', group: :development
|
10
12
|
|
11
13
|
And then execute:
|
12
14
|
|
@@ -16,9 +18,88 @@ Or install it yourself as:
|
|
16
18
|
|
17
19
|
$ gem install heroku_feature_deployments
|
18
20
|
|
21
|
+
Outside of Rails you must include the rake tasks manually in your Rakefile
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
load 'tasks/heroku_feature_deployments.rake'
|
25
|
+
```
|
26
|
+
|
27
|
+
## Configuration
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
HerokuFeatureDeployments.configure do |config|
|
31
|
+
# Heroku Configuration
|
32
|
+
config.heroku_api_key = ENV['HEROKU_API_KEY']
|
33
|
+
|
34
|
+
# List of all Heroku addons required
|
35
|
+
config.addons = [
|
36
|
+
'memcachier:dev', 'sendgrid:starter', 'redistogo:nano'
|
37
|
+
]
|
38
|
+
|
39
|
+
# These environment variables will be added to heroku
|
40
|
+
config.env_vars = {
|
41
|
+
S3_BUCKET_NAME: 'my-bucket',
|
42
|
+
RACK_ENV: 'staging'
|
43
|
+
}
|
44
|
+
|
45
|
+
# Prefix all heroku app names with this, to avoid name collisions
|
46
|
+
config.namespace = 'a-namespace'
|
47
|
+
|
48
|
+
# Ths name of the heroku account you are using you are using
|
49
|
+
# (https://github.com/ddollar/heroku-accounts)
|
50
|
+
config.heroku_account_name = 'account-name'
|
51
|
+
|
52
|
+
# The region to deploy the app in (eu/us)
|
53
|
+
config.region = 'eu'
|
54
|
+
|
55
|
+
# An array of collaborator email addresses
|
56
|
+
config.collaborators = [
|
57
|
+
'matt@gmail.com', 'another@gmail.com'
|
58
|
+
]
|
59
|
+
|
60
|
+
# DNS configuration
|
61
|
+
config.dnsimple_username = ENV['DNSIMPLE_USERNAME']
|
62
|
+
config.dnsimple_api_key = ENV['DNSIMPLE_API_KEY']
|
63
|
+
|
64
|
+
|
65
|
+
# GitHub Configuration
|
66
|
+
config.github_token = ENV['GITHUB_TOKEN']
|
67
|
+
# The name of the GitHub repository ('heroku_feature_deployments') for example
|
68
|
+
config.github_repo = 'github project name'
|
69
|
+
|
70
|
+
|
71
|
+
# Pivotal Tracker Configuration
|
72
|
+
config.pivotal_tracker_api_key = ENV['PIVOTAL_TRACKER_API_KEY']
|
73
|
+
config.pivotal_tracker_project_id = ENV['PIVOTAL_TRACKER_PROJECT_ID']
|
74
|
+
|
75
|
+
|
76
|
+
# Other
|
77
|
+
config.logger = Rails.logger # Defaults to STDOUT
|
78
|
+
end if defined?(HerokuFeatureDeployments)
|
79
|
+
```
|
80
|
+
|
19
81
|
## Usage
|
20
82
|
|
21
|
-
|
83
|
+
First make sure that you are on the branch that you want to deploy
|
84
|
+
```bash
|
85
|
+
git checkout branch-name
|
86
|
+
```
|
87
|
+
|
88
|
+
Then deploy it!
|
89
|
+
```bash
|
90
|
+
rake hfd:deploy PIVOTAL_TICKET_ID=pivotal ticket ID here
|
91
|
+
```
|
92
|
+
|
93
|
+
Or alternatively, if this feature does not have a ticket in pivotal:
|
94
|
+
```bash
|
95
|
+
rake hfd:deploy
|
96
|
+
```
|
97
|
+
|
98
|
+
Later, when you are finished with it, then you can tear everything down with:
|
99
|
+
```bash
|
100
|
+
rake hfd:undeploy
|
101
|
+
```
|
102
|
+
Again, make sure that you are on the branch that you want to tear down!
|
22
103
|
|
23
104
|
## Contributing
|
24
105
|
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
19
19
|
|
20
20
|
gem.add_runtime_dependency('heroku-api')
|
21
21
|
gem.add_runtime_dependency('dnsimple-ruby')
|
22
|
-
gem.add_runtime_dependency('
|
22
|
+
gem.add_runtime_dependency('octokit')
|
23
23
|
|
24
24
|
gem.add_development_dependency('rspec')
|
25
25
|
gem.add_development_dependency('vcr')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'heroku-api'
|
3
3
|
require 'dnsimple'
|
4
|
-
require '
|
4
|
+
require 'octokit'
|
5
5
|
require 'heroku_feature_deployments/configuration'
|
6
6
|
require 'heroku_feature_deployments/deployer'
|
7
7
|
require 'heroku_feature_deployments/pull_request_creator'
|
@@ -32,12 +32,7 @@ module HerokuFeatureDeployments
|
|
32
32
|
add_environment_variables
|
33
33
|
push_code
|
34
34
|
create_db
|
35
|
-
|
36
|
-
migrate_db
|
37
|
-
wait_for_process_to_finish 'rake db:migrate'
|
38
|
-
seed_db
|
39
|
-
wait_for_process_to_finish 'rake db:seed'
|
40
|
-
# add_pivotal_comment if @pivotal_ticket_id
|
35
|
+
add_pivotal_comment if @pivotal_ticket_id
|
41
36
|
create_pull_request
|
42
37
|
end
|
43
38
|
|
@@ -99,15 +94,15 @@ module HerokuFeatureDeployments
|
|
99
94
|
config.logger.info 'Pull request already exists.'
|
100
95
|
end
|
101
96
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
97
|
+
def add_pivotal_comment
|
98
|
+
PivotalTracker::Project.all
|
99
|
+
project = PivotalTracker::Project.find(config.pivotal_tracker_project_id)
|
100
|
+
project.stories.find(@pivotal_tracker_id).tap do |story|
|
101
|
+
story.notes.create(
|
102
|
+
text: "location: http://#{@app_name}.#{config.domain}"
|
103
|
+
)
|
104
|
+
end
|
105
|
+
end
|
111
106
|
|
112
107
|
def get_branch_name
|
113
108
|
`git branch`.split("\n").select {|s| s =~ /\*/ }.first.gsub(/\*/, '').
|
@@ -115,8 +110,8 @@ module HerokuFeatureDeployments
|
|
115
110
|
end
|
116
111
|
|
117
112
|
def create_db
|
118
|
-
config.logger.info "Creating database"
|
119
|
-
heroku.post_ps(@full_app_name, 'rake db:create')
|
113
|
+
config.logger.info "Creating, migrating and seeding database"
|
114
|
+
heroku.post_ps(@full_app_name, 'rake db:create db:migrate db:seed')
|
120
115
|
end
|
121
116
|
|
122
117
|
def migrate_db
|
@@ -124,11 +119,6 @@ module HerokuFeatureDeployments
|
|
124
119
|
heroku.post_ps(@full_app_name, 'rake db:migrate')
|
125
120
|
end
|
126
121
|
|
127
|
-
def seed_db
|
128
|
-
config.logger.info "Seeding database"
|
129
|
-
heroku.post_ps(@full_app_name, 'rake db:seed')
|
130
|
-
end
|
131
|
-
|
132
122
|
def push_code
|
133
123
|
run_command "git push #{@remote_name} #{@branch_name}:master"
|
134
124
|
end
|
@@ -8,14 +8,19 @@ module HerokuFeatureDeployments
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def create
|
11
|
-
|
12
|
-
|
11
|
+
client.create_pull_request(
|
12
|
+
HerokuFeatureDeployments.configuration.github_repo,
|
13
|
+
'master', @branch_name, title, body
|
13
14
|
)
|
15
|
+
rescue Octokit::UnprocessableEntity => e
|
16
|
+
config.logger "An error occurred when creating the pull request: #{e.message}"
|
17
|
+
end
|
14
18
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
private
|
20
|
+
|
21
|
+
def client
|
22
|
+
@client ||= Octokit::Client.new(
|
23
|
+
access_token: HerokuFeatureDeployments.configuration.github_token
|
19
24
|
)
|
20
25
|
end
|
21
26
|
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku_feature_deployments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Beedle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: heroku-api
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dnsimple-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: octokit
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: vcr
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Gem to deploy the current git branch to a new app on heroku
|
@@ -87,7 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
90
|
+
- ".gitignore"
|
91
91
|
- Gemfile
|
92
92
|
- LICENSE.txt
|
93
93
|
- README.md
|
@@ -109,17 +109,17 @@ require_paths:
|
|
109
109
|
- lib
|
110
110
|
required_ruby_version: !ruby/object:Gem::Requirement
|
111
111
|
requirements:
|
112
|
-
- -
|
112
|
+
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.2.2
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Gem to deploy the current git branch to a new app on heroku
|