class Ginbeer
Constants
- VERSION
Public Class Methods
new(dir, from="", to=Time.now)
click to toggle source
# File lib/ginbeer/ginbeer.rb, line 5 def initialize(dir, from="", to=Time.now) @dir = dir @from = from @from_d = nil if @from != "" @from_d = Time.parse(@from) end @to = to # error handling epath = File.expand_path(dir) if File.exist?(File.join(epath, '.git')) elsif File.exist?(epath) && (epath =~ /\.git$/) elsif File.exist?(epath) raise InvalidGitRepositoryError.new(epath) else raise NoSuchPathError.new(epath) end end
Public Instance Methods
cd_command()
click to toggle source
# File lib/ginbeer/ginbeer.rb, line 60 def cd_command return "cd #{@dir} &&" end
log_command(author)
click to toggle source
# File lib/ginbeer/ginbeer.rb, line 70 def log_command(author) command = "#{self.cd_command} git log --pretty=format:'[%ad]' --shortstat --author='#{author.name}' --date=short --before=#{@to}" return command end
shortlog_command()
click to toggle source
# File lib/ginbeer/ginbeer.rb, line 64 def shortlog_command command = "#{self.cd_command} git shortlog -s --no-merges -n --before=#{@to}" command += " --after=#{@from}" if @from != "" return command end