Sha256: 0df1c1a92127ea8529d37c8ceb99ef1e290c29c7d4af186fdeb89146430da509
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true # in case we execute via ./bin add_load_path = -> do local_lib = File.expand_path('../lib', __dir__) $LOAD_PATH << local_lib unless $LOAD_PATH.include? local_lib end add_load_path.call 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 MILLISECONDS", Integer, "Threshold in ms to be listed as slow") do |t| options[:threshold] = t end parser.on("--initializers", "Show load time of initializers") { options[:initializers] = true } parser.on("--all", "Show all load times") { options[:all] = true } parser.on("-h", "--help", "Show this.") { puts parser; exit } parser.on('-v', '--version', 'Show Version') { puts Bumbler::VERSION; exit } end.parse! abort "Not arguments supported" unless ARGV.empty? 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' elsif File.exist?('./config/environment.rb') require 'bumbler/go' require './config/environment' add_load_path.call # bundler kicks us out else require 'bumbler/go' Bundler.require(*Bundler.definition.groups) end Bumbler::Stats.print_overview if options[:all] Bumbler::Stats.print_tracked_items else Bumbler::Stats.print_slow_items end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bumbler-0.9.0 | bin/bumbler |