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, options, &block) ⇒ Object
- #pretty_log(options) ⇒ Object
- #show_one_line_names(options) ⇒ Object
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, options, &block) ⇒ Object
21 22 23 |
# File 'lib/hotspots/repository/driver/git.rb', line 21 def log_with_tag(tag, , &block) yield.tap { |raw| logger.log("<#{tag}>\n#{raw}<#{tag}/>", :as => [:as]) } end |
#pretty_log(options) ⇒ Object
11 12 13 14 |
# File 'lib/hotspots/repository/driver/git.rb', line 11 def pretty_log() command = log_with_tag("Input", :as => :green) { Command::Git::Log.new(:since_days => [:since_days], :message_filter => [:message_filter]).build } log_with_tag("Output", :as => :red) { %x(#{command}) } end |
#show_one_line_names(options) ⇒ Object
16 17 18 19 |
# File 'lib/hotspots/repository/driver/git.rb', line 16 def show_one_line_names() command = log_with_tag("Input", :as => :green) { Command::Git::Show.new(:commit_hash => [:commit_hash]).build } log_with_tag("Output", :as => :red) { %x(#{command}) } end |