Skip to content

Commit 05a45e4

Browse files
committed
Add ruby script.
1 parent a7d1576 commit 05a45e4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

linguist.rb

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'rugged'
2+
require 'linguist'
3+
require 'json'
4+
5+
# Puts a JSON of language names and corresponding file names.
6+
def detect_code_files()
7+
if ARGV.length != 1 then
8+
puts 'Usage: ruby linguist.rb repo_path'
9+
end
10+
repo_path = ARGV[0]
11+
repo = Rugged::Repository.new(repo_path)
12+
project = Linguist::Repository.new(repo, repo.head.target_id)
13+
puts JSON.generate(project.breakdown_by_file)
14+
end
15+
16+
detect_code_files()

0 commit comments

Comments
 (0)