pantoglot 0.1.0 → 0.1.1
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/bin/pantoglot +15 -2
- data/lib/pantoglot.rb +3 -2
- data/lib/pantoglot/version.rb +1 -1
- 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: ea370cec2c8adedfbbf5e8d53a532b1aad3be46e
|
4
|
+
data.tar.gz: 41f5059a5c8cad86f1e00504a7d15300b4822d68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4aa2e3a5aa38c87e397600322380062b5d1aa185fee8f28c3ab8c04d44eadf09a163bf8c6aa840161de07222badb4e6c3819ec138c6debec467ca9de7fa0d2a2
|
7
|
+
data.tar.gz: 1abdc10c40d2243c6b35affa9874f848402d0b2dfcfe699d7cc20694f8ca2448df7bebdc3ffc070c06c2b0e9beeace8770f7d9a26756b90d2a12dc6fe14e03a1
|
data/bin/pantoglot
CHANGED
@@ -7,6 +7,19 @@ require 'json'
|
|
7
7
|
require 'optparse'
|
8
8
|
require 'json/add/core'
|
9
9
|
|
10
|
-
path = ARGV[0]
|
10
|
+
path = ARGV[0]
|
11
11
|
|
12
|
-
|
12
|
+
if path != nil
|
13
|
+
if File.exists?(path)
|
14
|
+
puts JSON.dump(Pantoglot.process(path))
|
15
|
+
else
|
16
|
+
abort "Path does not exist."
|
17
|
+
end
|
18
|
+
else
|
19
|
+
abort <<-HELP
|
20
|
+
Pantoglot v#{Pantoglot::VERSION}
|
21
|
+
Analyze source code language, LOC and SLOC breakdown for a given filetree or file.
|
22
|
+
|
23
|
+
Usage: pantoglot <path>
|
24
|
+
HELP
|
25
|
+
end
|
data/lib/pantoglot.rb
CHANGED
@@ -4,6 +4,7 @@ require 'linguist'
|
|
4
4
|
module Pantoglot
|
5
5
|
extend self
|
6
6
|
def process(path)
|
7
|
+
return nil if !File.exists?(path)
|
7
8
|
if File.file?(path)
|
8
9
|
return Pantoglot.analyze(path)
|
9
10
|
end
|
@@ -18,8 +19,8 @@ module Pantoglot
|
|
18
19
|
child = Pantoglot.process(fullpath)
|
19
20
|
elsif File.file?(fullpath)
|
20
21
|
child = Pantoglot.analyze(fullpath)
|
21
|
-
next if child == nil
|
22
22
|
end
|
23
|
+
next if child == nil
|
23
24
|
loc = loc + child[:loc]
|
24
25
|
sloc = sloc + child[:sloc]
|
25
26
|
children << child
|
@@ -34,7 +35,7 @@ module Pantoglot
|
|
34
35
|
}
|
35
36
|
end
|
36
37
|
def analyze(path)
|
37
|
-
blob = Linguist::FileBlob.new(path
|
38
|
+
blob = Linguist::FileBlob.new(path)
|
38
39
|
return nil if blob.symlink?
|
39
40
|
# Skip non-Text
|
40
41
|
return nil if !blob.text?
|
data/lib/pantoglot/version.rb
CHANGED