Sha256: 52156ba676f94b32e1db93ffed2f6a845f381027ae623e52eecd905aa3bc93d7

Contents?: true

Size: 425 Bytes

Versions: 5

Compression:

Stored size: 425 Bytes

Contents

require 'English'
require 'git_tracker/repository'

module GitTracker
  module Branch
    def self.story_number
      current[/#?(\d+)/, 1]
    end

    def self.current
      branch_path = `git symbolic-ref HEAD`

      Repository.ensure_exists unless exit_successful?

      branch_path[%r{refs/heads/(.+)}, 1] || ''
    end

    private

    def self.exit_successful?
      $CHILD_STATUS.exitstatus == 0
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git_tracker-1.6.1 lib/git_tracker/branch.rb
git_tracker-1.6.0 lib/git_tracker/branch.rb
git_tracker-1.5.1 lib/git_tracker/branch.rb
git_tracker-1.5.0 lib/git_tracker/branch.rb
git_tracker-1.4.0 lib/git_tracker/branch.rb