jumpup-heroku 0.0.5 → 0.0.6

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: c564b5a44dfbb3effed01ed16bd50745d9c0ec77
4
- data.tar.gz: 8daa28ab755bea85c38ddbb4a1d517cfc629e3f4
3
+ metadata.gz: ad3455b4d9530976fca4b7864e0b253c4c5b454e
4
+ data.tar.gz: e85afab2e046724e7dcb7811f7e896a6cd3d870c
5
5
  SHA512:
6
- metadata.gz: f164b39e121324149aeaed39a83f42012fd46e75cca118da23af01ac9d0f071cfbb4d59e3d75e5daed2ca3834cae078c37e5754d7912e47167f498f5ac86feac
7
- data.tar.gz: dbd43c7a4726415440e8c7871c9fcd9ea946a87471798001becd1fc4999e68b17145c13a678231020c59693f1c974033b6aa3839e3bdc39d5e70fce454baa35c
6
+ metadata.gz: 781ce3f2f9274df3598f41f3574efe210ee30e5eaf7aaea2905c96d9bcfd5c9ac1e00edf78802a324868c95c1b151e408e8dd4d43d97ca46010dc3640c3c1a1f
7
+ data.tar.gz: dd0c7c85f276cb15a7f34dfbfad715281b3bd68e0f95cc339a09f4774e40f3a115aa0c1e1b4d8169979ae2421fbd10ff0790356e78e24d58746032672da09747
@@ -1 +1 @@
1
- ruby-2.1.0
1
+ 2.1.2
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.2
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.7 (unreleased)
4
+
5
+ ### features
6
+
7
+ ### improvements
8
+
9
+ ### bug fixes
10
+
11
+ ## 0.0.6 (April 8, 2015)
12
+
13
+ ### features
14
+ - Add option to skip spec on deploy to production with SKIP_SPEC environment variable
15
+ - Tells deploy to skip backup trough SKIP_BACKUP env var
16
+
17
+ ### improvements
18
+ - Remove jumpup:coverage_verify from README. Not required on jumpup 0.0.6
19
+ - Swap the order of `jumpup:finish` and `jumpup:heroku:finish` tasks on README.
20
+
21
+ ### bug fixes
22
+ - Ensure user has logged in to heroku before proceeding with integration [[GH-48](https://github.com/Helabs/jumpup-heroku/issues/48)]
23
+ - Set RSpec version on runtime dependency
24
+ - Use new syntax for pg:backups [[GH-72](https://github.com/Helabs/jumpup-heroku/issues/72)]
25
+
3
26
  ## 0.0.5 (March 31, 2014)
4
27
 
5
28
  ### features
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Mauro George
1
+ Copyright (c) 2013-2014 HE:labs
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Jumpup-heroku
2
2
  [![RubyGems][gem_version_badge]][ruby_gems]
3
+ [![Code Climate](https://codeclimate.com/github/Helabs/jumpup-heroku.png)](https://codeclimate.com/github/Helabs/jumpup-heroku)
4
+ [![Dependency Status](https://gemnasium.com/Helabs/jumpup-heroku.svg)](https://gemnasium.com/Helabs/jumpup-heroku)
5
+ [![Build Status](https://travis-ci.org/Helabs/jumpup-heroku.svg?branch=master)](https://travis-ci.org/Helabs/jumpup-heroku)
3
6
 
4
7
  Rake tasks to deploy any Rails application on [Heroku](http://heroku.com) using [Jumpup](https://github.com/Helabs/jumpup).
5
8
 
@@ -35,9 +38,8 @@ Without groups on Gemfile, because of initializer.
35
38
  jumpup:bundle_install
36
39
  db:migrate
37
40
  spec
38
- jumpup:coverage_verify
39
- jumpup:finish
40
41
  jumpup:heroku:finish
42
+ jumpup:finish
41
43
  )
42
44
  ```
43
45
 
@@ -108,6 +110,13 @@ $ git push -u origin production
108
110
 
109
111
  And send to Heroku with ```rake jumpup:heroku:deploy:production``` or as an alias ```rake integrate:production```
110
112
 
113
+ #### Need to skip spec on integrate to production?
114
+
115
+ Set the environment variable SKIP_SPEC=1 before integrating to production.
116
+
117
+ ```SKIP_SPEC=1 rake integrate:production```
118
+
119
+
111
120
  ## Versioning
112
121
 
113
122
  Jumpup-heroku follow the [Semantic Versioning](http://semver.org/).
@@ -122,7 +131,8 @@ Please see [CONTRIBUTING.md](https://github.com/Helabs/jumpup-heroku/blob/master
122
131
 
123
132
  ## Maintainers
124
133
 
125
- - [Thiago Belem](https://github.com/TiuTalk)
134
+ - [Marcio Junior](https://github.com/marcioj)
135
+ - [Tomás Augusto Müller](https://github.com/tomasmuller)
126
136
 
127
137
  ## Release
128
138
 
@@ -146,3 +156,10 @@ Jumpup-heroku is Copyright © 2013-2014 HE:labs. It is free software, and may be
146
156
 
147
157
  [gem_version_badge]: https://badge.fury.io/rb/jumpup-heroku.png
148
158
  [ruby_gems]: http://rubygems.org/gems/jumpup-heroku
159
+
160
+
161
+ ## Made with love by HE:labs
162
+
163
+ ![HE:labs](http://helabs.com.br/images/logo.png)
164
+
165
+ This gem was created and is maintained by [HE:labs](https://github.com/Helabs).
data/Rakefile CHANGED
@@ -1,14 +1,8 @@
1
- require "bundler/gem_tasks"
2
-
3
- require 'rspec/core'
1
+ require 'bundler/gem_tasks'
4
2
  require 'rspec/core/rake_task'
5
- RSpec::Core::RakeTask.new(:spec) do |spec|
6
- spec.pattern = FileList['spec/**/*_spec.rb']
7
- end
8
3
 
9
- RSpec::Core::RakeTask.new(:rcov) do |spec|
10
- spec.pattern = 'spec/**/*_spec.rb'
11
- spec.rcov = true
4
+ RSpec::Core::RakeTask.new do |t|
5
+ t.pattern = 'spec/**/*_spec.rb'
12
6
  end
13
7
 
14
- task :default => :spec
8
+ task default: :spec
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec"
24
- spec.add_development_dependency "pry", "0.9.12.4"
23
+ spec.add_development_dependency "rspec", "3.1.0"
24
+ spec.add_development_dependency "pry", "0.10.1"
25
25
  end
@@ -1,3 +1,5 @@
1
+ require 'pathname'
2
+
1
3
  module Jumpup
2
4
  module Heroku
3
5
 
@@ -29,26 +31,12 @@ module Jumpup
29
31
  end
30
32
 
31
33
  def self.check
32
- message = "Checking if there's already someone integrating to #{integrate.app}"
34
+ message = "Checking if you can integrate to #{integrate.app}"
33
35
  integrate.when_branch_send_to_heroku(message) do
34
36
  integrate.check
35
37
  end
36
38
  end
37
39
 
38
- def self.lock
39
- message = "Locking Heroku integration on app #{integrate.app}"
40
- integrate.when_branch_send_to_heroku(message) do
41
- integrate.lock
42
- end
43
- end
44
-
45
- def self.unlock
46
- message = "Unlocking Heroku integration on app #{integrate.app}"
47
- integrate.when_branch_send_to_heroku(message) do
48
- integrate.unlock
49
- end
50
- end
51
-
52
40
  def self.integrate
53
41
  envs = Env.all
54
42
  app = envs[:app] || envs[:staging_app]
@@ -74,33 +62,27 @@ module Jumpup
74
62
  end
75
63
 
76
64
  def deploy
77
- if run_database_tasks?
78
- check_if_migration_is_needed
79
- check_if_seed_is_needed
80
- end
65
+ run_database_checks if run_database_tasks?
81
66
 
82
- backup
67
+ backup if run_database_tasks? and !skip_backup?
83
68
  push(Env.all[:deploy_branch])
84
- migrate
85
- seed
69
+ migrate if run_database_tasks?
70
+ seed if run_database_tasks?
86
71
  restart
87
72
  end
88
73
 
89
74
  def deploy_to_production
90
- if run_database_tasks?
91
- check_if_migration_is_needed
92
- check_if_seed_is_needed
93
- end
75
+ run_database_checks if run_database_tasks?
94
76
 
95
77
  confirm_deploy
96
- spec
78
+ spec unless skip_spec?
97
79
  confirm_maintenance
98
80
  maintenance
99
- backup
81
+ backup if run_database_tasks? and !skip_backup?
100
82
  tag
101
83
  push(Env.all[:deploy_to_production_branch])
102
- migrate
103
- seed
84
+ migrate if run_database_tasks?
85
+ seed if run_database_tasks?
104
86
  close_maintenance
105
87
  restart
106
88
  end
@@ -111,25 +93,23 @@ module Jumpup
111
93
  end
112
94
 
113
95
  def check
114
- return if can_start_integration?(user)
115
- puts "----> Project is already being integrated by '#{integrating_by}', halting"
116
- exit 1
117
- end
118
-
119
- def lock
120
- return if integrating_by?(user)
121
-
122
- puts "----> Locking Heroku integration for you (#{user})"
123
- exec_with_clean_env("heroku config:set INTEGRATING_BY='#{user}' --app #{app}")
124
- end
125
-
126
- def unlock
127
- exec_with_clean_env("heroku config:unset INTEGRATING_BY --app #{app}")
96
+ unless authenticated_on_heroku?
97
+ puts "----> You haven't logged in to heroku, please run `heroku login`"
98
+ exit 1
99
+ end
128
100
  end
129
101
 
130
102
  private
131
103
  attr_reader :envs, :maintenance_mode
132
104
 
105
+ def skip_spec?
106
+ ENV['SKIP_SPEC']
107
+ end
108
+
109
+ def skip_backup?
110
+ ENV['SKIP_BACKUP']
111
+ end
112
+
133
113
  def check_if_migration_is_needed
134
114
  files_changed = run_with_clean_env("git diff HEAD #{latest_remote_sha} --name-only -- db/migrate | wc -l").strip.to_i
135
115
  @migrations_changed = files_changed > 0
@@ -144,16 +124,11 @@ module Jumpup
144
124
  @latest_remote_sha ||= run_with_clean_env("git ls-remote git@heroku.com:#{app}.git HEAD 2>/dev/null | awk '{ print $1 }'").strip
145
125
  end
146
126
 
147
- def can_start_integration?(user)
148
- integrating_by.blank? || integrating_by?(user)
149
- end
150
-
151
- def integrating_by?(user)
152
- integrating_by == user
153
- end
154
-
155
- def integrating_by
156
- @integrating_by ||= run_with_clean_env("heroku config:get INTEGRATING_BY --app #{app}").strip
127
+ def authenticated_on_heroku?
128
+ netrc = Pathname("#{ENV['HOME']}/.netrc").expand_path
129
+ if netrc.readable?
130
+ netrc.read =~ /^machine api\.heroku\.com/
131
+ end
157
132
  end
158
133
 
159
134
  def user
@@ -191,40 +166,35 @@ module Jumpup
191
166
  end
192
167
 
193
168
  def backup
194
- return unless run_database_tasks?
195
- puts "----> [#{app}] Backing up database"
196
- exec_with_clean_env("heroku pgbackups:capture --expire --app #{app}")
169
+ output "Backing up database"
170
+ exec_with_clean_env("heroku pg:backups capture --app #{app}")
197
171
  end
198
172
 
199
173
  def migrate
200
- return unless run_database_tasks?
201
-
202
174
  if @migrations_changed
203
- puts "----> [#{app}] Migrating"
175
+ output "Migrating"
204
176
  exec_with_clean_env("heroku run rake db:migrate --app #{app}")
205
177
  else
206
- puts "----> [#{app}] Skipping migrations"
178
+ output "Skipping migrations"
207
179
  end
208
180
  end
209
181
 
210
182
  def seed
211
- return unless run_database_tasks?
212
-
213
183
  if @seeds_changed
214
- puts "----> [#{app}] Seeding"
184
+ output "Seeding"
215
185
  exec_with_clean_env("heroku run rake db:seed --app #{app}")
216
186
  else
217
- puts "----> [#{app}] Skipping seeds"
187
+ output "Skipping seeds"
218
188
  end
219
189
  end
220
190
 
221
191
  def restart
222
- puts "----> [#{app}] Restarting"
192
+ output "Restarting"
223
193
  exec_with_clean_env("heroku restart --app #{app}")
224
194
  end
225
195
 
226
196
  def push(branch)
227
- puts "----> [#{app}] Pushing to #{host} from branch [#{branch}]"
197
+ output "Pushing to #{host} from branch [#{branch}]"
228
198
  exec_with_clean_env("git push git@#{host}:#{app}.git #{branch}:master")
229
199
  end
230
200
 
@@ -248,10 +218,10 @@ module Jumpup
248
218
 
249
219
  def maintenance
250
220
  if maintenance?
251
- puts "----> [#{app}] Setting Maintenance on"
221
+ output "Setting Maintenance on"
252
222
  exec_with_clean_env("heroku maintenance:on --app #{app}")
253
223
  restart
254
- puts "----> [#{app}] Waiting 20 seconds to app come back (in maintenance mode)"
224
+ output "Waiting 20 seconds to app come back (in maintenance mode)"
255
225
  sleep(20)
256
226
  end
257
227
  end
@@ -281,6 +251,15 @@ module Jumpup
281
251
  def actual_branch
282
252
  run_with_clean_env("git rev-parse --abbrev-ref HEAD").strip
283
253
  end
254
+
255
+ def output(message)
256
+ puts "----> [#{app}] #{message}"
257
+ end
258
+
259
+ def run_database_checks
260
+ check_if_migration_is_needed
261
+ check_if_seed_is_needed
262
+ end
284
263
  end
285
264
  end
286
265
  end
@@ -1,5 +1,5 @@
1
1
  module Jumpup
2
2
  module Heroku
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
5
5
  end
@@ -1,8 +1,8 @@
1
1
  namespace :jumpup do
2
2
  namespace :heroku do
3
3
 
4
- task :start => ["add_remote", "check", "lock"]
5
- task :finish => ["deploy", "unlock"]
4
+ task :start => ["add_remote", "check"]
5
+ task :finish => ["deploy"]
6
6
 
7
7
  desc "Add Heroku git remotes"
8
8
  task add_remote: :environment do
@@ -14,16 +14,6 @@ namespace :jumpup do
14
14
  Jumpup::Heroku::Integrate.check
15
15
  end
16
16
 
17
- desc "Lock the Heroku integration"
18
- task lock: :environment do
19
- Jumpup::Heroku::Integrate.lock
20
- end
21
-
22
- desc "Unlock the Heroku integration"
23
- task unlock: :environment do
24
- Jumpup::Heroku::Integrate.unlock
25
- end
26
-
27
17
  desc "Deploy to heroku"
28
18
  task deploy: :environment do
29
19
  Jumpup::Heroku::Integrate.deploy
@@ -15,17 +15,15 @@ describe Jumpup::Heroku::Configuration do
15
15
  end
16
16
  end
17
17
 
18
- subject do
19
- Jumpup::Heroku.configuration
20
- end
21
-
22
- its(:app) { should be_nil }
23
- its(:staging_app) { should be_nil }
24
- its(:production_app) { should be_nil }
25
- its(:run_database_tasks) { should be_true }
26
- its(:host) { should == 'heroku.com' }
27
- its(:deploy_branch) { should eq('master') }
28
- its(:deploy_to_production_branch) { should eq('master') }
18
+ subject { Jumpup::Heroku.configuration }
19
+
20
+ it { expect(subject.app).to be_nil }
21
+ it { expect(subject.staging_app).to be_nil }
22
+ it { expect(subject.production_app).to be_nil }
23
+ it { expect(subject.run_database_tasks).to be_truthy }
24
+ it { expect(subject.host).to eq('heroku.com') }
25
+ it { expect(subject.deploy_branch).to eq('master') }
26
+ it { expect(subject.deploy_to_production_branch).to eq('master') }
29
27
  end
30
28
 
31
29
  describe "with configurations" do
@@ -40,24 +38,22 @@ describe Jumpup::Heroku::Configuration do
40
38
  end
41
39
  end
42
40
 
43
- subject do
44
- Jumpup::Heroku.configuration
45
- end
41
+ subject { Jumpup::Heroku.configuration }
46
42
 
47
- its(:app) { should eq('myapp') }
48
- its(:staging_app) { should eq('myapp-staging')}
49
- its(:production_app) { should eq('myapp-production') }
50
- its(:run_database_tasks) { should be_false }
51
- its(:host) { should eq('myhost.com') }
52
- its(:deploy_branch) { should eq('master') }
53
- its(:deploy_to_production_branch) { should eq('production') }
43
+ it { expect(subject.app).to eq('myapp') }
44
+ it { expect(subject.staging_app).to eq('myapp-staging')}
45
+ it { expect(subject.production_app).to eq('myapp-production') }
46
+ it { expect(subject.run_database_tasks).to be_falsey }
47
+ it { expect(subject.host).to eq('myhost.com') }
48
+ it { expect(subject.deploy_branch).to eq('master') }
49
+ it { expect(subject.deploy_to_production_branch).to eq('production') }
54
50
  end
55
51
 
56
52
  describe "with multiple accounts" do
57
53
 
58
54
  context "first account" do
59
55
 
60
- before { ENV.stub(:[]).with("HEROKU_ACCOUNT").and_return("first") }
56
+ before { allow(ENV).to receive(:[]).with("HEROKU_ACCOUNT").and_return("first") }
61
57
  before do
62
58
  Jumpup::Heroku.configure do |config|
63
59
  config.app = 'myapp'
@@ -73,21 +69,19 @@ describe Jumpup::Heroku::Configuration do
73
69
  end
74
70
  end
75
71
 
76
- subject do
77
- Jumpup::Heroku.configuration
78
- end
72
+ subject { Jumpup::Heroku.configuration }
79
73
 
80
- its(:valid?) { should be_true }
81
- its(:app) { should be_nil }
82
- its(:staging_app) { should eq('myapp1-staging')}
83
- its(:production_app) { should eq('myapp1-production') }
84
- its(:run_database_tasks) { should be_false }
85
- its(:host) { should eq('heroku.first') }
74
+ it { expect(subject.valid?).to be_truthy }
75
+ it { expect(subject.app).to be_nil }
76
+ it { expect(subject.staging_app).to eq('myapp1-staging')}
77
+ it { expect(subject.production_app).to eq('myapp1-production') }
78
+ it { expect(subject.run_database_tasks).to be_falsey }
79
+ it { expect(subject.host).to eq('heroku.first') }
86
80
  end
87
81
 
88
82
  context "second account with default values" do
89
83
 
90
- before { ENV.stub(:[]).with("HEROKU_ACCOUNT").and_return("second") }
84
+ before { allow(ENV).to receive(:[]).with("HEROKU_ACCOUNT").and_return("second") }
91
85
  before do
92
86
  Jumpup::Heroku.configure do |config|
93
87
  config.production_app = 'myapp1-production'
@@ -102,21 +96,19 @@ describe Jumpup::Heroku::Configuration do
102
96
  end
103
97
  end
104
98
 
105
- subject do
106
- Jumpup::Heroku.configuration
107
- end
99
+ subject { Jumpup::Heroku.configuration }
108
100
 
109
- its(:valid?) { should be_true }
110
- its(:app) { should be_nil }
111
- its(:staging_app) { should eq('myapp2-staging')}
112
- its(:production_app) { should eq('myapp2-production') }
113
- its(:run_database_tasks) { should be_false }
114
- its(:host) { should eq('mysecondhost.com') }
101
+ it { expect(subject.valid?).to be_truthy }
102
+ it { expect(subject.app).to be_nil }
103
+ it { expect(subject.staging_app).to eq('myapp2-staging')}
104
+ it { expect(subject.production_app).to eq('myapp2-production') }
105
+ it { expect(subject.run_database_tasks).to be_falsey }
106
+ it { expect(subject.host).to eq('mysecondhost.com') }
115
107
  end
116
108
 
117
109
  context "other account" do
118
110
 
119
- before { ENV.stub(:[]).with("HEROKU_ACCOUNT").and_return("third") }
111
+ before { allow(ENV).to receive(:[]).with("HEROKU_ACCOUNT").and_return("third") }
120
112
  before do
121
113
  Jumpup::Heroku.configure do |config|
122
114
  config.account(:first) do |first|
@@ -133,20 +125,18 @@ describe Jumpup::Heroku::Configuration do
133
125
  end
134
126
  end
135
127
 
136
- subject do
137
- Jumpup::Heroku.configuration
138
- end
128
+ subject { Jumpup::Heroku.configuration }
139
129
 
140
- its(:valid?) { should be_false }
141
- its(:app) { should be_nil }
142
- its(:staging_app) { should be_nil }
143
- its(:production_app) { should be_nil }
144
- its(:run_database_tasks) { should be_false }
145
- its(:host) { should eq('heroku.com') }
130
+ it { expect(subject.valid?).to be_falsey }
131
+ it { expect(subject.app).to be_nil }
132
+ it { expect(subject.staging_app).to be_nil }
133
+ it { expect(subject.production_app).to be_nil }
134
+ it { expect(subject.run_database_tasks).to be_falsey }
135
+ it { expect(subject.host).to eq('heroku.com') }
146
136
  end
147
137
 
148
138
  context "without heroku accounts installed" do
149
- before { Jumpup::Heroku::Configuration.any_instance.stub(:current_account).and_return(:"") }
139
+ before { allow_any_instance_of(Jumpup::Heroku::Configuration).to receive(:current_account).and_return(:"") }
150
140
  before do
151
141
  Jumpup::Heroku.configure do |config|
152
142
  config.account(:second) do |second|
@@ -158,20 +148,18 @@ describe Jumpup::Heroku::Configuration do
158
148
  end
159
149
  end
160
150
 
161
- subject do
162
- Jumpup::Heroku.configuration
163
- end
151
+ subject { Jumpup::Heroku.configuration }
164
152
 
165
- its(:valid?) { should be_false }
166
- its(:app) { should be_nil }
167
- its(:staging_app) { should be_nil }
168
- its(:production_app) { should be_nil }
169
- its(:run_database_tasks) { should be_true }
170
- its(:host) { should eq('heroku.com') }
153
+ it { expect(subject.valid?).to be_falsey }
154
+ it { expect(subject.app).to be_nil }
155
+ it { expect(subject.staging_app).to be_nil }
156
+ it { expect(subject.production_app).to be_nil }
157
+ it { expect(subject.run_database_tasks).to be_truthy }
158
+ it { expect(subject.host).to eq('heroku.com') }
171
159
  end
172
160
 
173
- context "without herou accounts installed and default values" do
174
- before { Jumpup::Heroku::Configuration.any_instance.stub(:current_account).and_return(:"") }
161
+ context "without heroku accounts installed and default values" do
162
+ before { allow_any_instance_of(Jumpup::Heroku::Configuration).to receive(:current_account).and_return(:"") }
175
163
  before do
176
164
  Jumpup::Heroku.configure do |config|
177
165
  config.production_app = 'myapp1-production'
@@ -185,15 +173,13 @@ describe Jumpup::Heroku::Configuration do
185
173
  end
186
174
  end
187
175
 
188
- subject do
189
- Jumpup::Heroku.configuration
190
- end
176
+ subject { Jumpup::Heroku.configuration }
191
177
 
192
- its(:valid?) { should be_true }
193
- its(:app) { should be_nil }
194
- its(:staging_app) { should eq('myapp1-staging')}
195
- its(:production_app) { should eq('myapp1-production') }
196
- its(:run_database_tasks) { should be_true }
178
+ it { expect(subject.valid?).to be_truthy }
179
+ it { expect(subject.app).to be_nil }
180
+ it { expect(subject.staging_app).to eq('myapp1-staging')}
181
+ it { expect(subject.production_app).to eq('myapp1-production') }
182
+ it { expect(subject.run_database_tasks).to be_truthy }
197
183
  end
198
184
  end
199
185
  end
@@ -363,7 +349,7 @@ describe Jumpup::Heroku::Configuration do
363
349
  end
364
350
 
365
351
  it 'not be valid' do
366
- pending "The bug is raised when have no config/initialier/heroku-deploy.rb file"
352
+ skip "The bug is raised when have no config/initializer/heroku-deploy.rb file"
367
353
  expect(Jumpup::Heroku.configuration).to_not be_valid
368
354
  end
369
355
  end
@@ -0,0 +1,101 @@
1
+ require 'spec_helper'
2
+
3
+ describe Jumpup::Heroku::Integrate do
4
+ before do
5
+ Jumpup::Heroku.configuration = nil
6
+ end
7
+
8
+ describe '#deploy_to_production' do
9
+ before do
10
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:run_database_checks)
11
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:confirm_deploy)
12
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:spec)
13
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:confirm_maintenance)
14
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:maintenance)
15
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:backup)
16
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:tag)
17
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:push)
18
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:migrate)
19
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:seed)
20
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:close_maintenance)
21
+ allow_any_instance_of(Jumpup::Heroku::Integrate).to receive(:restart)
22
+
23
+ Jumpup::Heroku.configure do |config|
24
+ config.app = 'myapp'
25
+ config.run_database_tasks = false
26
+ end
27
+ end
28
+
29
+ subject { Jumpup::Heroku::Integrate.new(double(:app)) }
30
+
31
+ context 'with database tasks disabled' do
32
+
33
+ %I(confirm_deploy spec confirm_maintenance maintenance tag push close_maintenance restart).each do |task|
34
+ it "runs #{task}" do
35
+ expect_any_instance_of(Jumpup::Heroku::Integrate).to receive(task)
36
+
37
+ subject.deploy_to_production
38
+ end
39
+ end
40
+
41
+ %I(run_database_checks backup migrate seed).each do |task|
42
+ it "#does not run #{task}" do
43
+ expect_any_instance_of(Jumpup::Heroku::Integrate).to_not receive(task)
44
+
45
+ subject.deploy_to_production
46
+ end
47
+ end
48
+ end
49
+
50
+ context 'with database migrations' do
51
+ before do
52
+ Jumpup::Heroku.configure do |config|
53
+ config.app = 'myapp'
54
+ config.run_database_tasks = true
55
+ end
56
+ end
57
+
58
+ %I(run_database_checks backup migrate seed).each do |task|
59
+ it "runs #{task}" do
60
+ expect_any_instance_of(Jumpup::Heroku::Integrate).to receive(task)
61
+
62
+ subject.deploy_to_production
63
+ end
64
+ end
65
+ end
66
+
67
+ describe 'skipping steps' do
68
+ before { allow(ENV).to receive(:[]) }
69
+ after { subject.deploy_to_production }
70
+
71
+ context 'skip spec' do
72
+ context 'present' do
73
+ before { allow(ENV).to receive(:[]).with('SKIP_SPEC').and_return('1') }
74
+ it { expect_any_instance_of(Jumpup::Heroku::Integrate).to_not receive(:spec) }
75
+ end
76
+ context 'not set' do
77
+ before { allow(ENV).to receive(:[]).with('SKIP_SPEC').and_return(nil) }
78
+ it { expect_any_instance_of(Jumpup::Heroku::Integrate).to receive(:spec) }
79
+ end
80
+ end
81
+
82
+ describe 'skip backup' do
83
+ before do
84
+ Jumpup::Heroku.configure do |config|
85
+ config.app = 'myapp'
86
+ config.run_database_tasks = true
87
+ end
88
+ end
89
+ context 'present' do
90
+ before { allow(ENV).to receive(:[]).with('SKIP_BACKUP').and_return('1') }
91
+ it { expect_any_instance_of(Jumpup::Heroku::Integrate).to_not receive(:backup) }
92
+ end
93
+ context 'not set' do
94
+ before { allow(ENV).to receive(:[]).with('SKIP_BACKUP').and_return(nil) }
95
+ it { expect_any_instance_of(Jumpup::Heroku::Integrate).to receive(:backup) }
96
+ end
97
+ end
98
+ end
99
+
100
+ end
101
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jumpup-heroku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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-03-31 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 3.1.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
- version: '0'
54
+ version: 3.1.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.9.12.4
61
+ version: 0.10.1
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
- version: 0.9.12.4
68
+ version: 0.10.1
69
69
  description: Rake tasks to deploy on heroku
70
70
  email:
71
71
  - tech@helabs.com.br
@@ -76,6 +76,7 @@ files:
76
76
  - ".gitignore"
77
77
  - ".ruby-gemset"
78
78
  - ".ruby-version"
79
+ - ".travis.yml"
79
80
  - CHANGELOG.md
80
81
  - CONTRIBUTING.md
81
82
  - Gemfile
@@ -92,6 +93,7 @@ files:
92
93
  - lib/tasks/integrate.rake
93
94
  - spec/jumpup/heroku/configuration_spec.rb
94
95
  - spec/jumpup/heroku/env_spec.rb
96
+ - spec/jumpup/heroku/integrate_spec.rb
95
97
  - spec/spec_helper.rb
96
98
  homepage: https://github.com/Helabs/jumpup-heroku
97
99
  licenses:
@@ -120,4 +122,5 @@ summary: Rake tasks to deploy on heroku
120
122
  test_files:
121
123
  - spec/jumpup/heroku/configuration_spec.rb
122
124
  - spec/jumpup/heroku/env_spec.rb
125
+ - spec/jumpup/heroku/integrate_spec.rb
123
126
  - spec/spec_helper.rb