Class: Runner
- Inherits:
-
Object
- Object
- Runner
- Defined in:
- lib/pivotcli/runner.rb
Instance Method Summary collapse
- #create_story ⇒ Object
- #get_stories ⇒ Object
-
#initialize(options) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(options) ⇒ Runner
Returns a new instance of Runner.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/pivotcli/runner.rb', line 7 def initialize() config = config = YAML.load_file("#{ENV['HOME']}/.pivotcli.yml") @story = [:create] @project_name = [:project] || config['project'] @owner = [:owner] || config['owner'] @state = [:state] @token = [:token] || config['token'] @show_desc = [:show_descriptions] @story_type = [:story_type] @ssl = config['ssl'] PivotalTracker::Client.token = @token PivotalTracker::Client.use_ssl = @ssl @projects = PivotalTracker::Project.all @projects.each do |project| if project.name.downcase.eql? @project_name.downcase @project_id = project.id end end @project = PivotalTracker::Project.find(@project_id) end |
Instance Method Details
#create_story ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/pivotcli/runner.rb', line 33 def create_story if @story.include? ":" labels, story = @story.split ":" @project.stories.create(:name => story.strip, :labels => labels.split(' ')) else @project.stories.create(:name => @story) end end |
#get_stories ⇒ Object
43 44 45 46 47 48 |
# File 'lib/pivotcli/runner.rb', line 43 def get_stories @project.stories.all(:current_state => @state, :owned_by => @owner).each do |story| puts "#{story.id.to_s.red} | #{story.name.green}" puts "\t#{story.description.cyan}" unless (@show_desc.nil? or story.description.empty?) end end |