hooves 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +15 -0
  2. data/lib/hooves/unicorn.rb +25 -0
  3. data/lib/hooves.rb +10 -0
  4. metadata +96 -0
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ hooves
2
+ =======
3
+ Adds a super simple Rack handler for the [Unicorn](http://unicorn.bogomips.org) http server. Basically just enough to get it running when using the `rails server` command.
4
+
5
+ Install
6
+ --------
7
+ It's a rubygem, you'll want to include it in your Gemfile.
8
+
9
+ Caveats
10
+ --------
11
+ * Using this gem monkey patches Rack::Handler.default making Unicorn the default.
12
+ * This was written to work with Rails 3. Not sure what'll happen if you try it elsewhere. Let me know!
13
+
14
+ ![](http://www.awesomeoff.com/images/entries/mainview/robocop_unicorn.jpg)
15
+
@@ -0,0 +1,25 @@
1
+ require "unicorn"
2
+ require "rack/content_length"
3
+ require "rack/chunked"
4
+
5
+ module Hooves
6
+ # Rack Handler to use Unicorn for Rails::Application.run!
7
+ module Unicorn
8
+ def self.run(app, options={})
9
+ options[:listeners] = ["#{options.delete(:Host)}:#{options.delete(:Port)}"]
10
+ options[:worker_processes] = 3
11
+ $DEBUG = true if options.delete(:debugger)
12
+ daemonize = options.delete(:daemonize)
13
+
14
+ # :pid option is stronly discouraged except in unicorn config file
15
+ uni_options = options.slice(:listeners, :worker_processes)
16
+
17
+ if daemonize
18
+ ::Unicorn::Launcher.daemonize!(uni_options)
19
+ else
20
+ ::Unicorn.run(app, uni_options)
21
+ end
22
+ end
23
+ end
24
+ end
25
+
data/lib/hooves.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'hooves/unicorn'
2
+ ::Rack::Handler.register "unicorn", "Hooves::Unicorn"
3
+
4
+ module Rack
5
+ module Handler
6
+ def self.default(options = {})
7
+ Hooves::Unicorn
8
+ end
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hooves
3
+ version: !ruby/object:Gem::Version
4
+ hash: 9
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ version: "0.1"
10
+ platform: ruby
11
+ authors:
12
+ - Jesse Storimer
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-06 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 3
31
+ - 0
32
+ version: "3.0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: unicorn
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">"
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ description:
50
+ email: jstorimer@gmail.com
51
+ executables: []
52
+
53
+ extensions: []
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - README.md
59
+ - lib/hooves/unicorn.rb
60
+ - lib/hooves.rb
61
+ has_rdoc: true
62
+ homepage: http://github.com/jstorimer/hooves
63
+ licenses: []
64
+
65
+ post_install_message:
66
+ rdoc_options: []
67
+
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 3
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ requirements: []
89
+
90
+ rubyforge_project:
91
+ rubygems_version: 1.3.7
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: A simple Rack handler for unicorn meant to be used with the `rails server` command
95
+ test_files: []
96
+