Class: Hotspots::Repository::Driver::Git
- Inherits:
-
Object
- Object
- Hotspots::Repository::Driver::Git
- Defined in:
- lib/hotspots/repository/driver/git.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(logger) ⇒ Git
constructor
A new instance of Git.
- #log_with_tag(tag, &block) ⇒ Object
-
#pretty_log(options) ⇒ Object
Input and output should be optionally coloured.
-
#show_one_line_names(options) ⇒ Object
Input and output should be optionally coloured.
Constructor Details
#initialize(logger) ⇒ Git
Returns a new instance of Git.
7 8 9 |
# File 'lib/hotspots/repository/driver/git.rb', line 7 def initialize(logger) @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/hotspots/repository/driver/git.rb', line 5 def logger @logger end |
Instance Method Details
#log_with_tag(tag, &block) ⇒ Object
23 24 25 |
# File 'lib/hotspots/repository/driver/git.rb', line 23 def log_with_tag(tag, &block) yield.tap { |raw| logger.log "<#{tag}>\n#{raw}<#{tag}/>" } end |
#pretty_log(options) ⇒ Object
Input and output should be optionally coloured
12 13 14 15 |
# File 'lib/hotspots/repository/driver/git.rb', line 12 def pretty_log() command = log_with_tag("Input") { Command::Git::Log.new(:since_days => [:since_days], :message_filter => [:message_filter]).build } log_with_tag("Output") { %x(#{command}) } end |
#show_one_line_names(options) ⇒ Object
Input and output should be optionally coloured
18 19 20 21 |
# File 'lib/hotspots/repository/driver/git.rb', line 18 def show_one_line_names() command = log_with_tag("Input") { Command::Git::Show.new(:commit_hash => [:commit_hash]).build } log_with_tag("Output") { %x(#{command}) } end |