Sha256: 08e737a1b2fa5aa2e7fa3cdab767d71e120e078c69737a9dcc1ccfb380590b06

Contents?: true

Size: 712 Bytes

Versions: 2

Compression:

Stored size: 712 Bytes

Contents

#require 'optparse'
require 'nailgun_config'
require 'ng_command'

module Nailgun
	class NailgunServer
		attr_accessor :args,:nailgun_options
		def initialize(args)
			raise ArgumentError,"please specify start|stop|-h" if args.empty?
			opts = OptionParser.new do |opts|
				opts.banner = "Usage: #{File.basename($0)} start|stop"
				opts.on('-h', '--help', 'Show this message') do
					puts "Use: start to start server"
					puts "Use: stop to stop server"
					puts opts
					exit 1
				end
			end
			@args = opts.parse!(args)
		end

		def daemonize
			if @args.include?('start')
				Nailgun::NgCommand.start_server
			elsif @args.include?('stop')
				Nailgun::NgCommand.stop_server
			end
		end
	end

end




Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nailgun-0.0.2 lib/nailgun.rb
nailgun-0.0.1 lib/nailgun.rb