Fix the linguist binary

This commit is contained in:
Vicent Marti
2014-06-26 13:03:30 +02:00
parent 659d27cae5
commit bc34345a56
2 changed files with 5 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
require 'linguist/file_blob'
require 'linguist/repository'
require 'rugged'
path = ARGV[0] || Dir.pwd
@@ -18,7 +19,8 @@ ARGV.shift
breakdown = true if ARGV[0] == "--breakdown"
if File.directory?(path)
repo = Linguist::Repository.from_directory(path)
rugged = Rugged::Repository.new(path)
repo = Linguist::Repository.new(rugged, rugged.head.target_id)
repo.languages.sort_by { |_, size| size }.reverse.each do |language, size|
percentage = ((size / repo.size.to_f) * 100)
percentage = sprintf '%.2f' % percentage