Class: Thicket::Log
- Inherits:
-
Object
- Object
- Thicket::Log
- Defined in:
- lib/thicket/log.rb
Constant Summary collapse
- LOG_PARSE_REGEX =
/[a-f0-9]{7}.+?m(.+?) .+?m\{(.+?)\}.+?m (?:\((.+?)\))?.+?m(.+$)/.freeze
Instance Method Summary collapse
-
#initialize(options) ⇒ Log
constructor
A new instance of Log.
-
#print ⇒ Object
Gets a printable version of the log for purposes of printing to a terminal.
Constructor Details
#initialize(options) ⇒ Log
Returns a new instance of Log.
10 11 12 13 |
# File 'lib/thicket/log.rb', line 10 def initialize() @options = @count_parsed = 0 end |
Instance Method Details
#print ⇒ Object
Gets a printable version of the log for purposes of printing to a terminal. This effectively builds the final printable log to display to the user.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/thicket/log.rb', line 18 def print FileUtils.cd(git_working_directory) `#{git_log_command}`.encode("UTF-8", invalid: :replace, undef: :replace) .split("\n") .each do |l| puts process_git_log_line(l) next unless @options[:limit] && @count_parsed >= @options[:limit] puts "..." puts "Stopped after #{@options[:limit]} commits. More commit history exists." exit end rescue Errno::EPIPE, SystemExit, Interrupt exit end |