ernicorn 1.0.1 → 1.0.2
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.
- data/README.md +20 -13
- data/ernicorn.gemspec +3 -1
- data/examples/start.sh +1 -1
- data/lib/ernicorn.rb +1 -2
- data/lib/ernicorn/version.rb +3 -0
- data/script/ernicorn +30 -13
- data/script/ernicorn-ctrl +1 -1
- data/test/helper.rb +0 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -19,25 +19,32 @@ Installation
|
|
19
19
|
Starting The Server
|
20
20
|
-------------------
|
21
21
|
|
22
|
-
Use the ernicorn command to start a new RPC server:
|
22
|
+
Use the `ernicorn` command to start a new RPC server:
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
$ ernicorn --help
|
25
|
+
Usage: ernicorn [options] [config file]
|
26
|
+
Start a Ruby BERT-RPC Server with the given options and config file.
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
Options
|
29
|
+
-h, --host=<host> Server address to listen on; default: 0.0.0.0
|
30
|
+
-p, --port=<portno> Server port to listen on; default: 8149
|
31
|
+
-l, --listen=<host>:<port> Listen addresses. Can be specified multiple times
|
32
|
+
--log-level=0-4 Set the log level
|
33
|
+
-d, --detached Run as a daemon
|
34
|
+
-P, --pidfile=<file> Location to write pid file
|
29
35
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
-P, --pidfile PIDFILE Location to write pid file.
|
36
|
+
The ernicorn server attempts to load the config file given or
|
37
|
+
`config/ernicorn.rb` when no config file is specified. See the example config
|
38
|
+
file [examples/config.rb][c] to get started. All [Unicorn config options][r] are
|
39
|
+
supported.
|
35
40
|
|
36
|
-
The
|
37
|
-
|
38
|
-
[examples/handler.rb][h] file for
|
41
|
+
The config file should require any libraries needed for the server and register
|
42
|
+
server modules with `Ernicorn.expose(:modulename, TheModule)`. See the
|
43
|
+
[examples/handler.rb][h] file for a simple example handler.
|
39
44
|
|
40
45
|
[h]: https://github.com/github/ernicorn/blob/master/examples/handler.rb
|
46
|
+
[c]: https://github.com/github/ernicorn/blob/master/examples/config.rb
|
47
|
+
[r]: http://unicorn.bogomips.org/Unicorn/Configurator.html
|
41
48
|
|
42
49
|
Control Commands
|
43
50
|
----------------
|
data/ernicorn.gemspec
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
require 'ernicorn/version'
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
3
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
4
6
|
s.rubygems_version = '1.3.6'
|
5
7
|
|
6
8
|
s.name = 'ernicorn'
|
7
|
-
s.version =
|
9
|
+
s.version = Ernicorn::VERSION
|
8
10
|
s.date = '2012-06-23'
|
9
11
|
|
10
12
|
s.summary = "Ernicorn is a BERT-RPC server implementation based on unicorn."
|
data/examples/start.sh
CHANGED
data/lib/ernicorn.rb
CHANGED
data/script/ernicorn
CHANGED
@@ -4,41 +4,58 @@
|
|
4
4
|
#/
|
5
5
|
#/ Options
|
6
6
|
#/ -h, --host=<host> Server address to listen on; default: 0.0.0.0
|
7
|
-
#/ -p, --port=<portno> Server port to listen on; default:
|
7
|
+
#/ -p, --port=<portno> Server port to listen on; default: 8149
|
8
|
+
#/ -l, --listen=<host>:<port> Listen addresses. Can be specified multiple times
|
8
9
|
#/ --log-level=0-4 Set the log level
|
9
10
|
#/ -d, --detached Run as a daemon
|
10
11
|
#/ -P, --pidfile=<file> Location to write pid file
|
11
12
|
#/
|
12
13
|
#/ See https://github.com/github/ernicorn for more information.
|
13
14
|
require 'optparse'
|
15
|
+
|
16
|
+
# override unicorn's default port and listen address list
|
17
|
+
module Unicorn
|
18
|
+
require 'unicorn/const'
|
19
|
+
module Unicorn::Const
|
20
|
+
remove_const :DEFAULT_PORT
|
21
|
+
remove_const :DEFAULT_LISTEN
|
22
|
+
DEFAULT_PORT = 8149
|
23
|
+
DEFAULT_LISTEN = "#{DEFAULT_HOST}:#{DEFAULT_PORT}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# load unicorn server extensions
|
14
28
|
require 'ernicorn'
|
15
29
|
require 'ernicorn/server'
|
16
30
|
require 'ernicorn/adminrpc'
|
17
31
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
32
|
+
# command line options
|
33
|
+
host = nil
|
34
|
+
port = nil
|
35
|
+
listeners = []
|
22
36
|
daemonize = false
|
23
37
|
config = 'config/ernicorn.rb'
|
24
38
|
pidfile = nil
|
25
39
|
|
26
40
|
parser = OptionParser.new do |opts|
|
27
|
-
opts.on("-c", "--config=val", String)
|
28
|
-
opts.on("-h", "--host=val",
|
29
|
-
opts.on("-p", "--port=val", Integer)
|
30
|
-
opts.on(
|
31
|
-
opts.on("-
|
32
|
-
opts.on("-
|
33
|
-
opts.
|
41
|
+
opts.on("-c", "--config=val", String) { |config| }
|
42
|
+
opts.on("-h", "--host=val", String) { |host| }
|
43
|
+
opts.on("-p", "--port=val", Integer) { |port| }
|
44
|
+
opts.on("-l", "--listen=val", String) { |addr| listeners << addr }
|
45
|
+
opts.on( "--log-level=val", Integer) { |val| Ernicorn.loglevel(val) }
|
46
|
+
opts.on("-d", "--detached") { |daemonize| }
|
47
|
+
opts.on("-P", "--pidfile=val") { |pidfile| }
|
48
|
+
opts.on_tail("-h", "--help") { exec "grep ^#/<'#{__FILE__}'|cut -c4-" }
|
34
49
|
opts.parse!
|
35
50
|
end
|
36
51
|
|
52
|
+
listeners << "#{host || '0.0.0.0'}:#{port || 8149}" if host || port
|
53
|
+
|
37
54
|
config = ARGV[0] || config
|
38
55
|
|
39
56
|
options = {
|
40
57
|
:pid => pidfile,
|
41
|
-
:listeners =>
|
58
|
+
:listeners => listeners,
|
42
59
|
:config_file => File.expand_path(config)
|
43
60
|
}
|
44
61
|
|
data/script/ernicorn-ctrl
CHANGED
data/test/helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tom Preston-Werner
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- lib/ernicorn.rb
|
99
99
|
- lib/ernicorn/adminrpc.rb
|
100
100
|
- lib/ernicorn/server.rb
|
101
|
+
- lib/ernicorn/version.rb
|
101
102
|
- script/bootstrap
|
102
103
|
- script/cibuild
|
103
104
|
- script/ernicorn
|