36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/hokuto/main.rb', line 36
def self.parse_arguments(args)
result = {
port: 7080,
}
app_config = {
environment: 'development',
context_root: '/',
base_directory: Dir.pwd,
min_instances: 1,
max_instances: 1
}
parser = OptionParser.new
parser.on('-f', '--config-file=CONFIG_FILE'){|v|app_config[:config_file] = YAML.load_file(v)}
parser.on('-w', '--web-xml=WEBXML'){|v|app_config[:descriptor] = v}
parser.on('-p', '--http-port=HTTP_PORT'){|v|result[:port] = v}
parser.on('-P', '--https-port=SECURE_PORT'){|v|result[:https_port] = v}
parser.on('-c', '--context-root=PATH'){|v|app_config[:context_root] = v}
parser.on('-d', '--base-directory=DIR'){|v|app_config[:base_directory] = v}
parser.on('-e', '--environment=ENV'){|v|app_config[:environment] = v}
parser.on('-s', '--min-instances=INSTANCES_ON_STARTUP'){|v|app_config[:min_instances] = v}
parser.on('-x', '--max-instances=MAXIMUM_INSTANCES'){|v|app_config[:max_instances] = v}
parser.parse!
app_config[:base_directory] ||= Dir.pwd
result.merge!(:application => app_config) unless app_config.empty?
result
end
|