bin/bumbler in bumbler-0.2.1 vs bin/bumbler in bumbler-0.3.0

- old
+ new

@@ -2,22 +2,34 @@ $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib') 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("-h", "--help","Show this.") { puts parser; exit } - parser.on('-v', '--version','Show Version'){ puts Bumbler::VERSION; exit} + 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! -require 'bumbler/go' -require './config/environment' +Bumbler::Hooks.slow_threshold = options[:threshold] if options[:threshold] + +if options[:initializers] + require './config/application' + require 'bumbler/track_initializers' + require './config/environment' +else + require 'bumbler/go' + require './config/environment' +end + $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib') # bundler kicks us out Bumbler::Stats.all_slow_items