Sha256: 697f018ee4fd969aa3458493d25cb933552f383a78a9e349f8d292fd1233be7a
Contents?: true
Size: 1.14 KB
Versions: 17
Compression:
Stored size: 1.14 KB
Contents
require_relative "../scripts" require_relative "../git" module Octopolo module Scripts class NewBranch include ConfigWrapper include GitWrapper include CLIWrapper attr_accessor :new_branch_name attr_accessor :source_branch_name def self.execute(new_branch_name=nil, source_branch_name=nil) new(new_branch_name, source_branch_name).execute end def initialize(new_branch_name=nil, source_branch_name=nil) @new_branch_name = new_branch_name @source_branch_name = source_branch_name || config.deploy_branch end # Public: Perform the script def execute raise ArgumentError unless new_branch_name if !git.reserved_branch?(new_branch_name) || cli.ask_boolean(Git::RESERVED_BRANCH_CONFIRM_MESSAGE) git.new_branch(new_branch_name, source_branch_name) else message = Git::RESERVED_BRANCH_MESSAGE git.alert_reserved_branch message exit 1 end end # Public: Provide a default value if none is given def default_source_branch_name config.deploy_branch end end end end
Version data entries
17 entries across 17 versions & 1 rubygems