class AsanaSnapshot::Persistence::GitAdapter

Public Class Methods

new() click to toggle source
# File lib/asana_snapshot/persistence/git.rb, line 4
def initialize
  @repo = Git.init(AsanaSnapshot.configuration.base_dir, log: AsanaSnapshot.configuration.logger)
end

Public Instance Methods

mark_for_save(file) click to toggle source
# File lib/asana_snapshot/persistence/git.rb, line 8
def mark_for_save(file)
  @repo.add file
  true
end
save(group) click to toggle source
# File lib/asana_snapshot/persistence/git.rb, line 13
def save(group)
  today = Time.now.strftime('%Y-%m-%d')
  @repo.commit "[#{group}] Snapshot: #{today}"

  if @repo.tags.include?(today)
    @repo.delete_tag today
  end
  @repo.add_tag today
  true
end