opener-opinion-detector 1.1.1 → 1.1.2

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: cffcde32f748cd6a76134c85be493c8384f6fc62
4
- data.tar.gz: 82dad1008e90926321bde2b14a1488aea97c92af
3
+ metadata.gz: a4dce5b1a9a3888005c12068e17b688e22ae9a59
4
+ data.tar.gz: b11fdc456f1fceff08699263333e5f7305e30dc6
5
5
  SHA512:
6
- metadata.gz: 5b35b4dc318071660d1162d62d7f6d1469dea83651643411c45c866da3712359add9187b979466d182a76f349e8525bfb35bfcf7409992a69f25f3336bb40d6e
7
- data.tar.gz: 1ff811eda10fced7f29d49b7fe3c474aa8e28032ce3a65f071e15ece354bcc95805442a58cc40eeecac3c0b895068218a56f2c2caf31da11e62824ce43c92c15
6
+ metadata.gz: 0b29925a2426e06194159b1e17645749f3acc2a8e50cef8827bd6dcf9bec73723a78ddf3e817edaf48863e38f55c3617092a426a507fda2ee487fc6ec88cb5d8
7
+ data.tar.gz: 83229e5298bf70f5e3d35f3921d090d0525d9fa8a248c6dcbd1d31e041d88ff9889b5aa9deafa83f9c106e335a690d2da001942ec45dee0129fde3b2b276ad2b
@@ -4,50 +4,47 @@ require 'puma/cli'
4
4
  require 'optparse'
5
5
  require 'opener/core/resource_switcher'
6
6
 
7
- # Puma sadly does not provide a system that allows us to cleanly inject custom
8
- # options into their CLI. At the same time Puma doesn't provide an easy system
9
- # of starting it *without* using the `Puma::CLI` class.
10
- #
11
- # To work around these problems we create our own parser and ignore any invalid
12
- # option errors it throws up. This parser is used to handle options for the
13
- # resource switcher.
14
-
15
7
  rack_config = File.expand_path('../../config.ru', __FILE__)
16
8
  switcher = Opener::Core::ResourceSwitcher.new
9
+ puma_args = [rack_config]
17
10
  switcher_opts = {}
18
- show_help = false
19
11
 
20
- parser = OptionParser.new do |opts|
12
+ option_parser = OptionParser.new do |opts|
21
13
  opts.banner = "Usage: #{File.basename($0)} [OPTIONS]"
22
14
 
23
- opts.separator "\nOptions:\n"
15
+ opts.separator "\nOptions:\n\n"
24
16
 
25
- # Don't abort in this block as we otherwise can't show Puma's help message.
26
17
  opts.on('-h', '--help', 'Shows this help message') do
27
- show_help = true
18
+ abort option_parser.to_s
19
+ end
28
20
 
29
- puts parser
21
+ opts.on('-S', '--state PATH', 'Where to store the state details') do |val|
22
+ puma_args += ['--state', val]
30
23
  end
31
24
 
32
- switcher.bind(opts, switcher_opts)
25
+ opts.on('-b', '--bind URI', 'URI to bind to (tcp://, unix://, ssl://)') do |val|
26
+ puma_args += ['--bind', val]
27
+ end
33
28
 
34
- opts.separator "\nPuma Usage:\n\n"
35
- end
29
+ opts.on('--pidfile PATH', 'Use PATH as a pidfile') do |val|
30
+ puma_args += ['--pidfile', val]
31
+ end
36
32
 
37
- begin
38
- # Parse destructively so that Puma doesn't break on our custom options.
39
- parser.parse!(ARGV)
40
- rescue OptionParser::InvalidOption => error
41
- # Catch errors generated by Puma options and ignore them.
42
- error.recover(ARGV)
43
- end
33
+ opts.on('--daemon', 'Daemonize the server into the background') do |val|
34
+ puma_args << '--daemon'
35
+ end
36
+
37
+ opts.on('-e', '--environment ENVIRONMENT', 'The environment to use') do |val|
38
+ puma_args += ['--environment', val]
39
+ end
44
40
 
45
- # Trigger the Puma help message since we overwrite this option and parse
46
- # destructively.
47
- if show_help
48
- ARGV << '--help'
41
+ opts.separator "\nResource Options:\n\n"
42
+
43
+ switcher.bind(opts, switcher_opts)
49
44
  end
50
45
 
46
+ option_parser.parse!(ARGV)
47
+
51
48
  switcher.install(switcher_opts)
52
49
 
53
- Puma::CLI.new([rack_config] + ARGV).run
50
+ Puma::CLI.new(puma_args).run
@@ -1,5 +1,5 @@
1
1
  module Opener
2
2
  class OpinionDetector
3
- VERSION = "1.1.1"
3
+ VERSION = "1.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opener-opinion-detector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - development@olery.com