This repository has been archived by the owner on Dec 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
holepicker
executable file
·66 lines (48 loc) · 1.7 KB
/
holepicker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/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)