Skip to content
This repository has been archived by the owner on Jul 4, 2018. It is now read-only.

Commit

Permalink
[#2] fix issue when no issue is not assignee
Browse files Browse the repository at this point in the history
  • Loading branch information
alemata committed May 28, 2015
1 parent 50099bc commit 233a2f9
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
6 changes: 5 additions & 1 deletion lib/assisted_workflow/addons/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ def description
end

def current_state
@issue.assignee.login
@issue.labels.map(&:name).join(",")
end

def owners_str
@issue.assignee.login if issue.assignee
end

def labels
Expand Down
4 changes: 4 additions & 0 deletions lib/assisted_workflow/addons/jira.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def name
def current_state
@issue.fields.current["status"]["name"]
end

def owners_str
@issue.fields.current["assignee"]["name"]
end

def estimate
@issue.fields.current["priority"]["name"]
Expand Down
19 changes: 17 additions & 2 deletions lib/assisted_workflow/addons/pivotal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

# wrapper class to pivotal api client
module AssistedWorkflow::Addons

class PivotalStory < SimpleDelegator
def initialize(story)
super
end

def owners_str
url = "/projects/#{project_id}/stories/#{id}/owners"
client.get(url).body.map{|owner| owner["name"]}.join(", ")
end
end

class Pivotal < Base
required_options :fullname, :token, :project_id

Expand All @@ -23,7 +35,7 @@ def initialize(output, options = {})
def find_story(story_id)
if story_id.to_i > 0
log "loading story ##{story_id}"
@project.story(story_id)
PivotalStory.new(@project.story(story_id))
end
end

Expand All @@ -46,7 +58,10 @@ def pending_stories(options = {})
states = ["unstarted"]
states << "started" if options[:include_started]
filter_str = "state:#{states.join(',')} owned_by:#{@client.me.id}"
@project.stories(:filter => filter_str, :limit => 5)
stories = @project.stories(:filter => filter_str, :limit => 5)
stories.map do |story|
PivotalStory.new(story)
end
end

def valid?
Expand Down
8 changes: 2 additions & 6 deletions lib/assisted_workflow/output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ def print_title(title)
def print_stories(title, stories, options = {})
print_title title
rows = stories.map do |story|
if options[:all]
[story.id, story.current_state, story.name]
else
[story.id, story.estimate, story.name]
end
[story.id, story.current_state, story.owners_str, story.name]
end
print_table(rows)
end
Expand All @@ -51,4 +47,4 @@ def next_command(title, commands, &block)
end

end
end
end

0 comments on commit 233a2f9

Please sign in to comment.