From 26bb3b19037fcd181b4d3d65f9c1963b55575583 Mon Sep 17 00:00:00 2001 From: rkiel Date: Wed, 20 Sep 2017 22:03:06 -0400 Subject: [PATCH] release: cleanup trash --- lib/release/base.rb | 4 ++++ lib/release/trash.rb | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/release/base.rb b/lib/release/base.rb index 47c3156..5635fac 100644 --- a/lib/release/base.rb +++ b/lib/release/base.rb @@ -39,6 +39,10 @@ module Release error "Version does not exist: #{git_local_list_tags.join(' ')}" unless git_local_list_tags.include? "v#{version}" end + def validate_current_branch_is_release + error "Invalid release branch: #{current_branch}" unless current_branch =~ /\d+\.\d+\.\d+/ + end + def validate_current_branch_master error "Invalid starting branch: #{current_branch}. Try switching to #{standard_branches.join(' ')}." unless standard_branches.include? current_branch end diff --git a/lib/release/trash.rb b/lib/release/trash.rb index a3e8941..70a9433 100644 --- a/lib/release/trash.rb +++ b/lib/release/trash.rb @@ -20,9 +20,9 @@ module Release release_branch = current_branch - error "missing confirmation of branch: #{release_branch}" if confirmation_branch == '' - error "confirmation branch does not match current branch: #{confirmation_branch} vs #{release_branch}" if release_branch != confirmation_branch - error "invalid release branch: #{release_branch}" unless current_branch =~ /\d+\.\d+\.\d+/ + error "Missing confirmation of branch: #{release_branch}" if confirmation_branch == '' + error "Confirmation branch does not match current branch: #{confirmation_branch} vs #{release_branch}" if release_branch != confirmation_branch + validate_current_branch_is_release git_checkout 'master'