nutcracker-web 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9556cc53f5173af776c4137acabe20ec300a5a53
4
- data.tar.gz: b8592b44ae6f60b1f13c9f82ece5ea7c44be10fb
3
+ metadata.gz: a68ef6fab5dfe24a946ad3635ead23d202fe0b1a
4
+ data.tar.gz: b1616956dae393130c512b7a4647d8ca11efd1bf
5
5
  SHA512:
6
- metadata.gz: 5dce95488c0bbc7cf78556c27b02925cc8be10b6c769e0a0438651fe7c140882164248e115c4ae34b8505c7bcc6d72e4bb35dc01ca9dae9b440cbcba9d738d2f
7
- data.tar.gz: a25465a6cae3856b36073e968f243c38e7606585d5a8d9dd334c513fbdd5f3170b9e56e330e3907ab011d5d363811f60327f67e4f6b0c77b84f3f65a0babca4b
6
+ metadata.gz: 1c5c2ff1a47e7f7f450e6c0bb7f7f49b8ea3c487acb0c37ba07ab61aa879274586483e3eb5369bd326c65e78e596b2d648d2b6bd3cb311a7a42a2b8078a8a4f5
7
+ data.tar.gz: 76dadbaf0103052dc6cf640068aa7248fb359bdc3e2eb9a87abe3151079109b7e06b8c7d39818e7020c5c9f8f658b7e4a65f8862d6c3f49cca7f0b1cabfd5738
data/README.md CHANGED
@@ -20,8 +20,7 @@ $ nutcracker-web --help
20
20
  Usage: nutcracker-web [web-options] -- [nutcracker-options]
21
21
 
22
22
  [web-options]
23
-
24
- -s, --stats-port PORT Nutcracker stats port - 22222
23
+ -u, --stats-uri URI Nutcracker stats uri, default is tcp://localhost:22222
25
24
  -c, --config FILE Nutcracker cluster config file
26
25
  -p, --port PORT Web interface listening port
27
26
  -b, --backend BACKEND Web server to use ( needs to be Rack compliant )
@@ -3,13 +3,14 @@ $:.unshift File.expand_path('../../lib',__FILE__)
3
3
 
4
4
  require 'nutcracker'
5
5
  require 'nutcracker/web'
6
+ require 'nutcracker/web/version'
6
7
  require 'optparse'
7
8
  require 'fileutils'
8
9
  require 'socket'
9
10
  require 'open3'
10
11
  require 'uri'
11
12
 
12
- options = { stats_uri: URI("tcp://localhost:22222") }
13
+ options = { stats_uri: URI("tcp://localhost:22222"), context: "/"}
13
14
 
14
15
  OptionParser.new do |opts|
15
16
  opts.set_summary_indent " "
@@ -34,6 +35,10 @@ OptionParser.new do |opts|
34
35
  opts.on("-b","--backend BACKEND", "Web server to use ( needs to be Rack compliant )") do |v|
35
36
  options[:server] = v
36
37
  end
38
+
39
+ opts.on("-x", "--context CONTEXT", "Web Interface URL context, default /") do |v|
40
+ options[:context] = "/#{v}".squeeze("/")
41
+ end
37
42
 
38
43
  opts.on("-d", "--daemonize","run in background") do
39
44
  options[:daemonize] = true
@@ -47,6 +52,10 @@ OptionParser.new do |opts|
47
52
  options[:max_memory] = v
48
53
  end
49
54
 
55
+ opts.on("-v", "--version", "Print version and exit") do
56
+ abort "Nutcracker-Web, Ver. #{Nutcracker::Web::VERSION}"
57
+ end
58
+
50
59
  opts.on("-i","--pid FILE","pid file") do |v|
51
60
  options[:pid] = v
52
61
  options[:nutcracker_pid] = v + ".nutcracker"
@@ -2,18 +2,22 @@ require "rack"
2
2
 
3
3
  module Nutcracker
4
4
  module Web
5
- def self.start(nutcracker, options = {})
5
+ def self.start(nutcracker, o = {})
6
6
  @thread = Thread.new do
7
7
  Thread.current.abort_on_exception=true
8
+
9
+ app = Rack::URLMap.new(o[:context] =>
10
+ App.new(nutcracker, o.fetch(:external_servers,[])))
11
+
8
12
  Rack::Server.start(
9
13
  {
10
- :app => App.new(nutcracker, options[:external_servers] || []),
14
+ :app => app,
11
15
  :environment => 'production',
12
16
  :pid => nil,
13
17
  :Port => 9292,
14
18
  :Host => '0.0.0.0',
15
19
  :AccessLog => []
16
- }.merge( options )
20
+ }.merge(o)
17
21
  )
18
22
  end
19
23
  self
@@ -1,5 +1,5 @@
1
1
  module Nutcracker
2
2
  module Web
3
- VERSION="0.0.11"
3
+ VERSION="0.0.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutcracker-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eran Barak Levi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-28 00:00:00.000000000 Z
11
+ date: 2017-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest