jumpup-heroku 0.0.4 → 0.0.5

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: 118a1d1cc65a278d3ec2a5c3b74ffaf3a67a8209
4
- data.tar.gz: 9dcc7fb2c844f5499f70ef72516be88a1b436e4a
3
+ metadata.gz: c564b5a44dfbb3effed01ed16bd50745d9c0ec77
4
+ data.tar.gz: 8daa28ab755bea85c38ddbb4a1d517cfc629e3f4
5
5
  SHA512:
6
- metadata.gz: d4e8cc321ff6d3be90ebbaed0528ba24b7031ec8bceed934c2943e8b30e73ead58dc2100f6e7fae0b5a8dd6a49c04019e3bafced352d5541553f841f98c8fa20
7
- data.tar.gz: d4f9ad4f84115ca9abef1d6f1dcc85cfae9e23b290912c1f6c03bceed48680c91668651fa429b329ac10e34e2f3bb96ab91c0f7c21aeec9397db96b99a8c7f42
6
+ metadata.gz: f164b39e121324149aeaed39a83f42012fd46e75cca118da23af01ac9d0f071cfbb4d59e3d75e5daed2ca3834cae078c37e5754d7912e47167f498f5ac86feac
7
+ data.tar.gz: dbd43c7a4726415440e8c7871c9fcd9ea946a87471798001becd1fc4999e68b17145c13a678231020c59693f1c974033b6aa3839e3bdc39d5e70fce454baa35c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.0.0
1
+ ruby-2.1.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.5 (March 31, 2014)
4
+
5
+ ### features
6
+
7
+ ### improvements
8
+ - Update Ruby version to 2.1.0
9
+ - Send to heroku only the defined branches
10
+
11
+ ### bug fixes
12
+ - Fix check for whether we should run `db:migrate` / `db:seeds` on production [[GH-38](https://github.com/Helabs/jumpup-heroku/issues/38)] / [[GH-40](https://github.com/Helabs/jumpup-heroku/pull/40)]
13
+
3
14
  ## 0.0.4 (February 21, 2014)
4
15
 
5
16
  ### features
@@ -13,6 +24,7 @@
13
24
  - Do not set INTEGRATING_BY again if you're already there
14
25
  - Add info about current branch when git push
15
26
  - Make sure that git name is setup
27
+ - Skip DB related tasks if nothing has changed since the last deploy [[GH-33](https://github.com/Helabs/jumpup-heroku/pull/33)]
16
28
 
17
29
  ### bug fixes
18
30
 
data/README.md CHANGED
@@ -22,39 +22,6 @@ Without groups on Gemfile, because of initializer.
22
22
  Jumpup::Heroku.configure do |config|
23
23
  config.app = 'myapp'
24
24
  end if Rails.env.development?
25
- ```
26
-
27
- If you use [Heroku Accounts](https://github.com/ddollar/heroku-accounts)
28
-
29
- ```ruby
30
- # config/initializers/jumpup-heroku.rb
31
- Jumpup::Heroku.configure do |config|
32
- config.account(:name_of_account1) do |account1|
33
- account1.app = 'myapp1'
34
- end
35
- config.account(:name_of_account2) do |account2|
36
- account2.app = 'myapp2'
37
- account2.run_database_tasks = false # Default: true
38
- end
39
- end if Rails.env.development?
40
- ```
41
-
42
- Have production and staging app? Do like this:
43
-
44
- ```ruby
45
- Jumpup::Heroku.configure do |config|
46
- config.staging_app = 'myapp-staging'
47
- config.production_app = 'myapp'
48
- end if Rails.env.development?
49
- ```
50
-
51
- If you need to disable remote database tasks (backup, migrate and seed):
52
-
53
- ```ruby
54
- Jumpup::Heroku.configure do |config|
55
- config.app = 'myapp'
56
- config.run_database_tasks = false # Default: true
57
- end if Rails.env.development?
58
25
  ```
59
26
 
60
27
  2. Add to the tasks on jumpup.rake the tasks to deploy on Heroku:
@@ -74,10 +41,73 @@ Without groups on Gemfile, because of initializer.
74
41
  )
75
42
  ```
76
43
 
44
+ ### Production and staging apps
45
+
46
+ Have production and staging app? Do like this:
47
+
48
+ ```ruby
49
+ Jumpup::Heroku.configure do |config|
50
+ config.staging_app = 'myapp-staging'
51
+ config.production_app = 'myapp'
52
+ end if Rails.env.development?
53
+ ```
54
+ The branch send to staging app is `master` and the branch send to production is the `production`.
55
+
56
+ ### Using heroku accounts
57
+
58
+ If you use [Heroku Accounts](https://github.com/ddollar/heroku-accounts)
59
+
60
+ ```ruby
61
+ # config/initializers/jumpup-heroku.rb
62
+ Jumpup::Heroku.configure do |config|
63
+
64
+ config.account(:name_of_account1) do |account1|
65
+ account1.app = 'myapp1'
66
+ end
67
+
68
+ config.account(:name_of_account2) do |account2|
69
+ account2.app = 'myapp2'
70
+ account2.run_database_tasks = false # Default: true
71
+ end
72
+ end if Rails.env.development?
73
+ ```
74
+
75
+ ### Database tasks
76
+
77
+ If you need to disable remote database tasks (backup, migrate and seed):
78
+
79
+ ```ruby
80
+ Jumpup::Heroku.configure do |config|
81
+ config.app = 'myapp'
82
+ config.run_database_tasks = false # Default: true
83
+ end if Rails.env.development?
84
+ ```
85
+
77
86
  ### Deploy to production
78
87
 
88
+ #### When I have a single app
89
+
79
90
  Run ```rake jumpup:heroku:deploy:production``` or as an alias ```rake integrate:production```
80
91
 
92
+ #### When I have staging and production apps
93
+
94
+ We have the following config
95
+
96
+ | Branch | App Environment |
97
+ | ------------- |-----------------|
98
+ | master | staging |
99
+ | production | production |
100
+
101
+ So to send to production we need to
102
+
103
+ ```bash
104
+ $ git checkout production
105
+ $ git merge master
106
+ $ git push -u origin production
107
+ ```
108
+
109
+ And send to Heroku with ```rake jumpup:heroku:deploy:production``` or as an alias ```rake integrate:production```
110
+
81
111
  ## Versioning
82
112
 
83
113
  Jumpup-heroku follow the [Semantic Versioning](http://semver.org/).
@@ -90,6 +120,10 @@ If you have problems, please create a [Github Issue](https://github.com/Helabs/j
90
120
 
91
121
  Please see [CONTRIBUTING.md](https://github.com/Helabs/jumpup-heroku/blob/master/CONTRIBUTING.md) for details.
92
122
 
123
+ ## Maintainers
124
+
125
+ - [Thiago Belem](https://github.com/TiuTalk)
126
+
93
127
  ## Release
94
128
 
95
129
  Follow this steps to release a new version of the gem.
@@ -31,6 +31,15 @@ module Jumpup
31
31
  boolean_run_database_tasks? && (only_app? || only_production_and_staging_apps?)
32
32
  end
33
33
 
34
+ def deploy_branch
35
+ 'master'
36
+ end
37
+
38
+ def deploy_to_production_branch
39
+ return 'production' if production_app
40
+ 'master'
41
+ end
42
+
34
43
  private
35
44
 
36
45
  def current_account
@@ -10,7 +10,9 @@ module Jumpup
10
10
  staging_app: Jumpup::Heroku.configuration.staging_app,
11
11
  production_app: Jumpup::Heroku.configuration.production_app,
12
12
  run_database_tasks: Jumpup::Heroku.configuration.run_database_tasks,
13
- host: Jumpup::Heroku.configuration.host
13
+ host: Jumpup::Heroku.configuration.host,
14
+ deploy_branch: Jumpup::Heroku.configuration.deploy_branch,
15
+ deploy_to_production_branch: Jumpup::Heroku.configuration.deploy_to_production_branch,
14
16
  }.delete_if { |k, v| v.nil? }
15
17
  else
16
18
  error_message = 'Check your `/config/initializers/jumpup-heroku.rb` and ' \
@@ -3,29 +3,50 @@ module Jumpup
3
3
 
4
4
  class Integrate
5
5
 
6
+ attr_reader :app
7
+
6
8
  def self.deploy
7
- integrate.deploy
9
+ message = "Starting to deploy on Heroku app #{integrate.app}"
10
+ integrate.when_branch_send_to_heroku(message) do
11
+ integrate.deploy
12
+ end
8
13
  end
9
14
 
10
15
  def self.deploy_to_production
11
16
  app = Env.all[:production_app]
12
- new(app).deploy_to_production
17
+ integrate = new(app)
18
+ message = "Starting to deploy to production on Heroku app #{integrate.app}"
19
+ integrate.when_branch_send_to_heroku(message) do
20
+ integrate.deploy_to_production
21
+ end
13
22
  end
14
23
 
15
24
  def self.add_remote
16
- integrate.add_remote
25
+ message = "Adding Heroku git remotes for app #{integrate.app}"
26
+ integrate.when_branch_send_to_heroku(message) do
27
+ integrate.add_remote
28
+ end
17
29
  end
18
30
 
19
31
  def self.check
20
- integrate.check
32
+ message = "Checking if there's already someone integrating to #{integrate.app}"
33
+ integrate.when_branch_send_to_heroku(message) do
34
+ integrate.check
35
+ end
21
36
  end
22
37
 
23
38
  def self.lock
24
- integrate.lock
39
+ message = "Locking Heroku integration on app #{integrate.app}"
40
+ integrate.when_branch_send_to_heroku(message) do
41
+ integrate.lock
42
+ end
25
43
  end
26
44
 
27
45
  def self.unlock
28
- integrate.unlock
46
+ message = "Unlocking Heroku integration on app #{integrate.app}"
47
+ integrate.when_branch_send_to_heroku(message) do
48
+ integrate.unlock
49
+ end
29
50
  end
30
51
 
31
52
  def self.integrate
@@ -39,15 +60,27 @@ module Jumpup
39
60
  @envs = Env.all
40
61
  end
41
62
 
63
+ def when_branch_send_to_heroku(message, &block)
64
+ puts "--> #{message}"
65
+ if branches_that_send_to_heroku.include?(actual_branch)
66
+ block.call
67
+ else
68
+ puts "----> Skipping since you are in a feature branch [#{actual_branch}]"
69
+ end
70
+ end
71
+
72
+ def branches_that_send_to_heroku
73
+ [Env.all[:deploy_branch], Env.all[:deploy_to_production_branch]]
74
+ end
75
+
42
76
  def deploy
43
77
  if run_database_tasks?
44
- run_with_clean_env('git fetch heroku')
45
78
  check_if_migration_is_needed
46
79
  check_if_seed_is_needed
47
80
  end
48
81
 
49
82
  backup
50
- push
83
+ push(Env.all[:deploy_branch])
51
84
  migrate
52
85
  seed
53
86
  restart
@@ -55,7 +88,6 @@ module Jumpup
55
88
 
56
89
  def deploy_to_production
57
90
  if run_database_tasks?
58
- run_with_clean_env('git fetch heroku')
59
91
  check_if_migration_is_needed
60
92
  check_if_seed_is_needed
61
93
  end
@@ -66,7 +98,7 @@ module Jumpup
66
98
  maintenance
67
99
  backup
68
100
  tag
69
- push
101
+ push(Env.all[:deploy_to_production_branch])
70
102
  migrate
71
103
  seed
72
104
  close_maintenance
@@ -74,45 +106,44 @@ module Jumpup
74
106
  end
75
107
 
76
108
  def add_remote
77
- puts "--> Adding Heroku git remotes for app #{app}"
78
109
  remote = run_with_clean_env("git remote | grep heroku").strip
79
110
  exec_with_clean_env("git remote add heroku git@heroku.com:#{app}.git") if remote.blank?
80
111
  end
81
112
 
82
113
  def check
83
- puts "--> Checking if there's already someone integrating to #{app}"
84
-
85
114
  return if can_start_integration?(user)
86
-
87
- puts "--> Project is already being integrated by '#{integrating_by}', halting"
115
+ puts "----> Project is already being integrated by '#{integrating_by}', halting"
88
116
  exit 1
89
117
  end
90
118
 
91
119
  def lock
92
120
  return if integrating_by?(user)
93
121
 
94
- puts "--> Locking Heroku integration for you (#{user})"
122
+ puts "----> Locking Heroku integration for you (#{user})"
95
123
  exec_with_clean_env("heroku config:set INTEGRATING_BY='#{user}' --app #{app}")
96
124
  end
97
125
 
98
126
  def unlock
99
- puts "--> Unlocking Heroku integration"
100
127
  exec_with_clean_env("heroku config:unset INTEGRATING_BY --app #{app}")
101
128
  end
102
129
 
103
130
  private
104
- attr_reader :app, :envs, :maintenance_mode
131
+ attr_reader :envs, :maintenance_mode
105
132
 
106
133
  def check_if_migration_is_needed
107
- files_changed = run_with_clean_env("git diff HEAD heroku/master --name-only -- db/migrate | wc -l").strip.to_i
134
+ files_changed = run_with_clean_env("git diff HEAD #{latest_remote_sha} --name-only -- db/migrate | wc -l").strip.to_i
108
135
  @migrations_changed = files_changed > 0
109
136
  end
110
137
 
111
138
  def check_if_seed_is_needed
112
- files_changed = run_with_clean_env("git diff HEAD heroku/master --name-only -- db/seeds* | wc -l").strip.to_i
139
+ files_changed = run_with_clean_env("git diff HEAD #{latest_remote_sha} --name-only -- db/seeds* | wc -l").strip.to_i
113
140
  @seeds_changed = files_changed > 0
114
141
  end
115
142
 
143
+ def latest_remote_sha
144
+ @latest_remote_sha ||= run_with_clean_env("git ls-remote git@heroku.com:#{app}.git HEAD 2>/dev/null | awk '{ print $1 }'").strip
145
+ end
146
+
116
147
  def can_start_integration?(user)
117
148
  integrating_by.blank? || integrating_by?(user)
118
149
  end
@@ -132,7 +163,7 @@ module Jumpup
132
163
  def validate_username
133
164
  user = run_with_clean_env("git config --get user.name").strip
134
165
  if user.blank?
135
- puts "--> You must setup your git user name. Use: git config --global user.name 'your name'"
166
+ puts "----> You must setup your git user name. Use: git config --global user.name 'your name'"
136
167
  exit 1
137
168
  end
138
169
  user
@@ -161,7 +192,7 @@ module Jumpup
161
192
 
162
193
  def backup
163
194
  return unless run_database_tasks?
164
- puts "--> [#{app}] Backing up database"
195
+ puts "----> [#{app}] Backing up database"
165
196
  exec_with_clean_env("heroku pgbackups:capture --expire --app #{app}")
166
197
  end
167
198
 
@@ -169,10 +200,10 @@ module Jumpup
169
200
  return unless run_database_tasks?
170
201
 
171
202
  if @migrations_changed
172
- puts "--> [#{app}] Migrating"
203
+ puts "----> [#{app}] Migrating"
173
204
  exec_with_clean_env("heroku run rake db:migrate --app #{app}")
174
205
  else
175
- puts "--> [#{app}] Skipping migrations"
206
+ puts "----> [#{app}] Skipping migrations"
176
207
  end
177
208
  end
178
209
 
@@ -180,29 +211,29 @@ module Jumpup
180
211
  return unless run_database_tasks?
181
212
 
182
213
  if @seeds_changed
183
- puts "--> [#{app}] Seeding"
214
+ puts "----> [#{app}] Seeding"
184
215
  exec_with_clean_env("heroku run rake db:seed --app #{app}")
185
216
  else
186
- puts "--> [#{app}] Skipping seeds"
217
+ puts "----> [#{app}] Skipping seeds"
187
218
  end
188
219
  end
189
220
 
190
221
  def restart
191
- puts "--> [#{app}] Restarting"
222
+ puts "----> [#{app}] Restarting"
192
223
  exec_with_clean_env("heroku restart --app #{app}")
193
224
  end
194
225
 
195
- def push
196
- puts "--> [#{app}] Pushing to #{host} from branch [#{actual_branch}]"
197
- exec_with_clean_env("git push git@#{host}:#{app}.git HEAD:master")
226
+ def push(branch)
227
+ puts "----> [#{app}] Pushing to #{host} from branch [#{branch}]"
228
+ exec_with_clean_env("git push git@#{host}:#{app}.git #{branch}:master")
198
229
  end
199
230
 
200
231
  def confirm_deploy
201
- confirm("[#{app}] Deploying to production using brach [#{actual_branch}]")
232
+ confirm("[#{app}] Deploying to production using branch [#{Env.all[:deploy_to_production_branch]}]")
202
233
  end
203
234
 
204
235
  def spec
205
- puts "--> Running all specs"
236
+ puts "----> Running all specs"
206
237
  Rake::Task['spec'].invoke
207
238
  end
208
239
 
@@ -217,10 +248,10 @@ module Jumpup
217
248
 
218
249
  def maintenance
219
250
  if maintenance?
220
- puts "--> [#{app}] Setting Maintenance on"
251
+ puts "----> [#{app}] Setting Maintenance on"
221
252
  exec_with_clean_env("heroku maintenance:on --app #{app}")
222
253
  restart
223
- puts "--> [#{app}] Waiting 20 seconds to app come back (in maintenance mode)"
254
+ puts "----> [#{app}] Waiting 20 seconds to app come back (in maintenance mode)"
224
255
  sleep(20)
225
256
  end
226
257
  end
@@ -229,10 +260,10 @@ module Jumpup
229
260
  iso_date = Time.now.strftime('%Y-%m-%dT%H%M%S')
230
261
  tag_name = "production-#{iso_date}"
231
262
 
232
- puts "--> Tagging as #{tag_name}"
263
+ puts "----> Tagging as #{tag_name}"
233
264
  exec_with_clean_env("git tag #{tag_name} master")
234
265
 
235
- puts "--> Pushing to origin"
266
+ puts "----> Pushing to origin"
236
267
  exec_with_clean_env("git push origin #{tag_name}")
237
268
  end
238
269
 
@@ -1,5 +1,5 @@
1
1
  module Jumpup
2
2
  module Heroku
3
- VERSION = '0.0.4'
3
+ VERSION = '0.0.5'
4
4
  end
5
5
  end
@@ -1,25 +1,35 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jumpup::Heroku::Configuration do
4
+
4
5
  before do
5
6
  Jumpup::Heroku.configuration = nil
6
7
  end
8
+
7
9
  describe ".configure" do
10
+
8
11
  describe "without configuration" do
12
+
9
13
  before do
10
14
  Jumpup::Heroku.configure do |config|
11
15
  end
12
16
  end
17
+
13
18
  subject do
14
19
  Jumpup::Heroku.configuration
15
20
  end
21
+
16
22
  its(:app) { should be_nil }
17
23
  its(:staging_app) { should be_nil }
18
24
  its(:production_app) { should be_nil }
19
25
  its(:run_database_tasks) { should be_true }
20
26
  its(:host) { should == 'heroku.com' }
27
+ its(:deploy_branch) { should eq('master') }
28
+ its(:deploy_to_production_branch) { should eq('master') }
21
29
  end
30
+
22
31
  describe "with configurations" do
32
+
23
33
  before do
24
34
  Jumpup::Heroku.configure do |config|
25
35
  config.app = 'myapp'
@@ -29,17 +39,24 @@ describe Jumpup::Heroku::Configuration do
29
39
  config.host = 'myhost.com'
30
40
  end
31
41
  end
42
+
32
43
  subject do
33
44
  Jumpup::Heroku.configuration
34
45
  end
46
+
35
47
  its(:app) { should eq('myapp') }
36
48
  its(:staging_app) { should eq('myapp-staging')}
37
49
  its(:production_app) { should eq('myapp-production') }
38
50
  its(:run_database_tasks) { should be_false }
39
51
  its(:host) { should eq('myhost.com') }
52
+ its(:deploy_branch) { should eq('master') }
53
+ its(:deploy_to_production_branch) { should eq('production') }
40
54
  end
55
+
41
56
  describe "with multiple accounts" do
57
+
42
58
  context "first account" do
59
+
43
60
  before { ENV.stub(:[]).with("HEROKU_ACCOUNT").and_return("first") }
44
61
  before do
45
62
  Jumpup::Heroku.configure do |config|
@@ -55,9 +72,11 @@ describe Jumpup::Heroku::Configuration do
55
72
  end
56
73
  end
57
74
  end
75
+
58
76
  subject do
59
77
  Jumpup::Heroku.configuration
60
78
  end
79
+
61
80
  its(:valid?) { should be_true }
62
81
  its(:app) { should be_nil }
63
82
  its(:staging_app) { should eq('myapp1-staging')}
@@ -65,7 +84,9 @@ describe Jumpup::Heroku::Configuration do
65
84
  its(:run_database_tasks) { should be_false }
66
85
  its(:host) { should eq('heroku.first') }
67
86
  end
87
+
68
88
  context "second account with default values" do
89
+
69
90
  before { ENV.stub(:[]).with("HEROKU_ACCOUNT").and_return("second") }
70
91
  before do
71
92
  Jumpup::Heroku.configure do |config|
@@ -80,9 +101,11 @@ describe Jumpup::Heroku::Configuration do
80
101
  end
81
102
  end
82
103
  end
104
+
83
105
  subject do
84
106
  Jumpup::Heroku.configuration
85
107
  end
108
+
86
109
  its(:valid?) { should be_true }
87
110
  its(:app) { should be_nil }
88
111
  its(:staging_app) { should eq('myapp2-staging')}
@@ -90,7 +113,9 @@ describe Jumpup::Heroku::Configuration do
90
113
  its(:run_database_tasks) { should be_false }
91
114
  its(:host) { should eq('mysecondhost.com') }
92
115
  end
116
+
93
117
  context "other account" do
118
+
94
119
  before { ENV.stub(:[]).with("HEROKU_ACCOUNT").and_return("third") }
95
120
  before do
96
121
  Jumpup::Heroku.configure do |config|
@@ -107,9 +132,11 @@ describe Jumpup::Heroku::Configuration do
107
132
  config.run_database_tasks = false
108
133
  end
109
134
  end
135
+
110
136
  subject do
111
137
  Jumpup::Heroku.configuration
112
138
  end
139
+
113
140
  its(:valid?) { should be_false }
114
141
  its(:app) { should be_nil }
115
142
  its(:staging_app) { should be_nil }
@@ -117,6 +144,7 @@ describe Jumpup::Heroku::Configuration do
117
144
  its(:run_database_tasks) { should be_false }
118
145
  its(:host) { should eq('heroku.com') }
119
146
  end
147
+
120
148
  context "without heroku accounts installed" do
121
149
  before { Jumpup::Heroku::Configuration.any_instance.stub(:current_account).and_return(:"") }
122
150
  before do
@@ -129,9 +157,11 @@ describe Jumpup::Heroku::Configuration do
129
157
  end
130
158
  end
131
159
  end
160
+
132
161
  subject do
133
162
  Jumpup::Heroku.configuration
134
163
  end
164
+
135
165
  its(:valid?) { should be_false }
136
166
  its(:app) { should be_nil }
137
167
  its(:staging_app) { should be_nil }
@@ -139,6 +169,7 @@ describe Jumpup::Heroku::Configuration do
139
169
  its(:run_database_tasks) { should be_true }
140
170
  its(:host) { should eq('heroku.com') }
141
171
  end
172
+
142
173
  context "without herou accounts installed and default values" do
143
174
  before { Jumpup::Heroku::Configuration.any_instance.stub(:current_account).and_return(:"") }
144
175
  before do
@@ -153,9 +184,11 @@ describe Jumpup::Heroku::Configuration do
153
184
  end
154
185
  end
155
186
  end
187
+
156
188
  subject do
157
189
  Jumpup::Heroku.configuration
158
190
  end
191
+
159
192
  its(:valid?) { should be_true }
160
193
  its(:app) { should be_nil }
161
194
  its(:staging_app) { should eq('myapp1-staging')}
@@ -164,128 +197,171 @@ describe Jumpup::Heroku::Configuration do
164
197
  end
165
198
  end
166
199
  end
200
+
167
201
  describe "#valid?" do
168
- describe "with app" do
169
- before do
170
- Jumpup::Heroku.configure do |config|
171
- config.app = 'myapp'
202
+
203
+ describe 'app configs' do
204
+
205
+ describe "with app" do
206
+
207
+ before do
208
+ Jumpup::Heroku.configure do |config|
209
+ config.app = 'myapp'
210
+ end
172
211
  end
173
- end
174
- it 'be valid' do
175
- expect(Jumpup::Heroku.configuration).to be_valid
176
- end
177
- end
178
- describe "with staging_app and production_app" do
179
- before do
180
- Jumpup::Heroku.configure do |config|
181
- config.production_app = 'myapp-production'
182
- config.staging_app = 'myapp-staging'
212
+
213
+ it 'be valid' do
214
+ expect(Jumpup::Heroku.configuration).to be_valid
183
215
  end
184
216
  end
185
- it 'be valid' do
186
- expect(Jumpup::Heroku.configuration).to be_valid
187
- end
188
- end
189
- describe "with app, staging_app and production_app" do
190
- before do
191
- Jumpup::Heroku.configure do |config|
192
- config.app = 'myapp'
193
- config.production_app = 'myapp-production'
194
- config.staging_app = 'myapp-staging'
217
+
218
+ describe "with staging_app and production_app" do
219
+
220
+ before do
221
+ Jumpup::Heroku.configure do |config|
222
+ config.production_app = 'myapp-production'
223
+ config.staging_app = 'myapp-staging'
224
+ end
195
225
  end
196
- end
197
- it 'not be valid' do
198
- expect(Jumpup::Heroku.configuration).to_not be_valid
199
- end
200
- end
201
- describe "with staging_app" do
202
- before do
203
- Jumpup::Heroku.configure do |config|
204
- config.staging_app = 'myapp-staging'
226
+
227
+ it 'be valid' do
228
+ expect(Jumpup::Heroku.configuration).to be_valid
205
229
  end
206
230
  end
207
- it 'not be valid' do
208
- expect(Jumpup::Heroku.configuration).to_not be_valid
209
- end
210
- end
211
- describe "with production_app" do
212
- before do
213
- Jumpup::Heroku.configure do |config|
214
- config.production_app = 'myapp-production'
231
+
232
+ describe "with app, staging_app and production_app" do
233
+
234
+ before do
235
+ Jumpup::Heroku.configure do |config|
236
+ config.app = 'myapp'
237
+ config.production_app = 'myapp-production'
238
+ config.staging_app = 'myapp-staging'
239
+ end
215
240
  end
216
- end
217
- it 'not be valid' do
218
- expect(Jumpup::Heroku.configuration).to_not be_valid
219
- end
220
- end
221
- describe "with app and production_app" do
222
- before do
223
- Jumpup::Heroku.configure do |config|
224
- config.app = 'myapp'
225
- config.production_app = 'myapp-production'
241
+
242
+ it 'not be valid' do
243
+ expect(Jumpup::Heroku.configuration).to_not be_valid
226
244
  end
227
245
  end
228
- it 'not be valid' do
229
- expect(Jumpup::Heroku.configuration).to_not be_valid
230
- end
231
- end
232
- describe "with app and staging_app" do
233
- before do
234
- Jumpup::Heroku.configure do |config|
235
- config.app = 'myapp'
236
- config.staging_app = 'myapp-staging'
246
+
247
+ describe "with staging_app" do
248
+
249
+ before do
250
+ Jumpup::Heroku.configure do |config|
251
+ config.staging_app = 'myapp-staging'
252
+ end
253
+ end
254
+
255
+ it 'not be valid' do
256
+ expect(Jumpup::Heroku.configuration).to_not be_valid
237
257
  end
238
258
  end
239
- it 'not be valid' do
240
- expect(Jumpup::Heroku.configuration).to_not be_valid
259
+
260
+ describe "with production_app" do
261
+
262
+ before do
263
+ Jumpup::Heroku.configure do |config|
264
+ config.production_app = 'myapp-production'
265
+ end
266
+ end
267
+
268
+ it 'not be valid' do
269
+ expect(Jumpup::Heroku.configuration).to_not be_valid
270
+ end
241
271
  end
242
- end
243
- describe "with true run_database_tasks" do
244
- before do
245
- Jumpup::Heroku.configure do |config|
246
- config.app = 'myapp'
247
- config.run_database_tasks = true
272
+
273
+ describe "with app and production_app" do
274
+
275
+ before do
276
+ Jumpup::Heroku.configure do |config|
277
+ config.app = 'myapp'
278
+ config.production_app = 'myapp-production'
279
+ end
280
+ end
281
+
282
+ it 'not be valid' do
283
+ expect(Jumpup::Heroku.configuration).to_not be_valid
248
284
  end
249
285
  end
250
- it 'be valid' do
251
- expect(Jumpup::Heroku.configuration).to be_valid
286
+
287
+ describe "with app and staging_app" do
288
+
289
+ before do
290
+ Jumpup::Heroku.configure do |config|
291
+ config.app = 'myapp'
292
+ config.staging_app = 'myapp-staging'
293
+ end
294
+ end
295
+
296
+ it 'not be valid' do
297
+ expect(Jumpup::Heroku.configuration).to_not be_valid
298
+ end
252
299
  end
253
300
  end
254
- describe "with false run_database_tasks" do
255
- before do
256
- Jumpup::Heroku.configure do |config|
257
- config.app = 'myapp'
258
- config.run_database_tasks = false
301
+
302
+ describe 'run_database_tasks configs' do
303
+
304
+ describe "with true run_database_tasks" do
305
+
306
+ before do
307
+ Jumpup::Heroku.configure do |config|
308
+ config.app = 'myapp'
309
+ config.run_database_tasks = true
310
+ end
311
+ end
312
+
313
+ it 'be valid' do
314
+ expect(Jumpup::Heroku.configuration).to be_valid
259
315
  end
260
316
  end
261
- it 'be valid' do
262
- expect(Jumpup::Heroku.configuration).to be_valid
263
- end
264
- end
265
- describe "with invalid run_database_tasks" do
266
- before do
267
- Jumpup::Heroku.configure do |config|
268
- config.app = 'myapp'
269
- config.run_database_tasks = 'a'
317
+
318
+ describe "with false run_database_tasks" do
319
+
320
+ before do
321
+ Jumpup::Heroku.configure do |config|
322
+ config.app = 'myapp'
323
+ config.run_database_tasks = false
324
+ end
325
+ end
326
+
327
+ it 'be valid' do
328
+ expect(Jumpup::Heroku.configuration).to be_valid
270
329
  end
271
330
  end
272
- it 'be valid' do
273
- expect(Jumpup::Heroku.configuration).to_not be_valid
331
+
332
+ describe "with invalid run_database_tasks" do
333
+
334
+ before do
335
+ Jumpup::Heroku.configure do |config|
336
+ config.app = 'myapp'
337
+ config.run_database_tasks = 'a'
338
+ end
339
+ end
340
+
341
+ it 'be valid' do
342
+ expect(Jumpup::Heroku.configuration).to_not be_valid
343
+ end
274
344
  end
275
345
  end
346
+
276
347
  describe "without configuration" do
348
+
277
349
  before do
278
350
  Jumpup::Heroku.configure do |config|
279
351
  end
280
352
  end
353
+
281
354
  it 'not be valid' do
282
355
  expect(Jumpup::Heroku.configuration).to_not be_valid
283
356
  end
284
357
  end
358
+
285
359
  describe "with configuration nil" do
360
+
286
361
  before do
287
362
  Jumpup::Heroku.configuration = nil
288
363
  end
364
+
289
365
  it 'not be valid' do
290
366
  pending "The bug is raised when have no config/initialier/heroku-deploy.rb file"
291
367
  expect(Jumpup::Heroku.configuration).to_not be_valid
@@ -1,44 +1,61 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jumpup::Heroku::Env do
4
+
4
5
  before do
5
6
  Jumpup::Heroku.configuration = nil
6
7
  end
8
+
7
9
  describe "with app" do
10
+
8
11
  before do
9
12
  Jumpup::Heroku.configure do |config|
10
13
  config.app = 'myapp'
11
14
  end
12
15
  end
16
+
13
17
  it "have correct env info" do
14
- expect(Jumpup::Heroku::Env.all).to eq({ app: 'myapp', run_database_tasks: true, host: 'heroku.com' })
18
+ config = { app: 'myapp', run_database_tasks: true, host: 'heroku.com',
19
+ deploy_branch: 'master', deploy_to_production_branch: 'master'}
20
+ expect(Jumpup::Heroku::Env.all).to eq(config)
15
21
  end
16
22
  end
23
+
17
24
  describe "with staging_app and production_app" do
25
+
18
26
  before do
19
27
  Jumpup::Heroku.configure do |config|
20
28
  config.production_app = 'myapp-production'
21
29
  config.staging_app = 'myapp-staging'
22
30
  end
23
31
  end
32
+
24
33
  it "have correct env info" do
25
- result = { production_app: 'myapp-production', staging_app: 'myapp-staging', run_database_tasks: true, host: 'heroku.com' }
26
- expect(Jumpup::Heroku::Env.all).to eq(result)
34
+ config = { production_app: 'myapp-production', staging_app: 'myapp-staging',
35
+ run_database_tasks: true, host: 'heroku.com',
36
+ deploy_branch: 'master', deploy_to_production_branch: 'production'}
37
+ expect(Jumpup::Heroku::Env.all).to eq(config)
27
38
  end
28
39
  end
40
+
29
41
  describe "with run_database_tasks" do
42
+
30
43
  before do
31
44
  Jumpup::Heroku.configure do |config|
32
45
  config.app = 'myapp'
33
46
  config.run_database_tasks = false
34
47
  end
35
48
  end
49
+
36
50
  it "have correct env info" do
37
- result = { app: 'myapp', run_database_tasks: false, host: 'heroku.com' }
51
+ result = { app: 'myapp', run_database_tasks: false, host: 'heroku.com',
52
+ deploy_branch: 'master', deploy_to_production_branch: 'master' }
38
53
  expect(Jumpup::Heroku::Env.all).to eq(result)
39
54
  end
40
55
  end
56
+
41
57
  describe "with a invalid config env" do
58
+
42
59
  before do
43
60
  Jumpup::Heroku.configure do |config|
44
61
  config.app = 'myapp'
@@ -47,6 +64,7 @@ describe Jumpup::Heroku::Env do
47
64
  config.run_database_tasks = 'a'
48
65
  end
49
66
  end
67
+
50
68
  it 'raise error' do
51
69
  expect do
52
70
  Jumpup::Heroku::Env.all
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jumpup-heroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - HE:labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-21 00:00:00.000000000 Z
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
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: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
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: :development
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
42
  name: rspec
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: :development
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
@@ -73,9 +73,9 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
77
- - .ruby-gemset
78
- - .ruby-version
76
+ - ".gitignore"
77
+ - ".ruby-gemset"
78
+ - ".ruby-version"
79
79
  - CHANGELOG.md
80
80
  - CONTRIBUTING.md
81
81
  - Gemfile
@@ -103,17 +103,17 @@ require_paths:
103
103
  - lib
104
104
  required_ruby_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - '>='
106
+ - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - '>='
111
+ - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
115
  rubyforge_project:
116
- rubygems_version: 2.0.5
116
+ rubygems_version: 2.2.2
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: Rake tasks to deploy on heroku