bin/stackprof-webnav in stackprof-webnav-0.0.2 vs bin/stackprof-webnav in stackprof-webnav-0.0.3
- old
+ new
@@ -5,22 +5,19 @@
options = {
:port => 9292
}
parser = OptionParser.new(ARGV) do |o|
- o.banner = "Usage: stackprof-webnav file.dump|http://path/to/file.dump [-p NUMBER]"
+ o.banner = "Usage: stackprof-webnav [-f localfile.dump]|[-u http://path/to/file.dump]|[-b http://path/to/s3/bucket/listing] [-p NUMBER]"
+ o.on('-f [LOCALFILE]', 'Local file path to dump') {|filepath| options[:filepath] = filepath }
+ o.on('-u [URI]', 'URI path to dump') {|uri| options[:uri] = uri }
+ o.on('-b [URI]', 'URI path to Amazon S3 bucket listing') {|bucket| options[:bucket] = bucket}
o.on('-p [PORT]', 'Server port') {|port| options[:port] = port }
end
parser.parse!
-parser.abort(parser.help) if ARGV.empty?
+parser.abort(parser.help) unless [:filepath, :uri, :bucket].any? {|key| options.key?(key)}
-file = ARGV.pop
server = StackProf::Webnav::Server
-
-if File.exists?(file)
- server.report_dump_path = File.expand_path(file)
-else
- server.report_dump_url = file
-end
+server.cmd_options = options
server.run! options[:port]