Module: RSpec::GitSpecifier
- Defined in:
- lib/rspec/git_specifier.rb,
lib/rspec/git_specifier/version.rb
Constant Summary collapse
- VERSION =
"0.1.0"
Instance Method Summary collapse
- #commits ⇒ Object
- #current_branch ⇒ Object
- #current_directory ⇒ Object
- #master_object_id ⇒ Object
- #repository ⇒ Object
- #travis_branch ⇒ Object
- #walker ⇒ Object
Instance Method Details
#commits ⇒ Object
14 15 16 |
# File 'lib/rspec/git_specifier.rb', line 14 def commits walker.walk end |
#current_branch ⇒ Object
30 31 32 |
# File 'lib/rspec/git_specifier.rb', line 30 def current_branch travis_branch || repository.branches.detect(&:head?) end |
#current_directory ⇒ Object
10 11 12 |
# File 'lib/rspec/git_specifier.rb', line 10 def current_directory Dir.pwd end |
#master_object_id ⇒ Object
26 27 28 |
# File 'lib/rspec/git_specifier.rb', line 26 def master_object_id repository.ref('refs/remotes/origin/master').target_id end |
#repository ⇒ Object
6 7 8 |
# File 'lib/rspec/git_specifier.rb', line 6 def repository Rugged::Repository.discover(current_directory) end |
#travis_branch ⇒ Object
34 35 36 37 38 39 40 41 |
# 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 ⇒ Object
18 19 20 21 22 23 24 |
# 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 |