Class: Nailgun::NailgunServer

Inherits:
Object
  • Object
show all
Defined in:
lib/nailgun.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ NailgunServer

Returns a new instance of NailgunServer.

Raises:

  • (ArgumentError)


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.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

Instance Attribute Details

#argsObject

Returns the value of attribute args.



7
8
9
# File 'lib/nailgun.rb', line 7

def args
  @args
end

#nailgun_optionsObject

Returns the value of attribute nailgun_options.



7
8
9
# File 'lib/nailgun.rb', line 7

def nailgun_options
  @nailgun_options
end

Instance Method Details

#daemonizeObject



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