Class: Smartguard::Applications::Smartkiosk::Web

Inherits:
Process
  • Object
show all
Defined in:
lib/smartguard/applications/smartkiosk/web.rb

Instance Attribute Summary

Attributes inherited from Process

#path, #pid

Instance Method Summary collapse

Methods inherited from Process

#active?, #initialize, #wanted?

Constructor Details

This class inherits a constructor from Smartguard::Process

Instance Method Details

#startObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/smartguard/applications/smartkiosk/web.rb', line 5

def start
  super

  if Smartguard.environment == :development
    Logging.logger.info "Skipping web; Please run manually with `rack web`".black_on_white.bold
    return true
  else
    Logging.logger.info "Starting web"
  end

  log_path = @path.join('log/web.log')

  opts = []
  if Smartguard.environment == :production
    opts << "--log=#{log_path}"
  end

  if !run(@path, {
          'RACK_ENV' => Smartguard.environment.to_s
        },
          "bundle", "exec",
          "smartkiosk-client", *opts
         )
    return false
  end

  result = without_respawn do
    wait_for_port 3001
  end

  result
end

#stopObject



38
39
40
41
42
43
# File 'lib/smartguard/applications/smartkiosk/web.rb', line 38

def stop
  super

  Logging.logger.info "Stoping web"
  kill_and_wait :TERM, 15
end