Skip to content

Commit

Permalink
Merge pull request #6 from jamesantrobus/redmine-link
Browse files Browse the repository at this point in the history
issue #4 updated Redmine issue description to include link to Redmine
  • Loading branch information
cprice404 committed Aug 29, 2012
2 parents b8cc2b3 + 8bd6902 commit 0b3a1ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 10 additions & 3 deletions lib/rmt/redmine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ def parse_issues(response_body)
{
:id => get_value_of_text_child_node(issue_node, "id"),
:subject => get_value_of_text_child_node(issue_node, "subject"),
:description => get_value_of_text_child_node(issue_node, "description"),
:description => get_issue_description(issue_node),
:start_date => get_value_of_text_child_node(issue_node, "start_date"),
:due_date => get_value_of_text_child_node(issue_node, "due_date"),
:done_ratio => get_value_of_text_child_node(issue_node, "done_ratio"),
:estimated_hours => get_value_of_text_child_node(issue_node, "estimated_hours"),
:description => get_value_of_text_child_node(issue_node, "description"),
:estimated_hours => get_value_of_text_child_node(issue_node, "estimated_hours"),
:created_on => get_value_of_text_child_node(issue_node, "created_on"),
:updated_on => get_value_of_text_child_node(issue_node, "updated_on"),
:tracker => get_attribute_of_child_node(issue_node, "tracker", :name),
Expand All @@ -103,6 +102,14 @@ def get_value_of_text_child_node(node, child_node_name)
end
private :get_value_of_text_child_node

# prepends the issue description with a link to the issue on Redmine
def get_issue_description(node)
issue_id = get_value_of_text_child_node(node, "id")
description = get_value_of_text_child_node(node, "description") || ""
"#{@base_url}/issues/#{issue_id} \n\n#{description}"
end
private :get_issue_description

# given an Ox xml node, find a child node by the specified child_node_name. The specified node
# should have an attribute with the name specified by attr_name; this method returns the value
# of that attribute.
Expand Down
4 changes: 2 additions & 2 deletions lib/rmt/trello.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def create_card(properties)
puts "Adding card: #{properties[:name]}"
card = ::Trello::Card.create(:name => properties[:name],
:list_id => properties[:list],
:description => sanitize_utf8(properties[:description] || ""))
:description => sanitize_utf8(properties[:description]))
if properties[:color]
card.add_label(properties[:color])
end
Expand Down Expand Up @@ -74,4 +74,4 @@ def sanitize_utf8(str)
str.each_char.map { |c| c.valid_encoding? ? c : "\ufffd"}.join
end
end
end
end

0 comments on commit 0b3a1ee

Please sign in to comment.