module NexusCli::ArtifactActions
def format_search_results(doc, group_id, artifact_id)
-
(type)
- [description]
Parameters:
-
artifact_id
(String
) -- the artifact id -
group_id
(String
) -- the group id -
doc
(REXML::Document
) -- the xml search results
def format_search_results(doc, group_id, artifact_id) versions = [] REXML::XPath.each(doc, "//version") { |matched_version| versions << matched_version.text } if versions.length > 0 indent_size = versions.max{|a,b| a.length <=> b.length}.size+4 formated_results = ['Found Versions:'] versions.inject(formated_results) do |array,version| temp_version = version + ":" array << "#{temp_version.ljust(indent_size)} `nexus-cli pull #{group_id}:#{artifact_id}:#{version}:tgz`" end else formated_results = ['No Versions Found.'] end end