Class: Hotspots::Repository::Parser::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/hotspots/repository/parser/git.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(driver, options) ⇒ Git

Returns a new instance of Git.



7
8
9
10
11
# File 'lib/hotspots/repository/parser/git.rb', line 7

def initialize(driver, options)
  @driver          = driver
  @time            = options[:time]
  @message_filters = options[:message_filters]
end

Instance Attribute Details

#driverObject (readonly)

Returns the value of attribute driver.



5
6
7
# File 'lib/hotspots/repository/parser/git.rb', line 5

def driver
  @driver
end

#message_filtersObject (readonly)

Returns the value of attribute message_filters.



5
6
7
# File 'lib/hotspots/repository/parser/git.rb', line 5

def message_filters
  @message_filters
end

#timeObject (readonly)

Returns the value of attribute time.



5
6
7
# File 'lib/hotspots/repository/parser/git.rb', line 5

def time
  @time
end

Instance Method Details

#filesObject



13
14
15
16
17
# File 'lib/hotspots/repository/parser/git.rb', line 13

def files
  filtered_commit_hashes.reduce([]) do |acc, commit_hash|
    acc + driver.show_one_line_names(:commit_hash => commit_hash).lines.map(&:strip)[1..-1]
  end
end

#filtered_commit_hashesObject



19
20
21
22
23
# File 'lib/hotspots/repository/parser/git.rb', line 19

def filtered_commit_hashes
  message_filters.reduce([]) do |acc, filter|
    acc + driver.pretty_log(:since_days => time, :message_filter => filter).lines.map(&:strip)
  end.uniq
end