Sha256: 663fa07a4471f75350d9f609285a5d73838e7ffb3267c73cc34f7cdf15cc959d

Contents?: true

Size: 866 Bytes

Versions: 17

Compression:

Stored size: 866 Bytes

Contents

#!/usr/bin/env ruby

require "optparse"
require "crono_trigger/web"

options = {
  bind: "0.0.0.0",
  port: 9292
}

opt_parser = OptionParser.new do |o|
  o.on('-p', '--port=PORT', 'Set port number (Default: 9292)') { |port| options[:port] = port.to_i }
  o.on('-b', '--bind=ADRESS', 'Set address to bind (Default: 0.0.0.0)') { |addr| options[:bind] = addr }
  o.on('-s', '--server=SERVER', 'Set Rack server handler name') { |handler| options[:server] = handler }
  o.on('--rails', 'Require rails environment') do
    pwd = Dir.pwd
    loader = -> do
      begin
        require File.join(pwd, "config", "environment")
        Rails.application.eager_load!
      rescue LoadError
        raise if pwd == "/"
        pwd = File.expand_path("..", pwd)
        loader.call
      end
    end
    loader.call
  end
end

opt_parser.parse!

CronoTrigger::Web.run!(options)

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
crono_trigger-0.8.3 exe/crono_trigger-web
crono_trigger-0.8.1 exe/crono_trigger-web
crono_trigger-0.8.0 exe/crono_trigger-web
crono_trigger-0.7.1 exe/crono_trigger-web
crono_trigger-0.7.0 exe/crono_trigger-web
crono_trigger-0.6.4 exe/crono_trigger-web
crono_trigger-0.6.3 exe/crono_trigger-web
crono_trigger-0.6.2 exe/crono_trigger-web
crono_trigger-0.6.1 exe/crono_trigger-web
crono_trigger-0.6.0 exe/crono_trigger-web
crono_trigger-0.5.4 exe/crono_trigger-web
crono_trigger-0.5.3 exe/crono_trigger-web
crono_trigger-0.5.2 exe/crono_trigger-web
crono_trigger-0.5.1 exe/crono_trigger-web
crono_trigger-0.5.0 exe/crono_trigger-web
crono_trigger-0.4.0 exe/crono_trigger-web
crono_trigger-0.3.4 exe/crono_trigger-web