Class: Simplepub::Cli::Server

Inherits:
Thor
  • Object
show all
Defined in:
lib/simplepub/cli/server.rb

Instance Method Summary collapse

Instance Method Details

#startObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/simplepub/cli/server.rb', line 15

def start
  Simplepub.config.environment = options.environment
  Simplepub.load_config

  argv = [
    "start",
    "-R", options.rackup_file,
    "-e", options.rack_environment,
    "-p", options.port,
    "-a", options.address,
    "-l", options.logfile,
    "-P", options.pidfile
  ]
  if Simplepub.config.ssl_.certificate?
    argv << "--ssl"
    # argv << "--ssl-verify"
    argv << "--ssl-cert-file"
    argv << Simplepub.config.ssl.certificate
    if Simplepub.config.ssl.keyfile?
      argv << "--ssl-key-file"
      argv << Simplepub.config.ssl.keyfile
    end
  end
  argv << "-d" unless options.no_daemon?
  say "Loading server with #{argv.inspect}", :yellow
  Thin::Runner.new(argv.flatten).run!
end

#stopObject



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/simplepub/cli/server.rb', line 50

def stop
  Simplepub.load_config
  argv = [
    "stop",
    "-R", options.rackup_file,
    "-e", options.rack_environment,
    "-p", options.port,
    "-a", options.address,
    "-l", options.logfile,
    "-P", options.pidfile
  ]
  Thin::Runner.new(argv.flatten).run!
end