Class: Rocket::Server::CLI

Inherits:
Optitron::CLI
  • Object
show all
Includes:
Helpers
Defined in:
lib/rocket/server/cli.rb

Instance Method Summary collapse

Methods included from Helpers

#log

Instance Method Details

#configure(file = "rocket.yml") ⇒ Object



46
47
48
49
# File 'lib/rocket/server/cli.rb', line 46

def configure(file="rocket.yml")
  Rocket::Server::Misc.generate_config_file(file)
  puts "Created Rocket's server configuration: #{file}"
end

#startObject



26
27
28
29
30
# File 'lib/rocket/server/cli.rb', line 26

def start
  config_file = params.delete('config') || '/etc/rocket/default.yml'
  Rocket::Server.load_settings(config_file, symbolize_keys(params))
  Rocket::Server::Runner.new(Rocket::Server.settings).start!
end

#stopObject



35
36
37
38
39
40
41
42
43
# File 'lib/rocket/server/cli.rb', line 35

def stop
  Rocket::Server.load_settings(params.delete('config'), symbolize_keys(params))
  
  if pid = Rocket::Server::Runner.new(Rocket::Server.settings).kill!
    puts "Rocket server killed (PID: #{pid})"
  else
    puts "No processes were killed!"
  end
end

#versionObject



10
11
12
# File 'lib/rocket/server/cli.rb', line 10

def version
  puts "Rocket Server v#{Rocket.version}"
end