class Renegade::BranchName
Verify branch name
Constants
- REGEX_BUG_BRANCH
- REGEX_STORY_BRANCH
Attributes
errors[R]
warning[R]
warnings[R]
Public Class Methods
extract_id(branch_name)
click to toggle source
# File lib/renegade/branch_name.rb, line 26 def self.extract_id(branch_name) data = {} if REGEX_STORY_BRANCH.match(branch_name) data['type'] = 'story' data['id'] = REGEX_STORY_BRANCH.match(branch_name)[1] elsif REGEX_BUG_BRANCH.match(branch_name) data['type'] = 'bug' data['id'] = REGEX_BUG_BRANCH.match(branch_name)[1] end data end
new()
click to toggle source
# File lib/renegade/branch_name.rb, line 12 def initialize # Instance variables @label = 'Branch Name' @warnings = [] @errors = [] @warning = 'Branches must start with bug-##### or story-#####.' end
Public Instance Methods
check_branch_name(branch_name)
click to toggle source
# File lib/renegade/branch_name.rb, line 39 def check_branch_name(branch_name) if REGEX_STORY_BRANCH.match(branch_name) || REGEX_BUG_BRANCH.match(branch_name) || branch_name == 'master' # placeholder return true else @warnings.push(@warning) @warnings.push('You may continue to develop in this branch, but you'\ ' will not be allowed to merge unless you rename it.') return false end end
run(branch_name)
click to toggle source
# File lib/renegade/branch_name.rb, line 20 def run(branch_name) # branch_name = `git name-rev --name-only HEAD` Status.report(@label, check_branch_name(branch_name), true) end