-
Notifications
You must be signed in to change notification settings - Fork 437
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5024 from vpereira/xml-builder
Use xml builder to render xml response
- Loading branch information
Showing
6 changed files
with
40 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
xml.directory do | ||
@project_names.map do |project_name| | ||
xml.entry(name: project_name) | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
src/api/app/views/source/package_command_showlinked.xml.builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
xml.collection do | ||
@package.find_linking_packages.map do |pkg| | ||
xml.package(name: pkg.name, project: pkg.project.name) | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
src/api/app/views/source/project_command_showlinked.xml.builder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
xml.collection do | ||
@project.linked_by_projects.map do |prj| | ||
xml.project(name: prj.name) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
xml.directory(count: @packages.count) do | ||
@packages.map do |name, project| | ||
if expand | ||
xml.entry(name: name, originproject: project) | ||
else | ||
xml.entry(name: name) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
# avoid to render, parser and re-render here, since it can be a hughe content | ||
|
||
output = '' | ||
output << "<productlist count='#{@products.length}'>\n" | ||
@products.each do |p| | ||
output << p.to_axml | ||
xml.productlist(count: @products.count) do | ||
@products.map do |product| | ||
xml.product(name: product.name, originproject: product.package.project.name, originpackage: product.package.name) do | ||
xml.cpe product.cpe | ||
xml.version product.version | ||
end | ||
end | ||
end | ||
output << "</productlist>\n" | ||
return output |