olde_code_finder 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 024cfb48a1a1c3d945b162387c8ddc55047361e1
4
+ data.tar.gz: 3a42572139ec44e254c1f61adcadd1b9f9fe17ee
5
+ SHA512:
6
+ metadata.gz: 76cb36fb48b903b9e6be35477650a4f9fb523294e42f3a1d9b0d4206b14de626e5351a033a174ae9aeadc793fcd1804fbbedc3583129f59c4bc54a1ffbd41376
7
+ data.tar.gz: 5a136df3f5b3a37728b7668437559f1514907d76071c671be54cd11807c1b345c4a1a7ea48ade7f6e9eb00b7eef2e7be8c59f7e862a03ffef35568b4fbeae193
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.2
data/CHANGELOG.md ADDED
@@ -0,0 +1,2 @@
1
+ ??, 2014: 0.0.1
2
+ Initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in olde_code_finder.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,17 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ olde_code_finder (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ rake (10.2.2)
10
+
11
+ PLATFORMS
12
+ ruby
13
+
14
+ DEPENDENCIES
15
+ bundler (~> 1.3)
16
+ olde_code_finder!
17
+ rake
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Tom Copeland
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # OldeCodeFinder
2
+
3
+ OldeCodeFinder finds files which were mostly written by a particular person. So if Fred left the company 3 years ago,
4
+ files which consist mostly of lines which were written by him made be worth revisiting.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's `Gemfile` in the 'development' group:
9
+
10
+ gem 'olde_code_finder'
11
+
12
+ And add this to your `Rakefile`:
13
+
14
+ begin; require 'olde_code_finder/tasks'; rescue LoadError; end
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install olde_code_finder
23
+
24
+ ## Usage
25
+
26
+ See if more than 80% of `app/models/foo.rb` was written by Benjamin Franklin:
27
+
28
+ bundle exec rake olde_code_finder:find['app/models/foo.rb','Benjamin Franklin','80']
29
+
30
+ Or you can use a glob:
31
+
32
+ bundle exec rake olde_code_finder:find['app/models/*.rb','Benjamin Franklin','80']
33
+
34
+ Or you can specify a lower percentage threshold:
35
+
36
+ bundle exec rake olde_code_finder:find['app/models/*.rb','Benjamin Franklin','60']
37
+
38
+ The author name is a regex, so this will find 'Benjamin Franklin' as well as 'Ben Franklin':
39
+
40
+ bundle exec rake olde_code_finder:find['app/models/*.rb','Frank','80']
41
+
42
+ The output will be a list of files that meet the criteria:
43
+
44
+ foo> $ bundle exec rake olde_code_finder:find['app/models/*.rb','Benjamin Franklin','80']
45
+ More than 80% of app/models/foobar.rb was written by Benjamin Franklin
46
+
47
+ ## How does it work?
48
+
49
+ It uses `git blame` to see who last touched each line of a file.
50
+
51
+ ## Contributing
52
+
53
+ 1. Fork it ( http://github.com/<my-github-username>/olde_code_finder/fork )
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :test
4
+ require 'rake/testtask'
5
+ Rake::TestTask.new(:test) do |test|
6
+ test.libs << 'lib' << 'test'
7
+ test.pattern = 'test/**/*_test.rb'
8
+ test.verbose = true
9
+ end
@@ -0,0 +1,19 @@
1
+ namespace :olde_code_finder do
2
+
3
+ def checkit(file, author, pctg)
4
+ blame_output = `git blame #{file}`.split("\n")
5
+ total_lines = blame_output.size
6
+ author_lines = blame_output.grep(/#{author}/).size
7
+ if (author_lines / total_lines.to_f) > (pctg.to_f / 100.0)
8
+ puts "More than #{pctg}% of #{file} was written by #{author}"
9
+ end
10
+ end
11
+
12
+ # e.g., bundle exec rake olde_code_finder:find['app/models/partner*','Ben Franklin','80']
13
+ desc "Find old code by a particular person"
14
+ task :find, [:glob, :author, :pctg] => :environment do |task, args|
15
+ Dir[args[:glob]].each do |file|
16
+ checkit(file, args[:author], args[:pctg])
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module OldeCodeFinder
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,2 @@
1
+ require 'olde_code_finder/version'
2
+ require 'olde_code_finder/tasks'
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'olde_code_finder/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "olde_code_finder"
8
+ spec.version = OldeCodeFinder::VERSION
9
+ spec.authors = ["Tom Copeland"]
10
+ spec.email = ["tom.copeland@livingsocial.com"]
11
+ spec.summary = %q{OldeCodeFinder finds your olde code.}
12
+ spec.description = %q{OldeCodeFinder finds your olde code.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
Binary file
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: olde_code_finder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Tom Copeland
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: OldeCodeFinder finds your olde code.
42
+ email:
43
+ - tom.copeland@livingsocial.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".ruby-version"
49
+ - CHANGELOG.md
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - lib/olde_code_finder.rb
56
+ - lib/olde_code_finder/tasks.rb
57
+ - lib/olde_code_finder/version.rb
58
+ - olde_code_finder.gemspec
59
+ - vendor/cache/rake-10.2.2.gem
60
+ homepage: ''
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.2.2
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: OldeCodeFinder finds your olde code.
84
+ test_files: []