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