code_statistics 0.2.8 → 0.2.9
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.
- data/VERSION +1 -1
- data/code_statistics.gemspec +2 -2
- data/lib/code_statistics/code_statistics.rb +14 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.9
|
data/code_statistics.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{code_statistics}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dan Mayer"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-05}
|
13
13
|
s.default_executable = %q{code_statistics}
|
14
14
|
s.description = %q{"This is a port of the rails 'rake stats' method so it can be made more robust and work for non rails projects. New features may eventually be added as well."}
|
15
15
|
s.email = %q{dan@devver.net}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
1
3
|
module CodeStatistics
|
2
4
|
class CodeStatistics #:nodoc:
|
3
5
|
|
@@ -12,12 +14,15 @@ module CodeStatistics
|
|
12
14
|
directory = Dir.pwd
|
13
15
|
@ignore_files = collect_files_to_ignore(ignore_file_globs)
|
14
16
|
|
17
|
+
@pairs = remove_duplicate_pairs(@pairs)
|
18
|
+
|
15
19
|
directories_to_search = ['app','test','spec','merb','features', 'bin']
|
16
20
|
directories_to_search = remove_included_pairs(directories_to_search, @pairs)
|
17
21
|
recursively_add_directories(directories_to_search)
|
18
22
|
|
19
23
|
@pairs.each do |key, dir_path|
|
20
|
-
add_test_type(key) if dir_path.match(/^test/) || dir_path.match(/^spec/) || dir_path.match(/^features/)
|
24
|
+
add_test_type(key) if dir_path.match(/^test/) || dir_path.match(/^spec/) || dir_path.match(/^features/) ||
|
25
|
+
dir_path.match(/test$/) || dir_path.match(/spec$/) || dir_path.match(/features$/)
|
21
26
|
end
|
22
27
|
|
23
28
|
@statistics = calculate_statistics
|
@@ -81,6 +86,14 @@ module CodeStatistics
|
|
81
86
|
|
82
87
|
private
|
83
88
|
|
89
|
+
#user suplied paths and set paths might slight differ like path/name and path/name/ this filters those out
|
90
|
+
def remove_duplicate_pairs(pairs)
|
91
|
+
unique_pairs = []
|
92
|
+
paths = pairs.map{|pair| [pair.first, Pathname.new(pair.last).realpath.to_s] }
|
93
|
+
paths.each{|path| unique_pairs << path unless unique_pairs.map{|u_path| u_path.last}.include?(path.last)}
|
94
|
+
unique_pairs
|
95
|
+
end
|
96
|
+
|
84
97
|
def calculate_statistics
|
85
98
|
@pairs.inject({}) { |stats, pair| stats[pair.first] = calculate_directory_statistics(pair.last); stats }
|
86
99
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_statistics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Mayer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-05 00:00:00 -05:00
|
13
13
|
default_executable: code_statistics
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|