58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/codestock/cdweb/cli_cdweb.rb', line 58
def self.execute(stdout, argv)
options = {
:environment => ENV['RACK_ENV'] || "development",
:pid => nil,
:Port => 9292,
:Host => "0.0.0.0",
:AccessLog => [],
:config => "config.ru",
:server => "thin",
:LaunchBrowser => true,
:DbDir => select_dbdir,
}
opts = OptionParser.new("#{File.basename($0)}")
opts.on('--db DB_DIR', 'Database dir (default : ~/.codestock)') {|v| options[:DbDir] = v }
opts.on("-o", "--host HOST", "listen on HOST (default: 0.0.0.0)") {|host| options[:Host] = host }
opts.on('-p', '--port PORT', 'use PORT (default: 9292)') {|v| options[:Port] = v }
opts.on('-n', '--no-browser', 'No launch browser.') {|v| options[:LaunchBrowser] = false }
opts.parse!(argv)
Database.setup(File.expand_path(options[:DbDir]))
FileUtils.cd(File.dirname(__FILE__))
Rack::Server.start(options)
end
|