turnout 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,13 +14,30 @@ Features
14
14
 
15
15
  Installation
16
16
  ============
17
- In your Gemfile add:
17
+ Rails 3
18
+ -------
19
+ In your `Gemfile` add:
18
20
 
19
21
  gem 'turnout'
20
22
 
21
23
  then run
22
24
 
23
25
  bundle install
26
+
27
+ Rails 2.3
28
+ ---------
29
+ In your `config/environment.rb` file add:
30
+
31
+ config.gem 'turnout'
32
+
33
+ then run
34
+
35
+ rake gems:install
36
+
37
+ then in your `Rakefile` add:
38
+
39
+ require 'turnout/rake_tasks'
40
+
24
41
 
25
42
  Activation
26
43
  ==========
@@ -1,6 +1,6 @@
1
1
  namespace :maintenance do
2
2
 
3
- desc 'Enable the maintenance mode page ("reason" and/or "allowed_ips" can be passed as environment variables)'
3
+ desc 'Enable the maintenance mode page ("reason", "allowed_paths" and "allowed_ips" can be passed as environment variables)'
4
4
  task :start do |t, args|
5
5
  settings = {
6
6
  'reason' => ENV['reason'],
@@ -28,10 +28,13 @@ namespace :maintenance do
28
28
  end
29
29
 
30
30
  def split_paths(paths_string)
31
- # used negative lookbehind to split on "," but not on "\,"
32
- paths = paths_string.to_s.split(/(?<!\\),\ ?/)
31
+ # I had this for 1.9.2 but no lookbehinds in 1.8.7 :(
32
+ #paths = paths_string.to_s.split(/(?<!\\),\ ?/)
33
+
34
+ # Grab everything between commas that aren't escaped with a backslash
35
+ paths = paths_string.to_s.scan(/(?:\\,|[^,])+/)
33
36
  paths.map! do |path|
34
- path.gsub('\,', ',') # remove the escape characters
37
+ path.strip.gsub('\,', ',') # remove the escape characters
35
38
  end
36
39
  paths
37
40
  end
@@ -1,3 +1,3 @@
1
1
  module Turnout
2
- require 'turnout/engine' if defined?(Rails)
2
+ require 'turnout/engine'
3
3
  end
@@ -1,12 +1,18 @@
1
1
  require 'turnout'
2
- require 'rails'
3
- require 'active_record'
4
2
  require 'rack/turnout'
3
+ require 'rails' unless defined? Rails
5
4
 
6
- module Turnout
7
- class Engine < Rails::Engine
8
- initializer 'turnout.add_to_middleware_stack' do |app|
9
- app.config.middleware.use Rack::Turnout
5
+ # For Rails 3
6
+ if defined? Rails::Engine
7
+
8
+ require 'active_record'
9
+
10
+ module Turnout
11
+ class Engine < Rails::Engine
12
+ initializer 'turnout.add_to_middleware_stack' do |app|
13
+ app.config.middleware.use Rack::Turnout
14
+ end
10
15
  end
11
16
  end
17
+
12
18
  end
@@ -0,0 +1,3 @@
1
+ # This is an include file for Rakefiles in Rails 2.3
2
+ # since rake tasks aren't included automatically in Rails 2.3 engines
3
+ Dir["#{Gem.searcher.find('turnout').full_gem_path}/lib/tasks/*.rake"].each { |ext| load ext }
@@ -1,5 +1,5 @@
1
1
  module Turnout
2
2
 
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
 
5
5
  end
@@ -0,0 +1,4 @@
1
+ # For Rails 2.3
2
+ unless defined? Rails::Engine
3
+ config.middleware.use 'Rack::Turnout'
4
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turnout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,20 +9,20 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-28 00:00:00.000000000 -07:00
12
+ date: 2011-07-29 00:00:00.000000000 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri
17
- requirement: &80903400 !ruby/object:Gem::Requirement
17
+ requirement: &72111600 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
- - - ! '>'
20
+ - - ~>
21
21
  - !ruby/object:Gem::Version
22
22
  version: '1.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *80903400
25
+ version_requirements: *72111600
26
26
  description: Turnout makes it easy to put your Rails application into maintenance
27
27
  mode
28
28
  email: adam.crownoble@biola.edu
@@ -32,9 +32,11 @@ extra_rdoc_files: []
32
32
  files:
33
33
  - README.markdown
34
34
  - MIT-LICENSE
35
+ - rails/init.rb
35
36
  - lib/turnout.rb
36
37
  - lib/rack/turnout.rb
37
38
  - lib/turnout/version.rb
39
+ - lib/turnout/rake_tasks.rb
38
40
  - lib/turnout/engine.rb
39
41
  - lib/tasks/maintenance.rake
40
42
  - public/maintenance.html