lib/nailgun.rb in nailgun-0.0.2 vs lib/nailgun.rb in nailgun-0.0.3
- old
+ new
@@ -1,35 +1,31 @@
-#require 'optparse'
+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
+ class NailgunServer
+ attr_accessor :args, :nailgun_options
- def daemonize
- if @args.include?('start')
- Nailgun::NgCommand.start_server
- elsif @args.include?('stop')
- Nailgun::NgCommand.stop_server
- end
- end
- end
+ 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
-
-
-
-