Sha256: 1e7f2a4c3163c2a20c4ae136211ac748c95eb4198d35789cc27afeaac6c428b9

Contents?: true

Size: 900 Bytes

Versions: 25

Compression:

Stored size: 900 Bytes

Contents

require_relative "../scripts"
require_relative "../git"

module Octopolo
  module Scripts
    class NewBranch
      include ConfigWrapper
      include GitWrapper

      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
        git.new_branch(new_branch_name, source_branch_name)
      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

25 entries across 25 versions & 1 rubygems

Version Path
octopolo-0.1.2 lib/octopolo/scripts/new_branch.rb
octopolo-0.1.1 lib/octopolo/scripts/new_branch.rb
octopolo-0.1.0 lib/octopolo/scripts/new_branch.rb
octopolo-0.0.2 lib/octopolo/scripts/new_branch.rb
octopolo-0.0.1 lib/octopolo/scripts/new_branch.rb