Class: GitPivot::GitPivot
- Inherits:
-
Object
- Object
- GitPivot::GitPivot
- Defined in:
- lib/git_pivot.rb
Instance Method Summary collapse
-
#add_note(id, note_text) ⇒ Object
add a new note.
- #add_task(id, task_text) ⇒ Object
- #complete_task(id, task_id) ⇒ Object
-
#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, git = nil, use_ssl = true) ⇒ GitPivot
constructor
ssl should default to yes since http basic auth is insecure.
- #my_work ⇒ Object
-
#start_story(id, name = nil) ⇒ Object
start story.
- #tasks(id) ⇒ Object
Constructor Details
#initialize(project_id, token, owner, git = nil, use_ssl = true) ⇒ GitPivot
ssl should default to yes since http basic auth is insecure
28 29 30 31 32 |
# File 'lib/git_pivot.rb', line 28 def initialize(project_id, token, owner, git = nil, use_ssl = true) @owner = owner @tracker = PivotalTracker.new(project_id, token, {:use_ssl => use_ssl }) @g = Git.open('.') if git end |
Instance Method Details
#add_note(id, note_text) ⇒ Object
add a new note
89 90 91 92 93 94 |
# File 'lib/git_pivot.rb', line 89 def add_note(id, note_text) note = Note.new(:text => note_text) @tracker.create_note(id, note) display_story(id) end |
#add_task(id, task_text) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/git_pivot.rb', line 101 def add_task(id, task_text) task = Task.new(:description => task_text) @tracker.create_task(id, task) tasks = @tracker.tasks(id) display_tasks(id, tasks) end |
#complete_task(id, task_id) ⇒ Object
109 110 111 112 113 114 115 116 |
# File 'lib/git_pivot.rb', line 109 def complete_task(id, task_id) task = @tracker.find_task(id, task_id) task.complete = true @tracker.update_task(id, task) tasks = @tracker.tasks(id) display_tasks(id, tasks) end |
#current_sprint ⇒ Object
list stories in current sprint
35 36 37 38 |
# File 'lib/git_pivot.rb', line 35 def current_sprint iteration = @tracker.current_iteration display_stories(iteration.stories) end |
#display_story(id) ⇒ Object
display the full story
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/git_pivot.rb', line 46 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
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/git_pivot.rb', line 76 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
40 41 42 43 |
# File 'lib/git_pivot.rb', line 40 def my_work stories = @tracker.find({:owner => @owner, :state => "unstarted,started,finished,delivered,rejected"}) display_stories(stories) end |
#start_story(id, name = nil) ⇒ Object
start story
66 67 68 69 70 71 72 73 |
# File 'lib/git_pivot.rb', line 66 def start_story(id, name = nil) story = @tracker.find_story(id) story.current_state = "started" @tracker.update_story(story) create_topic_branch(topic_branch_name(story, name)) display_story(id) end |
#tasks(id) ⇒ Object
96 97 98 99 |
# File 'lib/git_pivot.rb', line 96 def tasks(id) tasks = @tracker.tasks(id) display_tasks(id, tasks) end |