Module: Drakkon::Web

Defined in:
lib/drakkon/web.rb

Overview

Web Helper

Class Method Summary collapse

Class Method Details

.outputObject

Send output to console



20
21
22
23
24
25
26
# File 'lib/drakkon/web.rb', line 20

def self.output
  loop do
    next unless @dragonruby.ready?

    puts @dragonruby.readline
  end
end

.run!(_args = []) ⇒ Object

Free running



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/drakkon/web.rb', line 5

def self.run!(_args = [])
  # Save Current Directory before changing to Version Directory
  @context = Dir.pwd

  # Yes... Run.run!
  Dir.chdir(Run.version_dir) do
    runtime
    output
  end
rescue SystemExit, Interrupt
  LogBot.info('Web', 'Exiting')
  exit 0
end

.run_cmdObject

Exec skips the weird shell stuff



33
34
35
# File 'lib/drakkon/web.rb', line 33

def self.run_cmd
  ['./dragonruby-httpd', @context, '8000']
end

.runtimeObject



28
29
30
# File 'lib/drakkon/web.rb', line 28

def self.runtime
  @dragonruby = IO.popen(Run.run_env, run_cmd)
end