Class: RGitFlow::Tasks::Release::Start
- Defined in:
- lib/rgitflow/tasks/release/start.rb
Constant Summary
Constants included from Printing
Printing::DEBUG_PREFIX, Printing::ERROR_PREFIX, Printing::INPUT_PREFIX, Printing::STATUS_PREFIX
Instance Attribute Summary
Attributes inherited from Task
#after, #before, #dependencies, #description, #name, #namespaces
Instance Method Summary collapse
-
#initialize(git) ⇒ Start
constructor
A new instance of Start.
- #run ⇒ Object protected
Methods inherited from Task
Methods included from Console
#execute, #invoke, #multi_task, #task?
Methods included from Printing
#debug, #error, #prompt, #status
Constructor Details
#initialize(git) ⇒ Start
Returns a new instance of Start.
7 8 9 |
# File 'lib/rgitflow/tasks/release/start.rb', line 7 def initialize(git) super(git, 'start', 'Start a release branch', ['rgitflow', 'release']) end |
Instance Method Details
#run ⇒ Object (protected)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rgitflow/tasks/release/start.rb', line 13 def run status 'Starting release branch...' unless @git.current_branch == RGitFlow::Config.[:develop] error 'Cannot create release branch unless on development branch' abort end branch = [RGitFlow::Config.[:release], RGitFlow::VERSION.to_s].join('/') if @git.is_local_branch? branch error 'Cannot create a branch that already exists locally' abort end if @git.is_remote_branch? branch error 'Cannot create a branch that already exists remotely' abort end @git.branch(branch).create @git.branch(branch).checkout status "Started release branch #{branch}!" end |