Sha256: 13362085a3ff21fe1721058dc8672ba2907b1f1d46305bbe9b9ab01c09e5e1ca

Contents?: true

Size: 1.39 KB

Versions: 10

Compression:

Stored size: 1.39 KB

Contents

#!/usr/bin/env ruby

require 'puma/cli'
require 'optparse'
require 'opener/core/resource_switcher'

rack_config   = File.expand_path('../../config.ru', __FILE__)
switcher      = Opener::Core::ResourceSwitcher.new
puma_args     = [rack_config]
switcher_opts = {}

option_parser = OptionParser.new do |opts|
  opts.banner = "Usage: #{File.basename($0)} [OPTIONS]"

  opts.separator "\nOptions:\n\n"

  opts.on('-h', '--help', 'Shows this help message') do
    abort option_parser.to_s
  end

  opts.on('-S', '--state PATH', 'Where to store the state details') do |val|
    puma_args += ['--state', val]
  end

  opts.on('-b', '--bind URI', 'URI to bind to (tcp://, unix://, ssl://)') do |val|
    puma_args += ['--bind', val]
  end

  opts.on('--pidfile PATH', 'Use PATH as a pidfile') do |val|
    puma_args += ['--pidfile', val]
  end

  opts.on('--daemon', 'Daemonize the server into the background') do |val|
    puma_args << '--daemon'
  end

  opts.on('-e', '--environment ENVIRONMENT', 'The environment to use') do |val|
    puma_args += ['--environment', val]
  end

  opts.separator "\nResource Options:\n\n"

  switcher.bind(opts, switcher_opts)
end

option_parser.parse!(ARGV)

switcher.install(switcher_opts)

# Puma on JRuby does some weird stuff with forking/exec. As a result of this we
# *have to* update ARGV as otherwise running Puma as a daemon does not work.
ARGV.replace(puma_args)

Puma::CLI.new(ARGV).run

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
opener-property-tagger-2.2.6 bin/property-tagger-server
opener-opinion-detector-1.1.5 bin/opinion-detector-server
opener-property-tagger-2.2.5 bin/property-tagger-server
opener-polarity-tagger-2.3.2 bin/polarity-tagger-server
opener-opinion-detector-1.1.4 bin/opinion-detector-server
opener-property-tagger-2.2.4 bin/property-tagger-server
opener-polarity-tagger-2.3.1 bin/polarity-tagger-server
opener-property-tagger-2.2.3 bin/property-tagger-server
opener-polarity-tagger-2.2.4 bin/polarity-tagger-server
opener-opinion-detector-1.1.3 bin/opinion-detector-server