Class: GitWakaTime::Mapper
- Inherits:
-
Object
- Object
- GitWakaTime::Mapper
- Defined in:
- lib/gitwakatime/mapper.rb
Overview
Th
Instance Attribute Summary collapse
-
#commits ⇒ Object
Returns the value of attribute commits.
-
#git ⇒ Object
Returns the value of attribute git.
Instance Method Summary collapse
-
#initialize(commits: 500, start_at: Date.today) ⇒ Mapper
constructor
A new instance of Mapper.
Constructor Details
#initialize(commits: 500, start_at: Date.today) ⇒ Mapper
Returns a new instance of Mapper.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gitwakatime/mapper.rb', line 5 def initialize(commits: 500, start_at: Date.today) Log.new 'Mapping commits for dependent commits' time = Benchmark.realtime do g = GitWakaTime.config.git project = File.basename(g.dir.path) logs = g.log(commits).since(start_at).until(Date.today) @commits = logs.map do |git_c| next if git_c..name != GitWakaTime.config.user_name next if git_c.parents.size > 1 Commit.find_or_create( sha: git_c.sha, project: project ) do |c| c.update( author: git_c..name, message: git_c., date: git_c.date.utc ) end end.compact end Log.new "Map Completed took #{time}s with #{@commits.size} commits" end |
Instance Attribute Details
#commits ⇒ Object
Returns the value of attribute commits.
4 5 6 |
# File 'lib/gitwakatime/mapper.rb', line 4 def commits @commits end |
#git ⇒ Object
Returns the value of attribute git.
4 5 6 |
# File 'lib/gitwakatime/mapper.rb', line 4 def git @git end |