bigfiles 0.1.2 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +134 -0
- data/.envrc +2 -0
- data/.git-hooks/pre_commit/circle_ci.rb +21 -0
- data/.gitattributes +6 -0
- data/.gitignore +65 -0
- data/.overcommit.yml +55 -0
- data/.rubocop.yml +116 -0
- data/.rubocop_todo.yml +13 -0
- data/.yamllint.yml +8 -0
- data/CODE_OF_CONDUCT.md +133 -0
- data/DEVELOPMENT.md +30 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +110 -0
- data/LICENSE +21 -0
- data/Makefile +73 -0
- data/README.md +60 -0
- data/Rakefile +3 -30
- data/bigfiles.gemspec +44 -30
- data/bin/bigfiles +26 -2
- data/bin/bump +29 -0
- data/bin/overcommit +29 -0
- data/bin/rake +29 -0
- data/coverage/.last_run.json +6 -0
- data/docs/cookiecutter_input.json +13 -0
- data/exe/bigfiles +6 -0
- data/feature/big_files_cli_spec.rb +49 -0
- data/feature/expected/four_files_results.txt +3 -0
- data/feature/expected/no_files_results.txt +0 -0
- data/feature/expected/swift_and_ruby_files_results.txt +3 -0
- data/feature/expected/swift_zorb_and_ruby_files_excluded_results.txt +3 -0
- data/feature/expected/swift_zorb_and_ruby_files_results.txt +3 -0
- data/feature/expected/three_files_results.txt +3 -0
- data/feature/feature_helper.rb +33 -0
- data/feature/pronto_big_files_use_spec.rb +54 -0
- data/feature/samples/four_files/five_lines.rb +5 -0
- data/feature/samples/four_files/four_lines.rb +4 -0
- data/feature/samples/four_files/three_lines.rb +3 -0
- data/feature/samples/four_files/two_lines.rb +2 -0
- data/feature/samples/no_files/.keepme +0 -0
- data/feature/samples/swift_and_ruby_files/five_lines.swift +5 -0
- data/feature/samples/swift_and_ruby_files/four_lines.rb +4 -0
- data/feature/samples/swift_and_ruby_files/three_lines.rb +3 -0
- data/feature/samples/swift_zorb_and_ruby_files/five_lines.swift +5 -0
- data/feature/samples/swift_zorb_and_ruby_files/four_lines.zorb +4 -0
- data/feature/samples/swift_zorb_and_ruby_files/three_lines.rb +3 -0
- data/feature/samples/swift_zorb_and_ruby_files_excluded/excluded.rb +9 -0
- data/feature/samples/swift_zorb_and_ruby_files_excluded/five_lines.swift +5 -0
- data/feature/samples/swift_zorb_and_ruby_files_excluded/four_lines.zorb +4 -0
- data/feature/samples/swift_zorb_and_ruby_files_excluded/three_lines.rb +3 -0
- data/feature/samples/three_files/five_lines.rb +5 -0
- data/feature/samples/three_files/four_lines.rb +4 -0
- data/feature/samples/three_files/three_lines.rb +3 -0
- data/fix.sh +371 -0
- data/lib/bigfiles/config.rb +38 -0
- data/lib/bigfiles/file_with_lines.rb +2 -0
- data/lib/bigfiles/inspector.rb +35 -0
- data/lib/bigfiles/option_parser.rb +54 -0
- data/lib/bigfiles/version.rb +3 -1
- data/lib/bigfiles.rb +27 -63
- data/rakelib/citest.rake +4 -0
- data/rakelib/clear_metrics.rake +17 -0
- data/rakelib/console.rake +6 -0
- data/rakelib/default.rake +4 -0
- data/rakelib/feature.rake +10 -0
- data/rakelib/gem_tasks.rake +3 -0
- data/rakelib/localtest.rake +4 -0
- data/rakelib/overcommit.rake +6 -0
- data/rakelib/quality.rake +4 -0
- data/rakelib/repl.rake +4 -0
- data/rakelib/spec.rake +9 -0
- data/rakelib/undercover.rake +8 -0
- data/requirements_dev.txt +2 -0
- metadata +207 -30
data/Gemfile.lock
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bigfiles (0.2.2)
|
5
|
+
high_water_mark
|
6
|
+
source_finder (>= 2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.2)
|
12
|
+
bump (0.10.0)
|
13
|
+
childprocess (4.1.0)
|
14
|
+
coderay (1.1.3)
|
15
|
+
diff-lcs (1.4.4)
|
16
|
+
docile (1.4.0)
|
17
|
+
ffi (1.15.4-java)
|
18
|
+
high_water_mark (0.1.0)
|
19
|
+
imagen (0.1.8)
|
20
|
+
parser (>= 2.5, != 2.5.1.1)
|
21
|
+
iniparse (1.5.0)
|
22
|
+
method_source (1.0.0)
|
23
|
+
overcommit (0.58.0)
|
24
|
+
childprocess (>= 0.6.3, < 5)
|
25
|
+
iniparse (~> 1.4)
|
26
|
+
rexml (~> 3.2)
|
27
|
+
parallel (1.21.0)
|
28
|
+
parser (3.0.2.0)
|
29
|
+
ast (~> 2.4.1)
|
30
|
+
pry (0.14.1)
|
31
|
+
coderay (~> 1.1)
|
32
|
+
method_source (~> 1.0)
|
33
|
+
pry (0.14.1-java)
|
34
|
+
coderay (~> 1.1)
|
35
|
+
method_source (~> 1.0)
|
36
|
+
spoon (~> 0.0)
|
37
|
+
rainbow (3.0.0)
|
38
|
+
rake (13.0.6)
|
39
|
+
regexp_parser (2.1.1)
|
40
|
+
rexml (3.2.5)
|
41
|
+
rspec (3.10.0)
|
42
|
+
rspec-core (~> 3.10.0)
|
43
|
+
rspec-expectations (~> 3.10.0)
|
44
|
+
rspec-mocks (~> 3.10.0)
|
45
|
+
rspec-core (3.10.1)
|
46
|
+
rspec-support (~> 3.10.0)
|
47
|
+
rspec-expectations (3.10.1)
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
+
rspec-support (~> 3.10.0)
|
50
|
+
rspec-mocks (3.10.2)
|
51
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
+
rspec-support (~> 3.10.0)
|
53
|
+
rspec-support (3.10.3)
|
54
|
+
rubocop (1.23.0)
|
55
|
+
parallel (~> 1.10)
|
56
|
+
parser (>= 3.0.0.0)
|
57
|
+
rainbow (>= 2.2.2, < 4.0)
|
58
|
+
regexp_parser (>= 1.8, < 3.0)
|
59
|
+
rexml
|
60
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
61
|
+
ruby-progressbar (~> 1.7)
|
62
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
63
|
+
rubocop-ast (1.13.0)
|
64
|
+
parser (>= 3.0.1.1)
|
65
|
+
rubocop-rake (0.6.0)
|
66
|
+
rubocop (~> 1.0)
|
67
|
+
rubocop-rspec (2.6.0)
|
68
|
+
rubocop (~> 1.19)
|
69
|
+
ruby-progressbar (1.11.0)
|
70
|
+
rugged (1.1.1)
|
71
|
+
simplecov (0.21.2)
|
72
|
+
docile (~> 1.1)
|
73
|
+
simplecov-html (~> 0.11)
|
74
|
+
simplecov_json_formatter (~> 0.1)
|
75
|
+
simplecov-html (0.12.3)
|
76
|
+
simplecov-lcov (0.8.0)
|
77
|
+
simplecov_json_formatter (0.1.3)
|
78
|
+
source_finder (3.2.1)
|
79
|
+
spoon (0.0.6)
|
80
|
+
ffi
|
81
|
+
undercover (0.4.3)
|
82
|
+
imagen (>= 0.1.8)
|
83
|
+
rainbow (>= 2.1, < 4.0)
|
84
|
+
rugged (>= 0.27, < 1.2)
|
85
|
+
unicode-display_width (2.1.0)
|
86
|
+
|
87
|
+
PLATFORMS
|
88
|
+
java
|
89
|
+
ruby
|
90
|
+
x86_64-darwin-19
|
91
|
+
x86_64-darwin-20
|
92
|
+
x86_64-linux
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
bigfiles!
|
96
|
+
bump
|
97
|
+
bundler
|
98
|
+
overcommit (>= 0.58.0)
|
99
|
+
pry
|
100
|
+
rake (~> 13.0)
|
101
|
+
rspec (>= 3.4)
|
102
|
+
rubocop
|
103
|
+
rubocop-rake
|
104
|
+
rubocop-rspec
|
105
|
+
simplecov (>= 0.18.0)
|
106
|
+
simplecov-lcov
|
107
|
+
undercover
|
108
|
+
|
109
|
+
BUNDLED WITH
|
110
|
+
2.2.25
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2013-2021, Vince Broz
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
.PHONY: clean test help quality localtest spec feature
|
2
|
+
.DEFAULT_GOAL := default
|
3
|
+
|
4
|
+
define PRINT_HELP_PYSCRIPT
|
5
|
+
import re, sys
|
6
|
+
|
7
|
+
for line in sys.stdin:
|
8
|
+
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
|
9
|
+
if match:
|
10
|
+
target, help = match.groups()
|
11
|
+
print("%-20s %s" % (target, help))
|
12
|
+
endef
|
13
|
+
export PRINT_HELP_PYSCRIPT
|
14
|
+
|
15
|
+
help:
|
16
|
+
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
|
17
|
+
|
18
|
+
default: localtest ## run default tests and quality
|
19
|
+
|
20
|
+
requirements_dev.txt.installed: requirements_dev.txt
|
21
|
+
pip install -q --disable-pip-version-check -r requirements_dev.txt
|
22
|
+
touch requirements_dev.txt.installed
|
23
|
+
|
24
|
+
pip_install: requirements_dev.txt.installed ## Install Python dependencies
|
25
|
+
|
26
|
+
# bundle install doesn't get run here so that we can catch it below in
|
27
|
+
# fresh-checkout and fresh-rbenv cases
|
28
|
+
Gemfile.lock: Gemfile
|
29
|
+
|
30
|
+
# Ensure any Gemfile.lock changes ensure a bundle is installed.
|
31
|
+
Gemfile.lock.installed: Gemfile.lock
|
32
|
+
bundle install
|
33
|
+
touch Gemfile.lock.installed
|
34
|
+
|
35
|
+
bundle_install: Gemfile.lock.installed ## Install Ruby dependencies
|
36
|
+
|
37
|
+
clear_metrics: ## remove or reset result artifacts created by tests and quality tools
|
38
|
+
bundle exec rake clear_metrics
|
39
|
+
|
40
|
+
clean: clear_metrics ## remove all built artifacts
|
41
|
+
|
42
|
+
test: spec ## run tests quickly
|
43
|
+
|
44
|
+
overcommit: ## run precommit quality checks
|
45
|
+
bundle exec overcommit --run
|
46
|
+
|
47
|
+
quality: overcommit ## run precommit quality checks
|
48
|
+
|
49
|
+
spec: ## Run lower-level tests
|
50
|
+
@bundle exec rake spec
|
51
|
+
|
52
|
+
feature: ## Run higher-level tests
|
53
|
+
@bundle exec rake feature
|
54
|
+
|
55
|
+
localtest: ## run default local actions
|
56
|
+
@bundle exec rake localtest
|
57
|
+
|
58
|
+
repl: ## Load up bigfiles in pry
|
59
|
+
@bundle exec rake repl
|
60
|
+
|
61
|
+
update_from_cookiecutter: ## Bring in changes from template project used to create this repo
|
62
|
+
bundle exec overcommit --uninstall
|
63
|
+
IN_COOKIECUTTER_PROJECT_UPGRADER=1 cookiecutter_project_upgrader || true
|
64
|
+
git checkout cookiecutter-template && git push && git checkout main
|
65
|
+
git checkout main && git pull && git checkout -b update-from-cookiecutter-$$(date +%Y-%m-%d-%H%M)
|
66
|
+
git merge cookiecutter-template || true
|
67
|
+
bundle exec overcommit --install
|
68
|
+
@echo
|
69
|
+
@echo "Please resolve any merge conflicts below and push up a PR with:"
|
70
|
+
@echo
|
71
|
+
@echo ' gh pr create --title "Update from cookiecutter" --body "Automated PR to update from cookiecutter boilerplate"'
|
72
|
+
@echo
|
73
|
+
@echo
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# BigFiles
|
2
|
+
|
3
|
+
[](https://circleci.com/gh/apiology/bigfiles)
|
4
|
+
|
5
|
+
|
6
|
+
Simple tool to find the largest source files in your project - maybe
|
7
|
+
to target for refactoring!
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'bigfiles'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
```sh
|
20
|
+
bundle
|
21
|
+
```
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
```sh
|
26
|
+
gem install bigfiles
|
27
|
+
```
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
This is typically used as part of general use of the
|
32
|
+
[quality](https://github.com/apiology/quality) gem. You can also run
|
33
|
+
it on the command line directly:
|
34
|
+
|
35
|
+
```sh
|
36
|
+
$ bigfiles
|
37
|
+
165: spec/big_files/big_files_spec.rb
|
38
|
+
76: .rubocop.yml
|
39
|
+
59: spec/big_files/file_with_lines_spec.rb
|
40
|
+
$
|
41
|
+
```
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
Bug reports and pull requests are welcome on
|
46
|
+
[GitHub](https://github.com/apiology/bigfiles). This project
|
47
|
+
is intended to be a safe, welcoming space for collaboration, and
|
48
|
+
contributors are expected to adhere to the
|
49
|
+
[Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
50
|
+
|
51
|
+
## License
|
52
|
+
|
53
|
+
The gem is available as open source under the terms of the
|
54
|
+
[MIT License](https://opensource.org/licenses/MIT).
|
55
|
+
|
56
|
+
## Code of Conduct
|
57
|
+
|
58
|
+
Everyone interacting in the Pronto::Punchlist project’s codebases,
|
59
|
+
issue trackers, chat rooms and mailing lists is expected to follow the
|
60
|
+
[code of conduct](https://github.com/apiology/bigfiles/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,30 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
Quality::Rake::Task.new do |task|
|
6
|
-
task.skip_tools = ['reek']
|
7
|
-
task.output_dir = 'metrics'
|
8
|
-
end
|
9
|
-
|
10
|
-
desc 'Run specs'
|
11
|
-
RSpec::Core::RakeTask.new(:spec) do |task|
|
12
|
-
task.pattern = 'spec/**/*_spec.rb'
|
13
|
-
task.rspec_opts = '--format doc'
|
14
|
-
end
|
15
|
-
|
16
|
-
desc 'Run features'
|
17
|
-
RSpec::Core::RakeTask.new(:feature) do |task|
|
18
|
-
task.pattern = 'feature/**/*_spec.rb'
|
19
|
-
task.rspec_opts = '--format doc'
|
20
|
-
end
|
21
|
-
|
22
|
-
task :clear_metrics do |_t|
|
23
|
-
ret =
|
24
|
-
system('git checkout coverage/.last_run.json metrics/*_high_water_mark')
|
25
|
-
fail unless ret
|
26
|
-
end
|
27
|
-
|
28
|
-
desc 'Default: Run specs and check quality.'
|
29
|
-
task localtest: [:clear_metrics, :spec, :feature, :quality]
|
30
|
-
task default: [:localtest]
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Add your own tasks in files placed in rakelib/ ending in .rake,
|
3
|
+
# for example rakelib/capistrano.rake, and they will automatically be available to Rake.
|
data/bigfiles.gemspec
CHANGED
@@ -1,35 +1,49 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
|
1
|
+
# coding: ascii
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
lib = File.expand_path('lib', __dir__)
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
6
|
require 'bigfiles/version'
|
5
7
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'bigfiles'
|
10
|
+
spec.version = BigFiles::VERSION
|
11
|
+
spec.authors = ['Vince Broz']
|
12
|
+
spec.email = ['vince@broz.cc']
|
13
|
+
spec.summary = 'Finds largest source files in a project'
|
14
|
+
spec.homepage = 'https://github.com/apiology/bigfiles'
|
15
|
+
spec.license = 'MIT license'
|
16
|
+
spec.required_ruby_version = '>= 2.6'
|
17
|
+
|
18
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
20
|
+
f.match(%r{^(test|spec|features)/})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ['lib']
|
9
26
|
|
10
|
-
|
11
|
-
|
12
|
-
'and reports on them'
|
13
|
-
s.email = ['vince@broz.cc']
|
14
|
-
s.executables = ['bigfiles']
|
15
|
-
# s.extra_rdoc_files = ["CHANGELOG", "License.txt"]
|
16
|
-
s.license = 'MIT'
|
17
|
-
s.files = Dir['License.txt', 'README.md',
|
18
|
-
'Rakefile',
|
19
|
-
'bin/bigfiles',
|
20
|
-
'{lib}/**/*',
|
21
|
-
'bigfiles.gemspec'] & `git ls-files -z`.split("\0")
|
22
|
-
# s.rdoc_options = ["--main", "README.md"]
|
23
|
-
s.require_paths = ['lib']
|
24
|
-
s.homepage = 'http://github.com/apiology/bigfiles'
|
25
|
-
# s.rubyforge_project = %q{bigfiles}
|
26
|
-
s.rubygems_version = '1.3.6'
|
27
|
-
s.summary = 'Finds largest source files in a project'
|
27
|
+
spec.add_dependency('high_water_mark')
|
28
|
+
spec.add_dependency('source_finder', ['>=2'])
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
s
|
34
|
-
|
30
|
+
spec.add_development_dependency 'bump'
|
31
|
+
spec.add_development_dependency 'bundler'
|
32
|
+
# 0.58.0 and 0.57.0 don't seem super compatible with signatures, and
|
33
|
+
# magit doesn't seem to want to use the bundled version at the moment,
|
34
|
+
# so let's favor the more recent version...
|
35
|
+
spec.add_development_dependency 'overcommit', ['>=0.58.0']
|
36
|
+
spec.add_development_dependency 'pry'
|
37
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
38
|
+
spec.add_development_dependency 'rspec', '>=3.4'
|
39
|
+
spec.add_development_dependency 'rubocop'
|
40
|
+
spec.add_development_dependency 'rubocop-rake'
|
41
|
+
spec.add_development_dependency 'rubocop-rspec'
|
42
|
+
# ensure version with branch coverage
|
43
|
+
spec.add_development_dependency 'simplecov', ['>=0.18.0']
|
44
|
+
spec.add_development_dependency 'simplecov-lcov'
|
45
|
+
spec.add_development_dependency 'undercover'
|
46
|
+
spec.metadata = {
|
47
|
+
'rubygems_mfa_required' => 'true',
|
48
|
+
}
|
35
49
|
end
|
data/bin/bigfiles
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bigfiles' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
4
10
|
|
5
|
-
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("bigfiles", "bigfiles")
|
data/bin/bump
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bump' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("bump", "bump")
|
data/bin/overcommit
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'overcommit' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("overcommit", "overcommit")
|
data/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("rake", "rake")
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"_template": "https://github.com/apiology/cookiecutter-gem",
|
3
|
+
"email": "vince@broz.cc",
|
4
|
+
"full_name": "Vince Broz",
|
5
|
+
"github_username": "apiology",
|
6
|
+
"module_name": "BigFiles",
|
7
|
+
"open_source_license": "MIT license",
|
8
|
+
"project_name": "BigFiles",
|
9
|
+
"project_short_description": "Simple tool to find the largest source files in your project.",
|
10
|
+
"project_slug": "bigfiles",
|
11
|
+
"type_of_github_repo": "public",
|
12
|
+
"version": "0.1.0"
|
13
|
+
}
|
data/exe/bigfiles
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'feature_helper'
|
4
|
+
|
5
|
+
describe BigFiles do
|
6
|
+
let(:default_glob) do
|
7
|
+
'{Dockerfile,Rakefile,{*,.*}.{c,clj,cljs,cpp,gemspec,groovy,html,' \
|
8
|
+
'java,js,json,py,rake,rb,scala,sh,swift,yml},{app,config,db,feature,' \
|
9
|
+
'lib,spec,src,test,tests,vars,www}/**/{*,.*}.{c,clj,cljs,cpp,gemspec,' \
|
10
|
+
'groovy,html,java,js,json,py,rake,rb,scala,sh,swift,yml}}'
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:usage) do
|
14
|
+
"Usage: bigfiles [options]\n" \
|
15
|
+
" -g, --glob glob here " \
|
16
|
+
"Which files to parse - default is #{default_glob}" \
|
17
|
+
"\n" \
|
18
|
+
" -e, --exclude-glob glob here " \
|
19
|
+
"Files to exclude - default is none\n" \
|
20
|
+
" -h, --help This message\n" \
|
21
|
+
" -n, --num-files number-here " \
|
22
|
+
"Top number of files to show--default 3\n"
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'starts up with no arguments' do
|
26
|
+
expect(exec_io('bigfiles -h')).to eq(usage)
|
27
|
+
end
|
28
|
+
|
29
|
+
# three_files one_file two_files some_nonsource_files many_files
|
30
|
+
# zero_byte_file
|
31
|
+
%w[no_files three_files four_files swift_and_ruby_files
|
32
|
+
swift_zorb_and_ruby_files
|
33
|
+
swift_zorb_and_ruby_files_excluded].each do |type|
|
34
|
+
context "with #{type}" do
|
35
|
+
let(:command) do
|
36
|
+
"cd feature/samples/#{type} && " \
|
37
|
+
"RUBYLIB=`pwd`/../../lib:\"\$RUBYLIB\" bigfiles " \
|
38
|
+
"--glob '*.{rb,swift,zorb}' " \
|
39
|
+
"--exclude-glob " \
|
40
|
+
"'{excluded.rb}'"
|
41
|
+
end
|
42
|
+
|
43
|
+
it "handles #{type} case" do
|
44
|
+
expect(exec_io(command))
|
45
|
+
.to eq(File.read("feature/expected/#{type}_results.txt"))
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
File without changes
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'open3'
|
4
|
+
require 'bigfiles'
|
5
|
+
|
6
|
+
# Add the bin directory, to allow testing of gem executables as if the gem is
|
7
|
+
# already installed.
|
8
|
+
root_dir = RSpec::Core::RubyProject.root
|
9
|
+
exec_dir = File.join(File::SEPARATOR, root_dir, 'bin')
|
10
|
+
ENV['PATH'] = [exec_dir, ENV['PATH']].join(File::PATH_SEPARATOR)
|
11
|
+
|
12
|
+
# Courtesy of:
|
13
|
+
# https://raw.github.com/cupakromer/tao-of-tdd/master/adder/spec/support/
|
14
|
+
# capture_exec.rb
|
15
|
+
def exec_io(*cmd)
|
16
|
+
cmd = cmd.flatten
|
17
|
+
out_err, _exit_code = Open3.capture2e(*cmd)
|
18
|
+
|
19
|
+
out_err
|
20
|
+
end
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
config.run_all_when_everything_filtered = true
|
24
|
+
config.order = 'random'
|
25
|
+
config.alias_it_should_behave_like_to :has_behavior
|
26
|
+
config.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
|
27
|
+
end
|
28
|
+
|
29
|
+
def let_double(*doubles)
|
30
|
+
doubles.each do |double_sym|
|
31
|
+
let(double_sym) { double(double_sym.to_s) }
|
32
|
+
end
|
33
|
+
end
|