jstats 0.0.6 → 0.0.7
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 +4 -4
- data/lib/jstats/loc.rb +46 -0
- data/lib/jstats_version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a92a291a3cee27f72d3ae80f530f6c0010518ce
|
4
|
+
data.tar.gz: 982cf5a583fb7e351699df5b85ad0f2ecce18392
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 193fe61cc4e19d569e8570516814bbcf59db7e1e0b4dc68bf8f7c1b3ee8726506f8a2451814dd0c8f0a61a58352864fdcae660703fbd025d43d853a29073931a
|
7
|
+
data.tar.gz: 3c322251fc7c64fda5d76c1734656d39ff478994a82a1456fa6a8cfc02f9ab17a32b15177d768343e871445cc07eddf0cd061ed303ad958c38b3f719d88ed0e7
|
data/lib/jstats/loc.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
module Jstats
|
2
|
+
|
3
|
+
class Loc
|
4
|
+
|
5
|
+
attr_reader :tables
|
6
|
+
|
7
|
+
def initialize(directories)
|
8
|
+
@java_files = JavaParse::JavaFiles.new(directories)
|
9
|
+
@distrib = {(0...100) => 0, (100...200) => 0, (200...300) => 0, (300...400) => 0, (400...500) => 0, (500...600) => 0,
|
10
|
+
(600...700) => 0, (700...800) => 0, (800...900) => 0, (900...1000) => 0, (1000...5000) => 0 }
|
11
|
+
run_distrib
|
12
|
+
@tables = [total_lines_table, distribution_table]
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def run_distrib
|
18
|
+
@distrib_rows = []
|
19
|
+
@java_files.each { |unit|
|
20
|
+
@distrib.each_key { |range|
|
21
|
+
@distrib[range] = @distrib[range] + 1 if range.include? unit.all_lines
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
@distrib.to_a.each { |d| @distrib_rows << d}
|
26
|
+
|
27
|
+
@distrib_rows.each { |row|
|
28
|
+
row.push(sprintf('%.1f', (row[1] * 100) / (@java_files.count).to_f) + ' %')
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def distribution_table
|
33
|
+
Terminal::Table.new :title => "Files size distribution",
|
34
|
+
:headings => ['Lines range', 'Files in range', ' % ' ],
|
35
|
+
:rows => @distrib_rows
|
36
|
+
end
|
37
|
+
|
38
|
+
def total_lines_table
|
39
|
+
Terminal::Table.new :title => "Processing #{@java_files.count} Java Files",
|
40
|
+
:headings => ['All lines', 'Lines of code', 'Lines of comments', 'Blank lines' ],
|
41
|
+
:rows => [[@java_files.count(:all_lines), @java_files.count(:loc), @java_files.count(:cloc), @java_files.count(:bloc)]]
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Caplette
|
@@ -91,6 +91,7 @@ extra_rdoc_files:
|
|
91
91
|
files:
|
92
92
|
- bin/jstats
|
93
93
|
- lib/jstats_version.rb
|
94
|
+
- lib/jstats/loc.rb
|
94
95
|
- README.rdoc
|
95
96
|
- jstats.rdoc
|
96
97
|
homepage: https://github.com/simcap/jstats
|