jstats 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/jstats +6 -28
- data/lib/jstats_version.rb +1 -1
- metadata +2 -2
data/bin/jstats
CHANGED
@@ -17,6 +17,7 @@ require 'terminal-table'
|
|
17
17
|
require 'gli'
|
18
18
|
require 'javaparse'
|
19
19
|
require 'jstats_version'
|
20
|
+
require 'jstats/loc'
|
20
21
|
|
21
22
|
include GLI
|
22
23
|
|
@@ -32,8 +33,8 @@ version Jstats::VERSION
|
|
32
33
|
#arg_name 'The name of the argument'
|
33
34
|
#flag [:f,:flagname]
|
34
35
|
|
35
|
-
desc 'Overall lines
|
36
|
-
arg_name '
|
36
|
+
desc 'Overall lines count (code, comments, blank) and output file sizes distribution'
|
37
|
+
arg_name 'Java source files location'
|
37
38
|
command :loc do |c|
|
38
39
|
#c.desc 'Describe a switch to loc'
|
39
40
|
#c.switch :s
|
@@ -42,32 +43,9 @@ command :loc do |c|
|
|
42
43
|
#c.default_value 'default'
|
43
44
|
#c.flag :f
|
44
45
|
c.action do |global_options,options,args|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
(500...600) => 0, (600...700) => 0, (700...800) => 0, (800...900) => 0, (900...1000) => 0, (1000...5000) => 0 }
|
49
|
-
java_files.java_units.each { |unit|
|
50
|
-
file_line_count = unit.all_lines
|
51
|
-
distrib.each_key { |range|
|
52
|
-
distrib[range] = distrib[range] + 1 if range.include? file_line_count
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
rows = []
|
57
|
-
rows << [java_files.count(:all_lines), java_files.count(:loc), java_files.count(:cloc), java_files.count(:bloc)]
|
58
|
-
table = Terminal::Table.new :title => "Processing #{java_files.count} Java Files", :headings => ['All lines', 'Lines of code', 'Lines of comments', 'Blank lines' ], :rows => rows
|
59
|
-
|
60
|
-
distrib_rows = []
|
61
|
-
distrib.to_a.each { |d| distrib_rows << d}
|
62
|
-
|
63
|
-
distrib_rows.each { |row|
|
64
|
-
row.push(sprintf('%.1f', (row[1] * 100) / files_count.to_f) + ' %')
|
65
|
-
}
|
66
|
-
|
67
|
-
distrib_table = Terminal::Table.new :title => "Files size distribution", :headings => ['Lines range', 'Files in range', ' % ' ], :rows => distrib_rows
|
68
|
-
|
69
|
-
puts table
|
70
|
-
puts distrib_table
|
46
|
+
tables = Jstats::Loc.new(*args).tables
|
47
|
+
puts tables[0]
|
48
|
+
puts tables[1]
|
71
49
|
end
|
72
50
|
end
|
73
51
|
|
data/lib/jstats_version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|