module RSpec::GitSpecifier

Constants

VERSION

Public Instance Methods

commits() click to toggle source
# File lib/rspec/git_specifier.rb, line 14
def commits
  walker.walk
end
current_branch() click to toggle source
# File lib/rspec/git_specifier.rb, line 30
def current_branch
  travis_branch || repository.branches.detect(&:head?)
end
current_directory() click to toggle source
# File lib/rspec/git_specifier.rb, line 10
def current_directory
  Dir.pwd
end
master_object_id() click to toggle source
# File lib/rspec/git_specifier.rb, line 26
def master_object_id
  repository.ref('refs/remotes/origin/master').target_id
end
repository() click to toggle source
# File lib/rspec/git_specifier.rb, line 6
def repository
  Rugged::Repository.discover(current_directory)
end
travis_branch() click to toggle source
# File lib/rspec/git_specifier.rb, line 34
def travis_branch
  name = ENV['TRAVIS_BRANCH']
  return unless name

  repository.branches.detect do |branch|
    branch.name == name
  end
end
walker() click to toggle source
# File lib/rspec/git_specifier.rb, line 18
def walker
  walker = Rugged::Walker.new(repository)
  walker.sorting(Rugged::SORT_DATE | Rugged::SORT_REVERSE)
  walker.push('HEAD')
  walker.hide(master_object_id)
  walker
end