Sha256: 3144ba25a915603943b732aab87952a725717c9af25515030abdf4ae23283dec

Contents?: true

Size: 1.16 KB

Versions: 4

Compression:

Stored size: 1.16 KB

Contents

#!/usr/bin/env ruby
add_load_path = lambda do
  path = File.join(File.dirname(__FILE__), '..', 'lib')
  $LOAD_PATH << path unless $LOAD_PATH.include? path
end

add_load_path.call # in case we execute via ./bin

require 'optparse'
require 'bumbler'

options = {}
OptionParser.new do |parser|
  parser.banner = <<BANNER
Bumbler shows how long loading your bundle components take.

Usage:
    bumbler

Options:
BANNER
  parser.on("-t", "--threshold MILISECONDS", Integer, "Threshold in ms to be listed as slow") { |t| options[:threshold] = t }
  parser.on("--initializers", "Show load time of initializers") { options[:initializers] = true }
  parser.on("-h", "--help", "Show this.") { puts parser; exit }
  parser.on('-v', '--version', 'Show Version'){ puts Bumbler::VERSION; exit}
end.parse!

Bumbler::Hooks.slow_threshold = options[:threshold] if options[:threshold]

if options[:initializers]
  require './config/application'
  add_load_path.call # bundler kicks us out
  require 'bumbler/track_initializers'
  require './config/environment'
else
  require 'bumbler/go'
  require './config/environment'
  add_load_path.call # bundler kicks us out
end

Bumbler::Stats.all_slow_items

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bumbler-0.5.0 bin/bumbler
bumbler-0.4.0 bin/bumbler
bumbler-0.3.2 bin/bumbler
bumbler-0.3.1 bin/bumbler