[Refs #263] Remove old xml-rpc API

This commit is contained in:
Vladimir Sharshov 2012-03-29 23:19:00 +04:00
parent 39c5da2445
commit 34011513b5
4 changed files with 1 additions and 82 deletions

View File

@ -1,41 +0,0 @@
# -*- encoding : utf-8 -*-
class RpcController < ApplicationController
exposes_xmlrpc_methods
before_filter :authenticate_user!
before_filter lambda { EventLog.current_controller = self }, :only => :xe_index # should be after auth callback
## Usage example:
#
# require 'xmlrpc/client'
# client = XMLRPC::Client.new("127.0.0.1", '/api/xmlrpc', 3000, nil, nil, 'user@email', 'password', false, 900)
# client.call("project_versions", 1)
def platforms
ActiveSupport::Notifications.instrument "event_log.observer", :message => I18n.t('event_log.notices.platforms_list')
Platform.select('name').where("platform_type = ?", 'main').map(&:name)
end
def user_projects
ActiveSupport::Notifications.instrument "event_log.observer", :message => I18n.t('event_log.notices.users_list')
current_user.projects.map{|p| { :id => p.id, :name => p.name } }
end
def project_versions id
p = Project.find_by_id(id)
ActiveSupport::Notifications.instrument "event_log.observer", :object => p, :message => I18n.t('event_log.notices.versions_list')
p.tags.map(&:name) rescue 'not found'
end
def build_status id
bl = BuildList.find_by_id(id)
ActiveSupport::Notifications.instrument "event_log.observer", :object => bl, :message => I18n.t('event_log.notices.status')
bl.try(:status) || 'not found'
end
def build_packet project_id, repo_id
# p = Project.find_by_id(project_id); r = Repository.find_by_id(repo_id)
ActiveSupport::Notifications.instrument "event_log.observer", :message => I18n.t('event_log.notices.project_build')
'unknown' # TODO: build packet
end
end

View File

@ -21,7 +21,7 @@ class EventLog < ActiveRecord::Base
el.ip = current_controller.request.remote_ip el.ip = current_controller.request.remote_ip
el.controller = current_controller.class.to_s el.controller = current_controller.class.to_s
el.action = current_controller.action_name el.action = current_controller.action_name
el.protocol = (el.controller == 'RpcController' ? 'api' : 'web') el.protocol = 'web'
end end
end end

View File

@ -1,38 +0,0 @@
# -*- encoding : utf-8 -*-
#!/usr/bin/env ruby
require 'rubygems'
require 'xmlrpc/client'
require 'pp'
# Please correctly fill following vars
@host = 'npp-build.rosalab.ru'
@port = 80
@user = 'pchipiga@ya.ru'
@password = '123456'
puts 'PLATFORMS'
client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900)
pp client.call("platforms")
puts 'USER PROJECTS'
client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900)
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!
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
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
pp client.call("build_packet", project_id, repo_id)
puts 'DONE'

View File

@ -1,7 +1,5 @@
# -*- encoding : utf-8 -*- # -*- encoding : utf-8 -*-
Rosa::Application.routes.draw do Rosa::Application.routes.draw do
# XML RPC
match 'api/xmlrpc' => 'rpc#xe_index'
devise_scope :user do devise_scope :user do
get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru' get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'