release: switch to use rc branches
This commit is contained in:
@@ -27,20 +27,28 @@ module Release
|
||||
|
||||
private
|
||||
|
||||
def show_existing_tags
|
||||
git_local_list_tags(release_tag_prefix).join("\n")
|
||||
end
|
||||
|
||||
def validate_version_format (version)
|
||||
error "Invalid version number format. Try using MAJOR.MINOR.PATCH." unless version =~ /\d+\.\d+\.\d+/
|
||||
error "Invalid version number format. Try using MAJOR.MINOR.PATCH." unless version =~ version_pattern
|
||||
end
|
||||
|
||||
def validate_version_is_new (version)
|
||||
error "Version already exists: #{git_local_list_tags.join(' ')}" if git_local_list_tags.include? "v#{version}"
|
||||
error "Version already exists: \n#{show_existing_tags}" if git_local_list_tags(release_tag_prefix).include? release_tag_from_version(version)
|
||||
end
|
||||
|
||||
def validate_version_exists (version)
|
||||
error "Version does not exist: #{git_local_list_tags.join(' ')}" unless git_local_list_tags.include? "v#{version}"
|
||||
error "Version does not exist: \n#{show_existing_tags}" unless git_local_list_tags(release_tag_prefix).include? release_tag_from_version(version)
|
||||
end
|
||||
|
||||
def validate_version_does_not_exist (version)
|
||||
error "Version already exists: \n#{show_existing_tags}" if git_local_list_tags(release_tag_prefix).include? release_tag_from_version(version)
|
||||
end
|
||||
|
||||
def validate_current_branch_is_release
|
||||
error "Invalid release branch: #{current_branch}" unless current_branch =~ /\d+\.\d+\.\d+/
|
||||
error "Invalid release branch: #{current_branch}" unless current_branch =~ release_branch_pattern
|
||||
end
|
||||
|
||||
def validate_current_branch_master
|
||||
@@ -50,6 +58,8 @@ module Release
|
||||
def validate_release_branch_does_not_exist (branch)
|
||||
error "Version branch already exists: #{branch}" if remote_branch(branch) != ""
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -12,7 +12,8 @@ module Release
|
||||
:minor,
|
||||
:patch,
|
||||
:tab,
|
||||
:trash
|
||||
:trash,
|
||||
:versions
|
||||
].sort
|
||||
|
||||
DEFAULT = :help
|
||||
|
||||
@@ -18,7 +18,7 @@ module Release
|
||||
|
||||
git_pull release_branch
|
||||
|
||||
git_local_tag release_branch
|
||||
git_local_tag release_tag_from_version(version_from_release_branch(release_branch))
|
||||
|
||||
git_push release_branch
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@ module Release
|
||||
subcommand, version, *extras = *argv
|
||||
|
||||
validate_version_format version
|
||||
|
||||
|
||||
validate_current_branch_master
|
||||
git_pull current_branch
|
||||
|
||||
validate_version_is_new version
|
||||
|
||||
git_local_tag version
|
||||
git_local_tag release_tag_from_version(version)
|
||||
|
||||
git_push_tags
|
||||
|
||||
|
||||
@@ -21,12 +21,13 @@ module Release
|
||||
|
||||
validate_version_exists version
|
||||
|
||||
new_branch = increment_version(version)
|
||||
validate_release_branch_does_not_exist(new_branch)
|
||||
new_version = increment_version(version)
|
||||
validate_version_does_not_exist new_version
|
||||
validate_release_branch_does_not_exist(release_branch_from_version(new_version))
|
||||
|
||||
git_local_branch_create new_branch, "v#{version}"
|
||||
git_local_branch_create release_branch_from_version(new_version), release_tag_from_version(version)
|
||||
|
||||
git_push new_branch
|
||||
git_push release_branch_from_version(new_version)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
21
lib/release/versions.rb
Normal file
21
lib/release/versions.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
require_relative './base'
|
||||
|
||||
module Release
|
||||
|
||||
class Versions < Release::Base
|
||||
def valid?
|
||||
true
|
||||
end
|
||||
|
||||
def help
|
||||
"release versions"
|
||||
end
|
||||
|
||||
def execute
|
||||
puts
|
||||
puts show_existing_tags
|
||||
puts
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user