pantoglot 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6c33e6511a2afa41a36985a32ee2c34ee01cc9f
4
- data.tar.gz: 1b8fb12c8b88549511592ab816250e167f1b5d86
3
+ metadata.gz: ea370cec2c8adedfbbf5e8d53a532b1aad3be46e
4
+ data.tar.gz: 41f5059a5c8cad86f1e00504a7d15300b4822d68
5
5
  SHA512:
6
- metadata.gz: b0c1aadc204b1f8cfefd1f46af74fb03d0bac748b1aa6ed13fdf61c601009b49438ff1d94f20e3fbd7960e6a8bad8ce64d74c832ccc4288598c48786c3a0da11
7
- data.tar.gz: f7a72519a0afb0b9d431bddbadfad0c2815bc41ea1104b446a22161993bc047b36113cf5ada06ab6a67f93eda6b1b9772f4cf050081932694ac6d0f3b0c43d8f
6
+ metadata.gz: 4aa2e3a5aa38c87e397600322380062b5d1aa185fee8f28c3ab8c04d44eadf09a163bf8c6aa840161de07222badb4e6c3819ec138c6debec467ca9de7fa0d2a2
7
+ data.tar.gz: 1abdc10c40d2243c6b35affa9874f848402d0b2dfcfe699d7cc20694f8ca2448df7bebdc3ffc070c06c2b0e9beeace8770f7d9a26756b90d2a12dc6fe14e03a1
@@ -7,6 +7,19 @@ require 'json'
7
7
  require 'optparse'
8
8
  require 'json/add/core'
9
9
 
10
- path = ARGV[0] || Dir.pwd
10
+ path = ARGV[0]
11
11
 
12
- puts JSON.dump(Pantoglot.process(path))
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
@@ -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, Dir.pwd)
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?
@@ -1,3 +1,3 @@
1
1
  module Pantoglot
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pantoglot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Adams