josephine 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/josephine +1 -1
- data/lib/josephine.rb +28 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8b569bed9ecb093d679a47268f118c72fadf3e5
|
4
|
+
data.tar.gz: 83fbd82a63efde8514abae2183657cf6a5d7b494
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e432ba549cb8435e3ee66f639b3b762bfa039cca89e2e949a2638649df27d5eb547af6e8a71209f96442efbc8ad5cb3d08c1a44488b6c57ecad769be64f26855
|
7
|
+
data.tar.gz: 2c7640e0a3d32dd27ce801d9b0c4dc2e2658c1fc8ebf022c87dcafa1af8da6f20d89f0984339f1c10bab3358f4ab7247c365a31babe5791c7657e6a437eda992
|
data/bin/josephine
CHANGED
data/lib/josephine.rb
CHANGED
@@ -1,36 +1,47 @@
|
|
1
1
|
class Josephine
|
2
2
|
|
3
|
-
def
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
def initialize(extension)
|
4
|
+
@extension = extension
|
5
|
+
extension_file
|
6
|
+
count_lines
|
7
|
+
end
|
8
|
+
|
9
|
+
def extension_file
|
10
|
+
ext = File.join("**", "*#{@extension}")
|
11
|
+
files = Dir.glob(ext)
|
12
|
+
end
|
13
|
+
|
14
|
+
def count_lines
|
15
|
+
l = 0 # Number of files
|
16
|
+
line_count = 0 # Number of lines of code
|
17
|
+
line_com = 0 # Number of lines of comments
|
18
|
+
space = 0
|
19
|
+
extension_file.each do |f|
|
11
20
|
next if f.index('vendor')
|
12
21
|
next if FileTest.directory?(f)
|
13
|
-
|
22
|
+
l += 1
|
14
23
|
i = 0
|
15
24
|
lines = []
|
16
25
|
File.new(f).each_line do |line|
|
17
26
|
if line.strip[0] == nil
|
18
|
-
|
27
|
+
space += 1
|
19
28
|
next
|
20
29
|
end
|
21
30
|
if line.strip[0] == '#'
|
22
|
-
|
31
|
+
line_com += 1
|
23
32
|
next
|
24
33
|
end
|
25
|
-
|
34
|
+
|
26
35
|
i += 1
|
27
36
|
end
|
28
|
-
|
37
|
+
|
38
|
+
line_count += i
|
29
39
|
end
|
30
|
-
puts "#{
|
31
|
-
puts "#{
|
32
|
-
puts "#{(
|
33
|
-
puts "#{
|
40
|
+
puts "#{l.to_s} files."
|
41
|
+
puts "#{line_count.to_s} lines of code."
|
42
|
+
puts "#{(line_count.to_f/l.to_f).round(2)} LOC/file."
|
43
|
+
puts "#{line_com.to_s} lines of comments."
|
44
|
+
puts "#{space.to_s} line spacing."
|
34
45
|
end
|
35
46
|
|
36
47
|
end
|