bigfiles 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/bigfiles/source_code_finder.rb +2 -2
- data/lib/bigfiles/version.rb +1 -1
- data/lib/bigfiles.rb +35 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41d328a76b807f9b04515205d044fb073501e061
|
4
|
+
data.tar.gz: aaf0ace57859750f58e8b96317d6c454d143cb8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bfd66a70391b9772bcfe9f4403bd568b9f3bad61630361bedb310b58441767b90d1cb24a33c68ff560bcdda415954d9d902a5995b45095f5e02341f88203414
|
7
|
+
data.tar.gz: 0079f1c6572aef4fd1a5694ec29a6723c225daf65bdce97064f71f3d25e9663d2a7cbb9aa530e7d3c36f7aeb4385d004fcbf73a80fa5196c9472098e0bda02c9
|
data/Rakefile
CHANGED
data/lib/bigfiles/version.rb
CHANGED
data/lib/bigfiles.rb
CHANGED
@@ -3,6 +3,9 @@ require 'optparse'
|
|
3
3
|
require_relative 'bigfiles/source_code_finder'
|
4
4
|
require_relative 'bigfiles/file_with_lines'
|
5
5
|
|
6
|
+
# XXX: Take out source_file_globber.rb from quality into its own gem
|
7
|
+
# and start building on that.
|
8
|
+
|
6
9
|
# Simple tool to find the largest source files in your project.
|
7
10
|
module BigFiles
|
8
11
|
# Simple tool to find the largest source files in your project.
|
@@ -12,17 +15,20 @@ module BigFiles
|
|
12
15
|
exiter: Kernel,
|
13
16
|
file_with_lines: FileWithLines,
|
14
17
|
source_file_finder: SourceCodeFinder.new,
|
15
|
-
|
16
|
-
@io
|
18
|
+
option_parser_class: OptionParser)
|
19
|
+
@io = io
|
20
|
+
@exiter = exiter
|
21
|
+
@file_with_lines = file_with_lines
|
17
22
|
@source_file_finder = source_file_finder
|
18
|
-
@
|
23
|
+
@option_parser_class = option_parser_class
|
19
24
|
@options = parse_options(args)
|
20
25
|
end
|
21
26
|
|
22
27
|
def parse_options(args)
|
23
28
|
options = nil
|
24
|
-
@
|
29
|
+
@option_parser_class.new do |opts|
|
25
30
|
options = setup_options(opts)
|
31
|
+
@option_parser = opts
|
26
32
|
end.parse!(args)
|
27
33
|
options
|
28
34
|
end
|
@@ -34,26 +40,46 @@ module BigFiles
|
|
34
40
|
@options[:glob] || DEFAULT_GLOB
|
35
41
|
end
|
36
42
|
|
37
|
-
def
|
38
|
-
options
|
39
|
-
|
43
|
+
def exclude_glob
|
44
|
+
@options[:exclude] || ''
|
45
|
+
end
|
46
|
+
|
47
|
+
def add_glob_option(opts, options)
|
40
48
|
opts.on('-g glob here', '--glob',
|
41
49
|
"Which files to parse - default is #{DEFAULT_GLOB}") do |v|
|
42
50
|
options[:glob] = v
|
43
51
|
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_exclude_glob_option(opts, options)
|
55
|
+
opts.on('-e glob here', '--exclude-glob',
|
56
|
+
'Files to exclude - default is none') do |v|
|
57
|
+
options[:exclude] = v
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def add_help_option(opts, options)
|
44
62
|
opts.on('-h', '--help', 'This message') do |_|
|
45
63
|
options[:help] = true
|
46
64
|
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def setup_options(opts)
|
68
|
+
options = {}
|
69
|
+
opts.banner = 'Usage: bigfiles [options]'
|
70
|
+
add_glob_option(opts, options)
|
71
|
+
add_exclude_glob_option(opts, options)
|
72
|
+
add_help_option(opts, options)
|
47
73
|
options
|
48
74
|
end
|
49
75
|
|
50
76
|
def usage
|
51
|
-
@io.puts
|
77
|
+
@io.puts @option_parser
|
52
78
|
@exiter.exit 1
|
53
79
|
end
|
54
80
|
|
55
81
|
def find_analyze_and_report_on_files
|
56
|
-
file_list = @source_file_finder.find(glob)
|
82
|
+
file_list = @source_file_finder.find(glob, exclude_glob)
|
57
83
|
files_with_lines = file_list.map do |filename|
|
58
84
|
@file_with_lines.new(filename)
|
59
85
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigfiles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vince Broz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|