1-join-leave: added

This commit is contained in:
rkiel
2017-09-29 22:34:48 -04:00
parent 318c8adb3f
commit 39cc91611d
4 changed files with 53 additions and 0 deletions

View File

@@ -8,6 +8,8 @@ module Release
:create, :create,
:finish, :finish,
:help, :help,
:join,
:leave,
:list, :list,
:start, :start,
:tab, :tab,

24
lib/release/join.rb Normal file
View File

@@ -0,0 +1,24 @@
require_relative './base'
module Release
class Join < Release::Base
def valid?
argv.size == 2
end
def help
"release join version"
end
def execute
subcommand, version = *argv
validate_current_branch_master
git_pull current_branch
git_checkout_track release_branch_from_version(version)
end
end
end

23
lib/release/leave.rb Normal file
View File

@@ -0,0 +1,23 @@
require_relative './base'
module Release
class Leave < Release::Base
def valid?
argv.size == 1
end
def help
"release leave"
end
def execute
validate_current_branch_is_release
git_checkout "master"
git_local_branch_trash current_branch
end
end
end

View File

@@ -83,6 +83,10 @@ module Shared
run_cmd "git checkout -b #{branch} #{commit}" run_cmd "git checkout -b #{branch} #{commit}"
end end
def git_checkout_track (branch)
run_cmd "git checkout --track origin/#{branch}"
end
def git_commit (message, force = false) def git_commit (message, force = false)
message = force ? message+' (no-verify)' : message message = force ? message+' (no-verify)' : message
message = '"' + message + '"' message = '"' + message + '"'