Sha256: 24a523962aa6ac1d02c778e9b312006e4118ca8dcdc2b636b2b2ac03fc8b3a1a
Contents?: true
Size: 799 Bytes
Versions: 2
Compression:
Stored size: 799 Bytes
Contents
# this adds a method called 'repo_name' that returns only the filename without path or file extension require 'pathname' require 'find' module Grit # return foldername including extension def shagit_foldername foldername = Pathname.new(self.path).basename.to_s end # return foldername from path without extension def shagit_name foldername = Pathname.new(self.shagit_foldername).basename.to_s # extract repository name without .git extension repo_name = foldername.match(/^[\w\s]+/).to_s end # return size of folder containing the repository in Kilobytes def shagit_size dirsize = 0 # recursively search the repositories path and sum up all file sizes Find.find(self.path) do |file| dirsize += File.stat(file).size end dirsize end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shagit-0.3.1 | lib/enhancing_grit.rb |
shagit-0.3.0 | lib/enhancing_grit.rb |