unicorn-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/README.md +27 -0
- data/lib/unicorn-rails/version.rb +3 -0
- data/lib/unicorn-rails.rb +33 -0
- metadata +73 -0
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (C) 2011 by Samuel Kadolph
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# unicorn-rails
|
2
|
+
|
3
|
+
`unicorn-rails` is a simple gem that sets the default server for rack (and rails) to unicorn.
|
4
|
+
|
5
|
+
## Description
|
6
|
+
|
7
|
+
unicorn-rails overrides the `Rack::Handler.default` method to return `Rack::Handler::Unicorn` which will cause rack (and
|
8
|
+
rails) to use unicorn by default.
|
9
|
+
|
10
|
+
## Installing
|
11
|
+
|
12
|
+
### Recommended
|
13
|
+
|
14
|
+
```
|
15
|
+
gem install unicorn-rails
|
16
|
+
```
|
17
|
+
|
18
|
+
### Edge
|
19
|
+
|
20
|
+
```
|
21
|
+
git clone https://github.com/samuelkadolph/unicorn-rails
|
22
|
+
cd unicorn-rails && rake install
|
23
|
+
```
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Add `gem "unicorn-rails"` to your Gemfile and then run `rails s` and it will use unicorn by default.
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module UnicornRails
|
2
|
+
require "unicorn-rails/version"
|
3
|
+
end
|
4
|
+
|
5
|
+
require "unicorn"
|
6
|
+
|
7
|
+
module Rack
|
8
|
+
module Handler
|
9
|
+
class Unicorn
|
10
|
+
class << self
|
11
|
+
def run(app, options = {})
|
12
|
+
unicorn_options = {}
|
13
|
+
unicorn_options[:listeners] = ["#{options[:Host]}:#{options[:Port]}"]
|
14
|
+
unicorn_options[:worker_processes] = 3
|
15
|
+
|
16
|
+
if options[:debugger]
|
17
|
+
unicorn_options[:worker_processes] = 1
|
18
|
+
unicorn_options[:timeout] = 120
|
19
|
+
end
|
20
|
+
|
21
|
+
::Unicorn::Launcher.daemonize!(unicorn_options) if options[:daemonize]
|
22
|
+
::Unicorn::HttpServer.new(app, unicorn_options).start.join
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
register "unicorn", "Rack::Handler::Unicorn"
|
28
|
+
|
29
|
+
def self.default(options = {})
|
30
|
+
Rack::Handler::Unicorn
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unicorn-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Samuel Kadolph
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-15 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rack
|
16
|
+
requirement: &2161607800 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2161607800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: unicorn
|
27
|
+
requirement: &2161607340 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2161607340
|
36
|
+
description: unicorn-rails overrides the Rack::Handler.default method to return Rack::Handler::Unicorn
|
37
|
+
which will cause rack (and rails) to use unicorn by default.
|
38
|
+
email:
|
39
|
+
- samuel@kadolph.com
|
40
|
+
executables: []
|
41
|
+
extensions: []
|
42
|
+
extra_rdoc_files: []
|
43
|
+
files:
|
44
|
+
- lib/unicorn-rails/version.rb
|
45
|
+
- lib/unicorn-rails.rb
|
46
|
+
- LICENSE
|
47
|
+
- README.md
|
48
|
+
homepage: https://github.com/samuelkadolph/unicorn-rails
|
49
|
+
licenses: []
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.8.7
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.8.10
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: unicorn-rails is a simple gem that sets the default server for rack (and
|
72
|
+
rails) to unicorn.
|
73
|
+
test_files: []
|