release: added trash
This commit is contained in:
@@ -9,7 +9,8 @@ module Release
|
||||
:init,
|
||||
:major,
|
||||
:minor,
|
||||
:patch
|
||||
:patch,
|
||||
:trash
|
||||
].sort
|
||||
|
||||
DEFAULT = :help
|
||||
|
||||
39
lib/release/trash.rb
Normal file
39
lib/release/trash.rb
Normal file
@@ -0,0 +1,39 @@
|
||||
require_relative './base'
|
||||
|
||||
module Release
|
||||
|
||||
class Trash < Release::Base
|
||||
def valid?
|
||||
argv.size == 2
|
||||
end
|
||||
|
||||
def help
|
||||
"release trash local-branch-confirmation"
|
||||
end
|
||||
|
||||
def execute
|
||||
if argv.size == 2
|
||||
confirmation_branch = argv[1]
|
||||
else
|
||||
confirmation_branch = ''
|
||||
end
|
||||
|
||||
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+/
|
||||
|
||||
git_checkout 'master'
|
||||
|
||||
git_local_branch_trash release_branch
|
||||
|
||||
if remote_branch(release_branch) != ""
|
||||
git_remote_branch_delete release_branch
|
||||
end
|
||||
|
||||
git_prune
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user