Sha256: 534944ab4be0aa3f7f8683cd4f9ece657fd3f0194e7674873b57353be9a075e3

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'stackprof-webnav'
require 'sprockets'
require 'rack'

options = {
  :port => 9292
}

parser = OptionParser.new(ARGV) do |o|
  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) unless [:filepath, :uri, :bucket].any? {|key| options.key?(key)}

server = StackProf::Webnav::Server
server.cmd_options = options

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]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stackprof-webnav-0.0.4 bin/stackprof-webnav