Sha256: 2ff32a93653270608d52d14b4eac071cc95b18ecab078c9749e939bfce3f1681

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

#!/usr/bin/env ruby

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib') unless $LOAD_PATH.include?(File.dirname(__FILE__) + '/../lib')

require 'navy/ship'
require 'optparse'

ship_options = { options: {} }
options      = ship_options[:options]

op = OptionParser.new("", 24, '  ') do |opts|
  cmd = File.basename($0)
  opts.banner = "Usage: #{cmd} [#{cmd} options]"

  opts.separator "#{cmd} options:"

  opts.on("-D", "--daemonize", "run daemonized in the background") do |d|
    ship_options[:daemonize] = !!d
  end

  opts.separator "Common options:"

  opts.on_tail("-h", "--help", "Show this message") do
    puts opts.to_s.gsub(/^.*DEPRECATED.*$/s, '')
    exit
  end

  opts.on_tail("-v", "--version", "Show version") do
    puts "#{cmd} v#{Navy::VERSION}"
    exit
  end

  opts.parse! ARGV

end

# unless options[:config_file]
#   $stderr.puts "ERROR: config file required", ''
#   puts op.to_s.gsub(/^.*DEPRECATED.*$/s, '')
#   exit 1
# end

# app = Mule.builder('config', op)
# op = nil

# if $DEBUG
#   require 'pp'
#   pp({
#     :mule_options => options,
#     # :app => app,
#     :daemonize => server_options[:daemonize],
#   })
# end

Navy::Ship.launch!(options) if ship_options[:daemonize]
Navy::Admiral.new(options).start.join

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
navy-0.0.2 bin/navy
navy-0.0.1 bin/navy