Class: GitPivot::GitPivot
- Inherits:
-
Object
- Object
- GitPivot::GitPivot
- Defined in:
- lib/git_pivot.rb
Instance Method Summary collapse
-
#current_sprint ⇒ Object
list stories in current sprint.
-
#display_story(id) ⇒ Object
display the full story.
-
#finish_story(id) ⇒ Object
finish story.
-
#initialize(project_id, token, owner, use_ssl = true) ⇒ GitPivot
constructor
ssl should default to yes since http basic auth is insecure.
- #my_work ⇒ Object
-
#start_story(id) ⇒ Object
start story.
Constructor Details
#initialize(project_id, token, owner, use_ssl = true) ⇒ GitPivot
ssl should default to yes since http basic auth is insecure
27 28 29 30 |
# File 'lib/git_pivot.rb', line 27 def initialize(project_id, token, owner, use_ssl = true) @owner = owner @tracker = PivotalTracker.new(project_id, token, {:use_ssl => use_ssl }) end |
Instance Method Details
#current_sprint ⇒ Object
list stories in current sprint
33 34 35 36 |
# File 'lib/git_pivot.rb', line 33 def current_sprint iteration = @tracker.current_iteration display_stories(iteration.stories) end |
#display_story(id) ⇒ Object
display the full story
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/git_pivot.rb', line 44 def display_story(id) story = @tracker.find_story(id) notes = @tracker.notes(id) data = [:id, :name, :current_state, :estimate, :iteration, :story_type, :labels, :owned_by, :requested_by, :created_at, :accepted_at, :url].collect do |element_name| element = story.send(element_name) [element_name.to_s, element.to_s] end puts Table(:data => data, :column_names => ["Element", "Value"]) puts "description:" puts story.description puts notes.each do |note| puts "#{note.noted_at} - #{note.}" puts note.text puts end end |
#finish_story(id) ⇒ Object
finish story
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/git_pivot.rb', line 73 def finish_story(id) story = @tracker.find_story(id) if story.story_type == "feature" or story.story_type == "bug" story.current_state = "finished" elsif story.story_type == "chore" story.current_state = "accepted" end @tracker.update_story(story) display_story(id) end |
#my_work ⇒ Object
38 39 40 41 |
# File 'lib/git_pivot.rb', line 38 def my_work stories = @tracker.find({:owner => @owner, :state => "unstarted,started,finished,delivered,rejected"}) display_stories(stories) end |
#start_story(id) ⇒ Object
start story
64 65 66 67 68 69 70 |
# File 'lib/git_pivot.rb', line 64 def start_story(id) story = @tracker.find_story(id) story.current_state = "started" @tracker.update_story(story) display_story(id) end |