paratrooper 2.3.0 → 2.4.0

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: 74b8eb08a58894b414fa18f4606c28d484e33fe3
4
- data.tar.gz: 9748e2ca46f3dee5317501278f6b53c1fc57ffa0
3
+ metadata.gz: af4cf12a15977e47b772161b7acb99494f710126
4
+ data.tar.gz: 01d567099249dafbbb418a3f6882265222ed1b03
5
5
  SHA512:
6
- metadata.gz: 647ec0a0781443343560a2fcc0339d11da6d28c8c337775519461a84e811fecaea883c26edfb496eb3d7fd382ca2dab23f9bfc1973e59bb2da9fcc24cc30c314
7
- data.tar.gz: d0babc17feeab3f6a8350284057de3cffcd0e296ccc5c109f05b90ed9487e6b0656b353373c050fe7d4e0d516c4ec0da6ae9c3a63efe380180a13ff4139c8f67
6
+ metadata.gz: 8c3a3302dbf94762959b00613c4ae66a58978460d40ebbff6cbac49907cd6dc20c81cb5e4af0a2f3f2c4c446c4d7250b99329e90ac67f77b5e9215754a94299f
7
+ data.tar.gz: 8d2a914587895cd37dedaaa5e7c4bf32e76aea5658d091f227839c5685891365c41f8074dca1fda214582a461953fce09b6b579498603ad7ddb60a1548257104
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.0
4
+
5
+ - Maintenance mode only runs around migrations now
6
+ - README updates around maintenance_mode=
7
+
3
8
  ## 2.3.0
4
9
 
5
10
  - Http calls no longer being made from system cURL
data/README.md CHANGED
@@ -155,9 +155,8 @@ namespace :deploy do
155
155
  desc 'Deploy app in production environment'
156
156
  task :production do
157
157
  deployment = Paratrooper::Deploy.new("amazing-production-app") do |deploy|
158
- deploy.tag = 'production',
159
- deploy.match_tag = 'staging',
160
- deploy.maintenance_mode = !ENV['NO_MAINTENANCE']
158
+ deploy.tag = 'production'
159
+ deploy.match_tag = 'staging'
161
160
  end
162
161
 
163
162
  deployment.deploy
@@ -106,6 +106,12 @@ module Paratrooper
106
106
  end
107
107
  end
108
108
 
109
+ def maintenance_mode(&block)
110
+ activate_maintenance_mode
111
+ block.call if block_given?
112
+ deactivate_maintenance_mode
113
+ end
114
+
109
115
  # Public: Creates a git tag and pushes it to repository.
110
116
  #
111
117
  def update_repo_tag
@@ -178,12 +184,12 @@ module Paratrooper
178
184
  # Alias: #deploy
179
185
  def default_deploy
180
186
  setup
181
- activate_maintenance_mode
182
187
  update_repo_tag
183
188
  push_repo
184
- run_migrations
185
- app_restart
186
- deactivate_maintenance_mode
189
+ maintenance_mode do
190
+ run_migrations
191
+ app_restart
192
+ end
187
193
  warm_instance
188
194
  teardown
189
195
  end
@@ -11,13 +11,19 @@ module Paratrooper
11
11
  end
12
12
 
13
13
  def migrations_waiting?
14
- call = %Q[git diff --shortstat #{last_deployed_commit} #{match_tag_name} -- db/migrate]
15
- self.diff = system_caller.execute(call)
16
- !diff.strip.empty?
14
+ @migrations_waiting ||= check_for_pending_migrations
17
15
  end
18
16
 
19
17
  def last_deployed_commit
20
18
  @last_deploy_commit ||= heroku.last_deploy_commit
21
19
  end
20
+
21
+ private
22
+
23
+ def check_for_pending_migrations
24
+ call = %Q[git diff --shortstat #{last_deployed_commit} #{match_tag_name} -- db/migrate]
25
+ self.diff = system_caller.execute(call)
26
+ !diff.strip.empty?
27
+ end
22
28
  end
23
29
  end
@@ -1,3 +1,3 @@
1
1
  module Paratrooper
2
- VERSION = "2.3.0".freeze
2
+ VERSION = "2.4.0".freeze
3
3
  end
@@ -21,6 +21,11 @@ describe Paratrooper::PendingMigrationCheck do
21
21
  migration_check.migrations_waiting?
22
22
  end
23
23
 
24
+ it "memoizes the git diff" do
25
+ system_caller.should_receive(:execute).exactly(1).times.and_return("DIFF")
26
+ migration_check.migrations_waiting?
27
+ end
28
+
24
29
  context "and migrations are in diff" do
25
30
  it "returns true" do
26
31
  expected_call = %Q[git diff --shortstat LAST_DEPLOYED_COMMIT MATCH -- db/migrate]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paratrooper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Polito
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-03 00:00:00.000000000 Z
12
+ date: 2014-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake