rack-handlers 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b948f198ea6965d85bab269cff573e54a26eff8c
4
- data.tar.gz: 7299919d68aeac713af9eac1cd4194b4364da589
3
+ metadata.gz: e1f85445dc157422692fc335ec353709730565f5
4
+ data.tar.gz: 7dc71015543eeaf78efd5dbfdd762647d6a11e79
5
5
  SHA512:
6
- metadata.gz: 9ed4400b2673da4009faad8f9396354288cabbcc98fad1fb58c75e920b5e86c1ac6fb17201464fa3e39401e920c56b78c4fa57b29133f6001b3b8bb417f1137e
7
- data.tar.gz: 166cbd8a59431e6589aaa02885a3cada973d65ce796e789784231409abcdfc8b64f2a54519aadfe805b502dbaf8dac300cc7e3aa69e1f0e19be92ba7a1717842
6
+ metadata.gz: e37e57db9417a09ce77161e88b650e7f66814d2b3a8abc7e85462fc04903b4c2913bf3ee22eda593a4bcbab9fe179c06626e0e63e25e8f44e92a76779ecacda7
7
+ data.tar.gz: 79bd7d6685695cc3f1fe53760559bde8f7d87a7ee43ff2e9a452a5ba19d206a27868321ef69db0ec3c2e2f8b2d1e8d650cf4c2043c17bb952b8fc416d75977f7
data/CHANGES.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # CHANGES
2
2
 
3
+ ## rack-handlers 0.7.0 -- 2013-08-22
4
+
5
+ * Introduced rack-handlers.rb for you that patched `Rack::Handler.default`
6
+ with the following order: zbatery, rainbows, unicorn, puma, thin, webrick.
7
+ You would no longer need to require 'rack/handler/rails-server' in order to
8
+ make `rails s` work for unicorns.
9
+
3
10
  ## rack-handlers 0.6.1 -- 2013-07-11
4
11
 
5
12
  * Ditto.
data/README.md CHANGED
@@ -10,7 +10,7 @@ by Lin Jen-Shin ([godfat](http://godfat.org))
10
10
 
11
11
  ## DESCRIPTION:
12
12
 
13
- Some Rack handlers which are not included in Rack distribution.
13
+ Unicorn family Rack handlers for you. Mostly for `rails s`.
14
14
 
15
15
  ## REQUIREMENTS:
16
16
 
@@ -23,19 +23,30 @@ Some Rack handlers which are not included in Rack distribution.
23
23
 
24
24
  ## SYNOPSIS:
25
25
 
26
+ Put `'rack-handlers'` and your favorite unicorns into Gemfile
27
+ then you could do the followings:
28
+
26
29
  rails s unicorn
27
30
  rails s rainbows
28
31
  rails s zbatery
29
32
 
30
- Additionally, putting `require 'rack/handler/rails-server'` in `script/rails`
31
- *before* `require 'rails/commands'` would make `rails s` select the server
32
- by default with this order: zbatery, rainbows, unicorn, puma, and thin.
33
+ Because requiring `'rack-handlers'` would make `Rack::Handler.default`
34
+ pick the server with the following order:
35
+
36
+ * zbatery
37
+ * rainbows
38
+ * unicorn
39
+ * puma
40
+ * thin
41
+ * webrick
42
+
43
+ Thus if you have rainbows installed, `rails s` would launch the server with
44
+ rainbows instead of webrick (the original behaviour).
33
45
 
34
- For zbatery, rainbows, and unicorn, it would also try to load the config
35
- via `config/zbatery.rb`, or `config/rainbows.rb` depending on which server
36
- is selected.
46
+ Additionally, it would also try to load the config via `config/zbatery.rb`,
47
+ or `config/rainbows.rb` depending on which server is picked.
37
48
 
38
- For people who likes to invoke `rails s`!
49
+ For people who likes to run `rails s`!
39
50
 
40
51
  ## CONTRIBUTORS:
41
52
 
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ desc 'Generate gemspec'
8
8
  task 'gem:spec' do
9
9
  Gemgem.spec = Gemgem.create do |s|
10
10
  s.name = 'rack-handlers'
11
- s.version = '0.6.1'
11
+ s.version = '0.7.0'
12
12
 
13
13
  %w[rack].each{ |g| s.add_runtime_dependency(g) }
14
14
  end
@@ -0,0 +1,36 @@
1
+
2
+ # Assume you want a more sensible default, or don't require this file
3
+
4
+ require 'rack/handler'
5
+
6
+ module Rack::Handler
7
+ DEFAULT = %w[zbatery rainbows unicorn puma thin webrick]
8
+
9
+ def self.default(options = {})
10
+ # Guess.
11
+ if ENV.include?("PHP_FCGI_CHILDREN")
12
+ # We already speak FastCGI
13
+ options.delete :File
14
+ options.delete :Port
15
+
16
+ Rack::Handler::FastCGI
17
+ elsif ENV.include?("REQUEST_METHOD")
18
+ Rack::Handler::CGI
19
+ else
20
+ pick DEFAULT # We only change this line
21
+ end
22
+ end
23
+
24
+ # Copied from rack 1.5.2 for backward compatibility
25
+ def self.pick(server_names)
26
+ server_names = Array(server_names)
27
+ server_names.each do |server_name|
28
+ begin
29
+ return get(server_name.to_s)
30
+ rescue LoadError, NameError
31
+ end
32
+ end
33
+
34
+ raise LoadError, "Couldn't find handler for: #{server_names.join(', ')}."
35
+ end unless respond_to?(:pick)
36
+ end
@@ -1,6 +1,6 @@
1
1
 
2
2
  if ARGV[0] && ARGV[0] == 'server'[0, ARGV[0].size] && ARGV[1] !~ /^\w+/
3
- server = %w[zbatery rainbows unicorn puma thin].find do |s|
3
+ server = %w[zbatery rainbows unicorn puma thin webrick].find do |s|
4
4
  begin
5
5
  require s
6
6
  true
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rack-handlers"
5
- s.version = "0.6.1"
5
+ s.version = "0.7.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Lin Jen-Shin (godfat)"]
9
- s.date = "2013-07-11"
10
- s.description = "Some Rack handlers which are not included in Rack distribution."
9
+ s.date = "2013-08-22"
10
+ s.description = "Unicorn family Rack handlers for you. Mostly for `rails s`."
11
11
  s.email = ["godfat (XD) godfat.org"]
12
12
  s.files = [
13
13
  ".gitignore",
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  "CHANGES.md",
16
16
  "README.md",
17
17
  "Rakefile",
18
+ "lib/rack-handlers.rb",
18
19
  "lib/rack/handler/rails-server.rb",
19
20
  "lib/rack/handler/rainbows.rb",
20
21
  "lib/rack/handler/unicorn.rb",
@@ -24,8 +25,8 @@ Gem::Specification.new do |s|
24
25
  "task/gemgem.rb"]
25
26
  s.homepage = "https://github.com/godfat/rack-handlers"
26
27
  s.require_paths = ["lib"]
27
- s.rubygems_version = "2.0.4"
28
- s.summary = "Some Rack handlers which are not included in Rack distribution."
28
+ s.rubygems_version = "2.0.6"
29
+ s.summary = "Unicorn family Rack handlers for you. Mostly for `rails s`."
29
30
 
30
31
  if s.respond_to? :specification_version then
31
32
  s.specification_version = 4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-handlers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-11 00:00:00.000000000 Z
11
+ date: 2013-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: Some Rack handlers which are not included in Rack distribution.
27
+ description: Unicorn family Rack handlers for you. Mostly for `rails s`.
28
28
  email:
29
29
  - godfat (XD) godfat.org
30
30
  executables: []
@@ -36,6 +36,7 @@ files:
36
36
  - CHANGES.md
37
37
  - README.md
38
38
  - Rakefile
39
+ - lib/rack-handlers.rb
39
40
  - lib/rack/handler/rails-server.rb
40
41
  - lib/rack/handler/rainbows.rb
41
42
  - lib/rack/handler/unicorn.rb
@@ -62,8 +63,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
63
  version: '0'
63
64
  requirements: []
64
65
  rubyforge_project:
65
- rubygems_version: 2.0.4
66
+ rubygems_version: 2.0.6
66
67
  signing_key:
67
68
  specification_version: 4
68
- summary: Some Rack handlers which are not included in Rack distribution.
69
+ summary: Unicorn family Rack handlers for you. Mostly for `rails s`.
69
70
  test_files: []