Class: Webgen::CLI::WebguiCommand
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- Webgen::CLI::WebguiCommand
- Defined in:
- lib/webgen/cli/webgui_command.rb
Overview
The CLI command for starting the webgen webgui.
Instance Method Summary collapse
-
#execute(args) ⇒ Object
Render the website.
-
#initialize ⇒ WebguiCommand
constructor
:nodoc:.
Constructor Details
#initialize ⇒ WebguiCommand
:nodoc:
10 11 12 13 |
# File 'lib/webgen/cli/webgui_command.rb', line 10 def initialize # :nodoc: super('webgui', false) self.short_desc = 'Starts the webgen webgui' end |
Instance Method Details
#execute(args) ⇒ Object
Render the website.
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 42 43 44 45 46 47 |
# File 'lib/webgen/cli/webgui_command.rb', line 16 def execute(args) # some fixes for ramaze-2008.06 # - fix for Windows bug when win32console is not installed # - fix for message displayed on shutdown $:.unshift File.join(Webgen.data_dir, 'webgui', 'overrides') require 'win32console' $:.shift require 'ramaze' Ramaze::Log.loggers = [] def Ramaze.shutdown; # :nodoc: end acquire Webgen.data_dir/:webgui/:controller/'*' Ramaze::Global.setup do |g| g.root = Webgen.data_dir/:webgui g.public_root = Webgen.data_dir/:webgui/:public g.view_root = Webgen.data_dir/:webgui/:view g.adapter = :webrick g.port = 7000 end puts 'Starting webgui on http://localhost:7000, press Control-C to stop' Thread.new do sleep 2 puts 'Launching web browser' require 'launchy' Launchy.open('http://localhost:7000') end Ramaze.start puts 'webgui finished' end |