bin/stackprof-webnav in stackprof-webnav-0.0.3 vs bin/stackprof-webnav in stackprof-webnav-0.0.4

- old
+ new

@@ -1,8 +1,10 @@ #!/usr/bin/env ruby require 'optparse' require 'stackprof-webnav' +require 'sprockets' +require 'rack' options = { :port => 9292 } @@ -13,11 +15,25 @@ 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) unless [:filepath, :uri, :bucket].any? {|key| options.key?(key)} +parser.abort(parser.help) unless [:filepath, :uri, :bucket].any? {|key| options.key?(key)} server = StackProf::Webnav::Server server.cmd_options = options -server.run! options[:port] +builder = Rack::Builder.new do + map '/' do + run server.new + end + + map '/assets' do + environment = Sprockets::Environment.new + environment.append_path File.expand_path("../../lib/stackprof-webnav/css", __FILE__) + run environment + end +end + +puts File.expand_path("../lib/stackprof-webnav/css", __FILE__) + +Rack::Handler.get('webrick').run builder, :Port => options[:port]