From f39e51e516356ee6550b7acccbf59203769b50c9 Mon Sep 17 00:00:00 2001 From: Pavel Chipiga Date: Sun, 30 Oct 2011 21:01:08 +0200 Subject: [PATCH] Fix XML RPC responses. Refs #2162 --- app/controllers/rpc_controller.rb | 5 ++--- bin/xml-client-demo.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/controllers/rpc_controller.rb b/app/controllers/rpc_controller.rb index 3ee0e8984..f0e29ef3f 100644 --- a/app/controllers/rpc_controller.rb +++ b/app/controllers/rpc_controller.rb @@ -13,7 +13,7 @@ class RpcController < ApplicationController def platforms ActiveSupport::Notifications.instrument("event_log.observer", :message => 'список платформ') - return Platform.select('id, unixname').where("platform_type = ?", 'main').map(&:attributes) + Platform.select('unixname').where("platform_type = ?", 'main').map(&:unixname) end def user_projects @@ -24,8 +24,7 @@ class RpcController < ApplicationController def project_versions id p = Project.find_by_id(id) ActiveSupport::Notifications.instrument("event_log.observer", :object => p, :message => "список версий") - return nil if p.blank? - p.project_versions.collect {|tag| [tag.name.gsub(/^\w+\./, ""), tag.name]}.select {|pv| pv[1] =~ /^v\./} + p.project_versions.collect {|tag| tag.name.gsub(/^\w+\./, "")} rescue 'not found' end def build_status id diff --git a/bin/xml-client-demo.rb b/bin/xml-client-demo.rb index f5f634177..056f2a9a4 100644 --- a/bin/xml-client-demo.rb +++ b/bin/xml-client-demo.rb @@ -2,7 +2,7 @@ require 'rubygems' require 'xmlrpc/client' -require 'awesome_print' +require 'pp' # Please correctly fill following vars @host = 'localhost' @@ -12,26 +12,26 @@ require 'awesome_print' puts 'PLATFORMS' client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) -ap client.call("platforms") +pp client.call("platforms") puts 'USER PROJECTS' client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) -ap client.call("user_projects") +pp client.call("user_projects") puts 'PROJECT VERSIONS' client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) project_id = 1 # FIXME! -ap client.call("project_versions", project_id) +pp client.call("project_versions", project_id) puts 'BUILD STATUS' client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) build_list_id = 1 # FIXME -ap client.call("build_status", build_list_id) +pp client.call("build_status", build_list_id) puts 'BUILD PACKET' client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) project_id = 1 # FIXME repo_id = 1 # FIXME -ap client.call("build_packet", project_id, repo_id) +pp client.call("build_packet", project_id, repo_id) puts 'DONE' \ No newline at end of file