Sha256: 1e9c1a3fb1835805dd06bf268de5486e059489db0a4b2c194359e5575c33f978
Contents?: true
Size: 1.26 KB
Versions: 3
Compression:
Stored size: 1.26 KB
Contents
#!/usr/bin/env ruby $LOAD_PATH << File.expand_path('lib') require 'optparse' require 'rack/handler/puma' require 'invoice_printer/server' def show_version puts "InvoicePrinter v#{InvoicePrinter::VERSION}" exit 0 end def show_help puts <<~HELP Usage: invoice_printer_server [options] Options: -h, --host hostname to listen on (default is 0.0.0.0) -p, --port port to listen on (default is 9393) -w, --workers number of Puma workers (default is 2) HELP exit 0 end options = {} parser = OptionParser.new do|opts| opts.on('-h', '--hostname ADDRESS') do |address| options[:Host] = address end opts.on('-p', '--port NUMBER') do |number| options[:Port] = number end opts.on('-w', '--workers NUMBER') do |number| options[:workers] = number.to_i end opts.on('--debug') do options[:debug] = true end opts.on('-h', '--help') do show_help end end parser.parse! puma_options = { :Host => '0.0.0.0', :Port => 9393, :workers => 2 }.merge(options) begin puts 'Starting InvoicePrinter Server...' Rack::Handler::Puma.run(InvoicePrinter::Server.freeze.app, puma_options) rescue => e STDERR.puts "ERROR: #{e.message}" if options[:debug] STDERR.puts STDERR.puts e.backtrace end exit 1 end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
invoice_printer-1.3.0 | bin/invoice_printer_server |
invoice_printer-1.2.0 | bin/invoice_printer_server |
invoice_printer-1.2.0.alpha1 | bin/invoice_printer_server |