refactor: update stand branches and support dot file

This commit is contained in:
rkiel
2020-11-26 08:57:01 -05:00
parent 780cd2eaff
commit 995d4c779e
4 changed files with 63 additions and 31 deletions

View File

@@ -17,7 +17,7 @@ module Feature
feature_name = feature_words.join('-')
feature_branch = "#{ENV['FEATURE_USER']||ENV['USER']}-#{current_branch}-#{feature_name}"
error "invalid base branch: #{current_branch}" unless standard_branches.include? current_branch or current_branch =~ /\d+\.\d+\.\d+/
error "invalid base branch. must be one of: #{standard_branches.sort.join(', ')}" unless standard_branches.include? current_branch or current_branch =~ /\d+\.\d+\.\d+/
error "invalid feature branch: #{feature_name}" if standard_branches.include? feature_name
git_fetch
@@ -25,7 +25,7 @@ module Feature
git_branch feature_branch
git_checkout feature_branch
git_push feature_branch
end
end

View File

@@ -10,7 +10,14 @@ module Shared
end
def standard_branches
['master','release']
defaults = ['master','release','main','develop']
dot_file = ".git-utilities-rc"
if File.exist? dot_file
json = JSON.parse(File.read(dot_file))
json['branches'] or defaults
else
defaults
end
end
def version_pattern