paratrooper 2.4.0 → 2.4.1

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: af4cf12a15977e47b772161b7acb99494f710126
4
- data.tar.gz: 01d567099249dafbbb418a3f6882265222ed1b03
3
+ metadata.gz: 56e1f38d2b16ea6a3a7ea3f638ca46299dbb593d
4
+ data.tar.gz: 52ca5fd168124dffdec952b953e56bbbeac73479
5
5
  SHA512:
6
- metadata.gz: 8c3a3302dbf94762959b00613c4ae66a58978460d40ebbff6cbac49907cd6dc20c81cb5e4af0a2f3f2c4c446c4d7250b99329e90ac67f77b5e9215754a94299f
7
- data.tar.gz: 8d2a914587895cd37dedaaa5e7c4bf32e76aea5658d091f227839c5685891365c41f8074dca1fda214582a461953fce09b6b579498603ad7ddb60a1548257104
6
+ metadata.gz: 5363c5346e761369f59b7d1dc57568dd0a18f6bc47f9125d7a4b898111e82153fd4aba5fe20005d3f6a1502ce9906d48cd99241a8bb8de51bf490a159e1251c7
7
+ data.tar.gz: c3ed3e7e73606aca077b6264a2313863f66dacdca8b5428c1d085072f130d25fda734f1323e420cb56f3cd3487b7b4d3124b13f539e2c15942aa394d975508ad
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.4.1
4
+
5
+ - Fix Deploy#app_url for wildcard domains
6
+
3
7
  ## 2.4.0
4
8
 
5
9
  - Maintenance mode only runs around migrations now
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/paratrooper.png)](http://badge.fury.io/rb/paratrooper)
4
4
  [![Build Status](https://travis-ci.org/mattpolito/paratrooper.png?branch=master)](https://travis-ci.org/mattpolito/paratrooper)
5
5
  [![Code Climate](https://codeclimate.com/github/mattpolito/paratrooper.png)](https://codeclimate.com/github/mattpolito/paratrooper)
6
+ [![Gitter chat](https://badges.gitter.im/mattpolito/paratrooper.png)](https://gitter.im/mattpolito/paratrooper)
6
7
 
7
8
  Simplify your [Heroku][] deploy with quick and concise deployment rake tasks.
8
9
 
@@ -131,12 +132,10 @@ You can use the object's methods any way you'd like, but we've provided a sensib
131
132
 
132
133
  This will perform the following tasks:
133
134
 
134
- * Activate maintenance mode
135
135
  * Create or update a git tag (if provided)
136
136
  * Push changes to Heroku
137
137
  * Run database migrations if any have been added to db/migrate
138
138
  * Restart the application
139
- * Deactivate maintenance mode
140
139
  * Warm application instance
141
140
 
142
141
  ### Example Usage
@@ -213,7 +212,7 @@ namespace :deploy do
213
212
  end
214
213
  ```
215
214
 
216
- Or maybe you just want to run a rake task on your application
215
+ Or maybe you just want to run a rake task on your application. Since this task may take a moment to complete it's probably a good idea to throw up a maintenance page.
217
216
 
218
217
  ```ruby
219
218
  # lib/tasks/deploy.rake
@@ -222,6 +221,7 @@ namespace :deploy do
222
221
  desc 'Deploy app in production environment'
223
222
  task :production do
224
223
  deployment = Paratrooper::Deploy.new("amazing-production-app") do |deploy|
224
+ deploy.maintenance = true
225
225
  deploy.add_callback(:after_teardown) do |output|
226
226
  output.display("Running some task that needs to run")
227
227
  deploy.add_remote_task("rake some:task:to:run")
@@ -14,7 +14,7 @@ module Paratrooper
14
14
 
15
15
  attr_accessor :app_name, :notifiers, :system_caller, :heroku, :tag_name,
16
16
  :match_tag_name, :protocol, :deployment_host, :migration_check, :debug,
17
- :screen_notifier, :branch_name, :http_client
17
+ :screen_notifier, :branch_name, :http_client, :maintenance
18
18
 
19
19
  alias_method :tag=, :tag_name=
20
20
  alias_method :match_tag=, :match_tag_name=
@@ -46,6 +46,9 @@ module Paratrooper
46
46
  # (optional, default: 'heroku.com').
47
47
  # :migration_check - Object responsible for checking pending
48
48
  # migrations (optional).
49
+ # :maintenance - If true, show maintenance page when pending
50
+ # migrations exists. False by default (optional).
51
+ # migrations (optional).
49
52
  # :api_key - String version of heroku api key.
50
53
  # (default: looks in local Netrc file).
51
54
  # :http_client - Object responsible for making http calls
@@ -65,6 +68,7 @@ module Paratrooper
65
68
  @debug = options[:debug] || false
66
69
  @migration_check = options[:migration_check] || PendingMigrationCheck.new(match_tag_name, heroku, system_caller)
67
70
  @http_client = options[:http_client] || HttpClientWrapper.new
71
+ @maintenance = options[:maintenance] || false
68
72
 
69
73
  block.call(self) if block_given?
70
74
  end
@@ -89,7 +93,7 @@ module Paratrooper
89
93
  # Public: Activates Heroku maintenance mode.
90
94
  #
91
95
  def activate_maintenance_mode
92
- return unless pending_migrations?
96
+ return unless maintenance && pending_migrations?
93
97
  callback(:activate_maintenance_mode) do
94
98
  notify(:activate_maintenance_mode)
95
99
  heroku.app_maintenance_on
@@ -205,7 +209,7 @@ module Paratrooper
205
209
 
206
210
  private
207
211
  def app_url
208
- heroku.app_url
212
+ heroku.app_url.sub(/\A\*\./, 'www.')
209
213
  end
210
214
 
211
215
  def callback(name, &block)
@@ -1,3 +1,3 @@
1
1
  module Paratrooper
2
- VERSION = "2.4.0".freeze
2
+ VERSION = "2.4.1".freeze
3
3
  end
data/script/bootstrap ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ bundle install --quiet "$@"
data/script/test ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -e
4
+
5
+ echo "===> Bundling..."
6
+ script/bootstrap --quiet
7
+
8
+ echo "===> Running specs..."
9
+ bundle exec rspec
@@ -127,8 +127,8 @@ describe Paratrooper::Deploy do
127
127
  end
128
128
 
129
129
  describe "#activate_maintenance_mode" do
130
- context "when maintenance_mode option is 'true'" do
131
- let(:options) { { maintenance_mode: true } }
130
+ context "when maintenance option is 'true'" do
131
+ let(:options) { { maintenance: true } }
132
132
 
133
133
  context "with pending migrations" do
134
134
  before do
@@ -162,6 +162,42 @@ describe Paratrooper::Deploy do
162
162
  end
163
163
  end
164
164
  end
165
+
166
+ context "when maintenance option is false" do
167
+ let(:options) { { maintenance: false } }
168
+
169
+ before do
170
+ migration_check.stub(:migrations_waiting?).and_return(true)
171
+ end
172
+
173
+ it 'does not send notification' do
174
+ deployer.should_not_receive(:notify).with(:activate_maintenance_mode)
175
+ deployer.activate_maintenance_mode
176
+ end
177
+
178
+ it "does not make a call to heroku to turn on maintenance mode" do
179
+ heroku.should_not_receive(:app_maintenance_on)
180
+ deployer.activate_maintenance_mode
181
+ end
182
+ end
183
+
184
+ context "when maintenance option is left as default" do
185
+ let(:options) { { } }
186
+
187
+ before do
188
+ migration_check.stub(:migrations_waiting?).and_return(true)
189
+ end
190
+
191
+ it 'does not send notification' do
192
+ deployer.should_not_receive(:notify).with(:activate_maintenance_mode)
193
+ deployer.activate_maintenance_mode
194
+ end
195
+
196
+ it "does not make a call to heroku to turn on maintenance mode" do
197
+ heroku.should_not_receive(:app_maintenance_on)
198
+ deployer.activate_maintenance_mode
199
+ end
200
+ end
165
201
  end
166
202
 
167
203
  describe "#deactivate_maintenance_mode" do
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.4.0
4
+ version: 2.4.1
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-15 00:00:00.000000000 Z
12
+ date: 2014-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -138,6 +138,8 @@ files:
138
138
  - lib/paratrooper/system_caller.rb
139
139
  - lib/paratrooper/version.rb
140
140
  - paratrooper.gemspec
141
+ - script/bootstrap
142
+ - script/test
141
143
  - spec/fixtures/netrc
142
144
  - spec/paratrooper/deploy_spec.rb
143
145
  - spec/paratrooper/heroku_wrapper_spec.rb