30: def parse_argv!(argv)
31: op = OptionParser.new
32: op.banner = 'Usage: $ rascut HelloWrold.as'
33:
34:
35:
36:
37:
38:
39: op.on('-b=VAL', '--bind-address=VAL', 'server bind address(default 0.0.0.0)') {|v| @params[:bind_address] = v }
40: op.on('--compile-config=VAL', '-c=VAL', 'mxmlc compile config ex:) --compile-config="-benchmark -strict=true"') do |v|
41: if @params[:compile_config]
42: @params[:compile_config] << ' ' << v
43: else
44: @params[:compile_config] = v
45: end
46: end
47:
48: op.on('--fcsh-cmd=VAL', 'fcsh command path') {|v| @params[:fcsh_cmd] = v }
49: @params[:observe_files] = []
50: op.on('-I=VAL', '--observe-files=VAL', 'observe files and directories path') {|v| @params[:observe_files] << v }
51:
52: if @params[:observe_files].empty?
53: @params[:observe_files] << '.'
54: end
55:
56: op.on('-h', '--help', 'show this message') { puts op; Kernel::exit 1 }
57: op.on('-i=VAL', '--interval=VAL', 'interval time(min)') {|v| @params[:interval] = v.to_i }
58: op.on('-l=VAL', '--log=VAL', 'showing flashlog.txt') {|v| @params[:flashlog] = v }
59: op.on('-m=VAL', '--mapping=VAL', 'server mapping path :example) -m "../assets=assets" -m "../images/=img"') {|v|
60: @params[:mapping] ||= []
61: @params[:mapping] << v.split('=', 2)
62: }
63: op.on('--no-file-observe', "don't observing files") {|v| @params[:file_observing] = false }
64: op.on('--observe-ext=VAL', 'observe ext ex:) --observe-ext="as3,actionscript3,css,mxml"') {|v| @params[:ext] = v.split(',') }
65: op.on('--server', '-s', 'start autoreload webserver') {|v| @params[:server] = true }
66: op.on('--server-handler=val', 'set server hander :example) --server-handler=webrick') {|v| @params[:server] = v }
67: op.on('--port=val', '-p=val', 'server port(default: 3001)') {|v| @params[:port] = v.to_i }
68: op.on('--plugin=VAL', 'load plugin(s)') {|v|
69: @params[:plugin] ||= []
70: @params[:plugin] << v
71: }
72: op.on('-t=VAL', '--template=VAL', 'server use template file') {|v| @params[:template] = v }
73: op.on('-v', '--verbose', 'detail messages') {|v| @params[:logger].level = Logger::DEBUG }
74: op.on('--version', 'show version') {|v|
75: puts "rascut #{Rascut::VERSION}"
76: exit 0
77: }
78: op.parse! argv
79: @params[:logger].debug 'config' + @params.inspect
80: end