Sha256: 5028d5009d07a4bb89def9cd6f9756d4e5684e3eecca656e1011cc5ed4e5fa43

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

module Semmy
  module Scm
    extend self

    def on_master?
      git.current_branch == 'master'
    end

    def on_minor_version_stable?(stable_branch_name)
      !!git.current_branch.match(stable_branch_matcher(stable_branch_name))
    end

    def on_major_version_stable?(stable_branch_name)
      !!git.current_branch.match(major_version_stable_branch_matcher(stable_branch_name))
    end

    private

    def major_version_stable_branch_matcher(stable_branch_name)
      stable_branch_matcher(stable_branch_name.gsub('%{minor}', 'x'))
    end

    def stable_branch_matcher(stable_branch_name)
      Regexp.new(stable_branch_name.gsub(/%\{\w+\}/, '[0-9]+'))
    end

    def git
      Git.open('.')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
semmy-1.2.0 lib/semmy/scm.rb
semmy-1.1.0 lib/semmy/scm.rb