Class: GitProc::NewFeatureBranch
- Defined in:
- lib/git-process/new_fb.rb
Instance Method Summary collapse
-
#initialize(dir, opts) ⇒ NewFeatureBranch
constructor
A new instance of NewFeatureBranch.
- #runner ⇒ Object
Methods inherited from Process
#cleanup, #config, #fetch_remote_changes, #gitlib, #is_parked?, #logger, #master_branch, #remote, #run, #verify_preconditions, #workdir
Constructor Details
#initialize(dir, opts) ⇒ NewFeatureBranch
Returns a new instance of NewFeatureBranch.
19 20 21 22 23 |
# File 'lib/git-process/new_fb.rb', line 19 def initialize(dir, opts) @branch_name = opts[:branch_name] @local_only = opts[:local] super end |
Instance Method Details
#runner ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/git-process/new_fb.rb', line 26 def runner mybranches = gitlib.branches() on_parking = (mybranches.parking == mybranches.current) base_branch = if on_parking and not mybranches[config.integration_branch].contains_all_of(mybranches.parking.name) '_parking_' else config.integration_branch end gitlib.fetch if gitlib.has_a_remote? and not @local_only logger.info { "Creating #{@branch_name} off of #{base_branch}" } new_branch = gitlib.checkout(@branch_name, :new_branch => base_branch) branches = gitlib.branches() branches[@branch_name].upstream(config.integration_branch) branches.parking.delete! if on_parking new_branch end |