Fix XML RPC responses. Refs #2162

This commit is contained in:
Pavel Chipiga 2011-10-30 21:01:08 +02:00
parent 0c3a044f81
commit f39e51e516
2 changed files with 8 additions and 9 deletions

View File

@ -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

View File

@ -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'