itools 0.4.2 → 0.4.3
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/Gemfile.lock +1 -1
- data/lib/itools/count_code_line.rb +5 -4
- data/lib/itools/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e0451a93f506a64ac113ac4cad15eedda75903a47bca84818b5a50477ca2c414
|
|
4
|
+
data.tar.gz: 8d3a9ca2e73e3d3b1873b4727c765e48e3f4fd783d4a9d18348ee0947e46fbfc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ba26b80c4e69d31201804b86dd531f4cf17961dabfe1ab16e937501fda01fcf4c2a2e3b970c516f55c74b2fcc6b5081aad12330f0af1113203393d939bedc06
|
|
7
|
+
data.tar.gz: 42831fd8687341a27f67720531ae078b2d563b5395f7d97ead3514a7d253f6ac35d3282a87397b09bca6a2cd1b08bfbea39f736ce1e1da53fac8330cca09527a
|
data/Gemfile.lock
CHANGED
|
@@ -15,25 +15,27 @@ module Itools
|
|
|
15
15
|
@line_number = @line_number + 1
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
|
+
puts "\033[32m统计#{counter.file_path}结束,共#{counter.line_number}行\033[0m"
|
|
18
19
|
return
|
|
19
20
|
end
|
|
20
21
|
if File::directory?(@file_path)
|
|
21
22
|
Find.find(@file_path) do |file|
|
|
22
|
-
if File.file?(file)
|
|
23
|
+
if File.file?(file) #判断是否是文件
|
|
23
24
|
if File.extname(file).match(/^.[hm]m?$|.cpp/) #只统计.h/.m/.mm/.cpp几个文件
|
|
24
25
|
File.read(file).each_line do |line|
|
|
25
|
-
if line.match(/^\/\/|^$/) == nil #去掉单行注释和空行
|
|
26
|
+
if line.match(/^\/\/|^$/) == nil #去掉单行注释和空行
|
|
26
27
|
@line_number = @line_number + 1
|
|
27
28
|
end
|
|
28
29
|
end
|
|
29
30
|
end
|
|
30
31
|
end
|
|
31
32
|
end
|
|
33
|
+
puts "\033[32m统计#{counter.file_path}结束,共#{counter.line_number}行\033[0m"
|
|
32
34
|
return
|
|
33
35
|
end
|
|
34
36
|
puts "\033[31m找不到指定路径的文件或者文件夹,请重新输入路径\033[0m"
|
|
35
|
-
|
|
36
37
|
end
|
|
38
|
+
|
|
37
39
|
def self.counter(args)
|
|
38
40
|
file = args[0]
|
|
39
41
|
if file.nil?
|
|
@@ -42,7 +44,6 @@ module Itools
|
|
|
42
44
|
end
|
|
43
45
|
counter = CodeCouner.new(file)
|
|
44
46
|
counter.calculate_line_number
|
|
45
|
-
puts "\033[32m统计#{counter.file_path}结束,共#{counter.line_number}行\033[0m"
|
|
46
47
|
end
|
|
47
48
|
end
|
|
48
49
|
end
|
data/lib/itools/version.rb
CHANGED