Class: Feature::Create

Inherits:
Object
  • Object
show all
Defined in:
lib/straight_line/common/feature/create.rb

Overview

Creates a new branch for the feature

Instance Method Summary collapse

Constructor Details

#initialize(feature_name) ⇒ Create

Returns a new instance of Create.

Raises:



7
8
9
10
11
# File 'lib/straight_line/common/feature/create.rb', line 7

def initialize(feature_name)
  raise UserError, 'Feature name required' unless feature_name
  raise UserError, "Feature name can't have spaces" if feature_name =~ /\s/
  @feature_name = feature_name
end

Instance Method Details

#runObject



13
14
15
16
# File 'lib/straight_line/common/feature/create.rb', line 13

def run
  cmd = Command.new 'git', ['checkout', '-b', @feature_name]
  cmd.run
end