Class: PivotalIntegration::Command::New
- Defined in:
- lib/pivotal-integration/command/new.rb
Overview
The class that encapsulates starting a Pivotal Tracker Story
Constant Summary collapse
- STORY_TYPES =
%w(feature bug chore release)
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from PivotalIntegration::Command::Base
Class Method Details
.collect_type_and_name(arguments) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/pivotal-integration/command/new.rb', line 34 def collect_type_and_name(arguments) type = STORY_TYPES.include?(arguments.first.try(:downcase)) ? arguments.shift : choose_type type = type.downcase.to_sym name = arguments.shift || ask('Provide a name for the new story: ') [name, type] end |
Instance Method Details
#run(*arguments) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/pivotal-integration/command/new.rb', line 24 def run(*arguments) = self.class.collect_type_and_name(arguments) puts print 'Creating new story on Pivotal Tracker... ' PivotalIntegration::Util::Story.new(@configuration.project, *) puts 'OK' end |