Class: Capricorn::Apps::Server

Inherits:
Thor
  • Object
show all
Defined in:
lib/capricorn/apps/server.rb

Instance Method Summary collapse

Methods inherited from Thor

namespace, namespace=

Instance Method Details

#reloadObject



47
48
49
# File 'lib/capricorn/apps/server.rb', line 47

def reload
  Capricorn.client(options[:token]).reload_server
end

#restartObject



41
42
43
# File 'lib/capricorn/apps/server.rb', line 41

def restart
  Capricorn.client(options[:token]).restart_server
end

#startObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/capricorn/apps/server.rb', line 10

def start
  Capricorn.server? true
  Capricorn::System.load!(options[:root_path])
  
  begin
    FileUtils.mkdir_p(Capricorn.system.root)
  rescue Errno::EACCES
    Capricorn.logger.out.fatal "must be executed as root"
    exit(1)
  end
  
  unless Capricorn.system.is_user('root')
    Capricorn.logger.out.fatal "must be executed as root"
    exit(1)
  end
  
  if options[:foreground]
    Capricorn::Server.start
  else
    Capricorn::Server.daemonize
  end
end

#stopObject



35
36
37
# File 'lib/capricorn/apps/server.rb', line 35

def stop
  Capricorn.client(options[:token]).stop_server
end

#updateObject



53
54
55
# File 'lib/capricorn/apps/server.rb', line 53

def update
  Capricorn.client(options[:token]).update_server
end

#versionObject



59
60
61
62
# File 'lib/capricorn/apps/server.rb', line 59

def version
  puts "Client: #{Capricorn.version}"
  puts "Server: #{Capricorn.client(options[:token]).server_version}"
end