code_statistics 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/code_statistics.gemspec +2 -2
- data/lib/code_statistics/code_statistics.rb +13 -16
- data/lib/tasks/code_stats.rb +12 -3
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.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.1.
|
8
|
+
s.version = "0.1.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{2009-11-
|
12
|
+
s.date = %q{2009-11-09}
|
13
13
|
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."}
|
14
14
|
s.email = %q{dan@devver.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -9,28 +9,25 @@ module CodeStatistics
|
|
9
9
|
@test_types = []
|
10
10
|
directory = Dir.pwd
|
11
11
|
@specs_found = false
|
12
|
-
|
13
|
-
#
|
14
|
-
add_test_type("Model specs") if local_file_exists?(directory, 'spec/models')
|
15
|
-
add_test_type("View specs") if local_file_exists?(directory, 'spec/views')
|
16
|
-
add_test_type("Controller specs") if local_file_exists?(directory, 'spec/controllers')
|
17
|
-
add_test_type("Helper specs") if local_file_exists?(directory, 'spec/helpers')
|
18
|
-
add_test_type("Library specs") if local_file_exists?(directory, 'spec/lib')
|
19
|
-
add_test_type("Routing specs") if local_file_exists?(directory, 'spec/routing')
|
20
|
-
add_test_type("Integration specs") if local_file_exists?(directory, 'spec/integration')
|
21
|
-
add_test_type("Public specs") if local_file_exists?(directory, 'spec/public')
|
22
|
-
add_test_type("Semipublic specs") if local_file_exists?(directory, 'spec/semipublic')
|
23
|
-
if @specs_found==false && local_file_exists?(directory, 'spec')
|
24
|
-
@pairs << %w(Specs spec)
|
25
|
-
add_test_type("Specs")
|
26
|
-
end
|
12
|
+
|
13
|
+
#if tests weren't broken up into test/unit functional etc, add the root test directory
|
27
14
|
if local_file_exists?(directory, 'test') &&
|
28
15
|
(!local_file_exists?(directory, 'test/unit') &&
|
29
16
|
!local_file_exists?(directory, 'test/functional') &&
|
30
17
|
!local_file_exists?(directory, 'test/integration'))
|
31
18
|
@pairs << %w(Tests test)
|
32
|
-
add_test_type("Tests")
|
33
19
|
end
|
20
|
+
|
21
|
+
@pairs.each do |key, dir_path|
|
22
|
+
add_test_type(key) if dir_path.match(/^test\//) || dir_path.match(/^spec\//)
|
23
|
+
end
|
24
|
+
|
25
|
+
#if spec tests weren't broken up into smaller test directories add the root spec directory
|
26
|
+
if @specs_found==false && local_file_exists?(directory, 'spec')
|
27
|
+
@pairs << %w(Specs spec)
|
28
|
+
add_test_type("Specs")
|
29
|
+
end
|
30
|
+
|
34
31
|
@statistics = calculate_statistics
|
35
32
|
@total = calculate_total if pairs.length > 1
|
36
33
|
end
|
data/lib/tasks/code_stats.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#todo for both spec and test look through top level add any directory seperately
|
2
2
|
#get rid of the hard coded test/units / etc in this file and the lib file.
|
3
|
-
|
3
|
+
stats_directories = [
|
4
4
|
%w(Controllers app/controllers),
|
5
5
|
%w(Helpers app/helpers),
|
6
6
|
%w(Models app/models),
|
@@ -19,9 +19,18 @@ STATS_DIRECTORIES = [
|
|
19
19
|
%w(Public\ specs spec/public),
|
20
20
|
%w(Semipublic\ specs spec/semipublic)
|
21
21
|
].collect { |name, dir| [ name, "#{Dir.pwd}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
|
22
|
-
|
22
|
+
|
23
|
+
if ENV['DIRECTORIES_TO_CALCULATE']
|
24
|
+
user_defined_dirs = ENV['DIRECTORIES_TO_CALCULATE'].split(',')
|
25
|
+
user_defined_dirs.each do |dir|
|
26
|
+
if File.directory?(dir)
|
27
|
+
stats_directories << [dir.capitalize, "#{Dir.pwd}/#{dir}"]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
23
32
|
desc "Report code statistics (KLOCs, etc) from the application"
|
24
33
|
task :stats do
|
25
34
|
require File.join(File.dirname(__FILE__), '..', 'code_statistics', 'code_statistics')
|
26
|
-
CodeStatistics::CodeStatistics.new(*
|
35
|
+
CodeStatistics::CodeStatistics.new(*stats_directories).to_s
|
27
36
|
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.1.
|
4
|
+
version: 0.1.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: 2009-11-
|
12
|
+
date: 2009-11-09 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|