turnout 2.4.1 → 2.5.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: 02f1d848eeb46276843d9e7a313c040c857888a8
4
- data.tar.gz: 8357c006e9a7d8a41d12e5fc06692abc821c7f54
3
+ metadata.gz: 28688f9c227f64ca86561cc5dcb53b9cb71448f8
4
+ data.tar.gz: 603319b24986962d1bc52602ab3246e518f6a664
5
5
  SHA512:
6
- metadata.gz: 0042d84e4989d168955ad234825783ae6621ba0c44182315b5f28e3cc810c68146d3f54405bd278981d1c37edb58f36e19938dc17ed0be1d4c86a1059469f483
7
- data.tar.gz: a37a682278fff4e3ba5115c1a1f848f6b6a475839891729ca2791101a2f0c96918f67b9e3658aee2aaddcc08e873ba3a17b317c7796be0a101e4cd6bb55b6795
6
+ metadata.gz: bde70a83589f2bb455fca464df8ec315ba72da60f2f89bac1aad6f35065f1966edcb1b71394f310ab4e7d89bd8354e67e9544894b8b290b617658d74eb25e9ac
7
+ data.tar.gz: 0a8de599aefd2a9570796893a36617defe67b1445d2d4f55221d8e68bdf499686f6df53782181eefe87572461bde2a6d3ddb5cfd2de34adf0dd07e791c315f5c
data/README.md CHANGED
@@ -111,6 +111,7 @@ Turnout can be configured in two different ways:
111
111
 
112
112
  ```ruby
113
113
  Turnout.configure do |config|
114
+ config.skip_middleware = true
114
115
  config.app_root = '/some/path'
115
116
  config.named_maintenance_file_paths = {app: 'tmp/app.yml', server: '/tmp/server.yml'}
116
117
  config.maintenance_pages_path = 'app/views/maintenance'
@@ -1,21 +1,33 @@
1
1
  require_relative './ordered_options'
2
2
  module Turnout
3
3
  class Configuration
4
- SETTINGS = [:app_root, :named_maintenance_file_paths,
5
- :maintenance_pages_path, :default_maintenance_page, :default_reason,
6
- :default_allowed_paths, :default_response_code, :default_retry_after, :i18n]
4
+ SETTINGS = [
5
+ :app_root,
6
+ :named_maintenance_file_paths,
7
+ :maintenance_pages_path,
8
+ :default_maintenance_page,
9
+ :default_reason,
10
+ :default_allowed_ips,
11
+ :skip_middleware,
12
+ :default_allowed_paths,
13
+ :default_response_code,
14
+ :default_retry_after,
15
+ :i18n
16
+ ].freeze
7
17
 
8
18
  SETTINGS.each do |setting|
9
19
  attr_accessor setting
10
20
  end
11
21
 
12
22
  def initialize
23
+ @skip_middleware = false
13
24
  @app_root = '.'
14
25
  @named_maintenance_file_paths = {default: app_root.join('tmp', 'maintenance.yml').to_s}
15
26
  @maintenance_pages_path = app_root.join('public').to_s
16
27
  @default_maintenance_page = Turnout::MaintenancePage::HTML
17
28
  @default_reason = "The site is temporarily down for maintenance.\nPlease check back soon."
18
29
  @default_allowed_paths = []
30
+ @default_allowed_ips = []
19
31
  @default_response_code = 503
20
32
  @default_retry_after = 7200 # 2 hours by default
21
33
  @i18n = Turnout::OrderedOptions.new
@@ -7,11 +7,9 @@ if defined? Rails::Engine
7
7
  module Turnout
8
8
  class Engine < Rails::Engine
9
9
  initializer 'turnout.add_to_middleware_stack' do |app|
10
- app.config.middleware.use Rack::Turnout
11
- end
12
-
13
- rake_tasks do
14
- load 'tasks/maintenance.rake'
10
+ unless Turnout.config.skip_middleware
11
+ app.config.middleware.use(Rack::Turnout)
12
+ end
15
13
  end
16
14
  end
17
15
  end
@@ -12,7 +12,7 @@ module Turnout
12
12
  @path = path
13
13
  @reason = Turnout.config.default_reason
14
14
  @allowed_paths = Turnout.config.default_allowed_paths
15
- @allowed_ips = []
15
+ @allowed_ips = Turnout.config.default_allowed_ips
16
16
  @response_code = Turnout.config.default_response_code
17
17
  @retry_after = Turnout.config.default_retry_after
18
18
 
@@ -1,3 +1,3 @@
1
1
  module Turnout
2
- VERSION = '2.4.1'
2
+ VERSION = '2.5.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turnout
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Crownoble
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-18 00:00:00.000000000 Z
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt
@@ -68,16 +68,22 @@ dependencies:
68
68
  name: i18n
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - "~>"
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0.7'
74
+ - - "<"
75
+ - !ruby/object:Gem::Version
76
+ version: '2'
74
77
  type: :runtime
75
78
  prerelease: false
76
79
  version_requirements: !ruby/object:Gem::Requirement
77
80
  requirements:
78
- - - "~>"
81
+ - - ">="
79
82
  - !ruby/object:Gem::Version
80
83
  version: '0.7'
84
+ - - "<"
85
+ - !ruby/object:Gem::Version
86
+ version: '2'
81
87
  - !ruby/object:Gem::Dependency
82
88
  name: rack-test
83
89
  requirement: !ruby/object:Gem::Requirement
@@ -209,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
215
  version: '0'
210
216
  requirements: []
211
217
  rubyforge_project:
212
- rubygems_version: 2.5.1
218
+ rubygems_version: 2.5.2
213
219
  signing_key:
214
220
  specification_version: 4
215
221
  summary: A Rack based maintenance mode plugin for Rails