Sha256: 272f29d36f717912d70c2c3cbbf61e8ebd5da49d74669548d4d68b548196d260

Contents?: true

Size: 451 Bytes

Versions: 18

Compression:

Stored size: 451 Bytes

Contents

require 'grit'

include Grit

module Heirloom

  class GitDirectory

    def initialize(args)
      @path = args[:path]
    end

    def commit(sha = nil)
      return false unless repo

      if sha
        commit = repo.commits(sha)
        commit ? commit.first : false
      else
        repo.commits.first
      end
    end

    private

    def repo
      Repo.new @path
    rescue Grit::InvalidGitRepositoryError
      false
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
heirloom-0.8.3 lib/heirloom/directory/git_directory.rb
heirloom-0.8.2 lib/heirloom/directory/git_directory.rb
heirloom-0.8.1 lib/heirloom/directory/git_directory.rb
heirloom-0.8.0 lib/heirloom/directory/git_directory.rb
heirloom-0.7.4 lib/heirloom/directory/git_directory.rb
heirloom-0.7.3 lib/heirloom/directory/git_directory.rb
heirloom-0.7.3rc2 lib/heirloom/directory/git_directory.rb
heirloom-0.7.3rc1 lib/heirloom/directory/git_directory.rb
heirloom-0.7.2 lib/heirloom/directory/git_directory.rb
heirloom-0.7.2rc2 lib/heirloom/directory/git_directory.rb
heirloom-0.7.2rc1 lib/heirloom/directory/git_directory.rb
heirloom-0.7.1 lib/heirloom/directory/git_directory.rb
heirloom-0.7.0 lib/heirloom/directory/git_directory.rb
heirloom-0.7.0rc1 lib/heirloom/directory/git_directory.rb
heirloom-0.6.1 lib/heirloom/directory/git_directory.rb
heirloom-0.6.0rc1 lib/heirloom/directory/git_directory.rb
heirloom-0.5.0rc4 lib/heirloom/directory/git_directory.rb
heirloom-0.5.0rc3 lib/heirloom/directory/git_directory.rb