josephine 0.3.2 → 0.3.3
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 +15 -5
- 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: 5550337bb102d62a32f38f7a73a0a52e0ffba3ee
|
4
|
+
data.tar.gz: e5fdafd593b09877e42125833f75f82c7ea6ad8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e452a7eec5459f929a5df1a7ecce2e3d7d5a05f03cf6b0c4cf8b1413890987381f21e8d99d74cf05e2f237887b3f394285ddcd3ffe576f095b031ced9d8eb287
|
7
|
+
data.tar.gz: 9c5b9f3cfdb69fc3eeb3520fa7ce6abfce50a13b5a8b2ab7a47154ad185555d5f1573b0ae32a26defd94306fcd65ba2cf81b96ed17a5240217771737edb3d9e2
|
data/lib/josephine.rb
CHANGED
@@ -7,8 +7,13 @@ class Josephine
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def extension_file
|
10
|
-
|
11
|
-
|
10
|
+
if @extension == "-all".strip
|
11
|
+
ext = File.join("**", "*")
|
12
|
+
files = Dir.glob(ext)
|
13
|
+
else
|
14
|
+
ext = File.join("**", "*#{@extension}")
|
15
|
+
files = Dir.glob(ext)
|
16
|
+
end
|
12
17
|
end
|
13
18
|
|
14
19
|
def count_lines
|
@@ -23,11 +28,11 @@ class Josephine
|
|
23
28
|
i = 0
|
24
29
|
lines = []
|
25
30
|
File.new(f).each_line do |line|
|
26
|
-
if line.strip[0] == nil
|
31
|
+
if line.scrub.strip[0] == nil
|
27
32
|
space += 1
|
28
33
|
next
|
29
34
|
end
|
30
|
-
if line.strip[0] == '#'
|
35
|
+
if line.scrub.strip[0] == '#'
|
31
36
|
line_com += 1
|
32
37
|
next
|
33
38
|
end
|
@@ -35,11 +40,16 @@ class Josephine
|
|
35
40
|
i += 1
|
36
41
|
end
|
37
42
|
|
43
|
+
# binding.pry
|
38
44
|
line_count += i
|
39
45
|
end
|
40
46
|
puts ""
|
41
47
|
puts "------------------------------"
|
42
|
-
|
48
|
+
if @extension == "-all"
|
49
|
+
puts "#{num_files.to_s} files"
|
50
|
+
else
|
51
|
+
puts "#{num_files.to_s} files with #{@extension} extension."
|
52
|
+
end
|
43
53
|
puts "#{line_count.to_s} lines of code."
|
44
54
|
puts "#{(line_count.to_f/num_files.to_f).round(2)} LOC/file."
|
45
55
|
puts "#{line_com.to_s} lines of comments."
|