Class: Nailgun::NailgunServer
- Inherits:
-
Object
- Object
- Nailgun::NailgunServer
- Defined in:
- lib/nailgun.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#nailgun_options ⇒ Object
Returns the value of attribute nailgun_options.
Instance Method Summary collapse
- #daemonize ⇒ Object
-
#initialize(args) ⇒ NailgunServer
constructor
A new instance of NailgunServer.
Constructor Details
#initialize(args) ⇒ NailgunServer
Returns a new instance of NailgunServer.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/nailgun.rb', line 9 def initialize(args) raise ArgumentError, "please specify start|stop|-h" if args.empty? opts = OptionParser.new do |opts| opts. = "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 |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
7 8 9 |
# File 'lib/nailgun.rb', line 7 def args @args end |
#nailgun_options ⇒ Object
Returns the value of attribute nailgun_options.
7 8 9 |
# File 'lib/nailgun.rb', line 7 def @nailgun_options end |
Instance Method Details
#daemonize ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/nailgun.rb', line 23 def daemonize if @args.include? 'start' Nailgun::NgCommand.start_server elsif @args.include? 'stop' Nailgun::NgCommand.stop_server end end |