Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 67 lines (48 sloc) 1.7 KB
#!/usr/bin/env ruby
lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'holepicker'
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: #{File.basename($0)} [options] paths..."
opts.on("-a", "--all", "Don't skip directories like .git or tmp while looking for gemfiles") do
options[:dont_skip] = true
end
opts.on("-c", "--current", "Look for gemfiles only in 'current' directories") do
options[:current] = true
end
opts.on("-f", "--follow-roots", "Follow root/DocumentRoot paths in Nginx/Apache configs to find gemfiles") do
options[:follow_roots] = true
end
opts.on("-i", "--ignore gem1,gem2,gem3", Array, "Ignore given gems") do |names|
options[:ignored_gems] = names
end
opts.on("--no-color", "Disable output coloring") do
HolePicker.logger.color = false
end
opts.on("-o", "--offline", "Use an offline copy of the data.json file") do
options[:offline] = true
end
opts.on("-s", "--silent", "Silent mode - disable info-level logging, only print errors") do
HolePicker.logger.level = Logger::ERROR
end
opts.on("--stdin", "Read a gemfile directly from STDIN instead of paths given in arguments") do
options[:stdin] = true
end
opts.on("-h", "--help", "Display this help") do
HolePicker.logger.info(opts)
exit
end
opts.on("-v", "--version", "Print gem version") do
HolePicker.logger.info(HolePicker::VERSION)
exit
end
opts.parse!
end
if ARGV.empty? && !options[:stdin]
HolePicker.logger.error "Please choose at least one directory to scan for gemfiles."
exit 1
end
success = HolePicker::Scanner.new(ARGV, options).scan
exit(success ? 0 : 1)