2011-10-24 02:59:16 +01:00
|
|
|
class RpcController < ApplicationController
|
|
|
|
exposes_xmlrpc_methods
|
|
|
|
|
|
|
|
before_filter :authenticate_user!
|
2011-10-30 16:46:32 +00:00
|
|
|
before_filter lambda { EventLog.current_controller = self }, :only => :xe_index # should be after auth callback
|
|
|
|
|
2011-10-24 02:59:16 +01:00
|
|
|
## 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
|
2011-10-30 16:46:32 +00:00
|
|
|
ActiveSupport::Notifications.instrument("event_log.observer", :message => 'список платформ')
|
2011-11-28 15:41:42 +00:00
|
|
|
Platform.select('name').where("platform_type = ?", 'main').map(&:name)
|
2011-10-24 02:59:16 +01:00
|
|
|
end
|
2011-10-30 16:46:32 +00:00
|
|
|
|
2011-10-24 02:59:16 +01:00
|
|
|
def user_projects
|
2011-10-30 16:46:32 +00:00
|
|
|
ActiveSupport::Notifications.instrument("event_log.observer", :message => 'список пользовательских проектов')
|
2011-11-28 15:41:42 +00:00
|
|
|
current_user.projects.map{|p| { :id => p.id, :name => p.name } }
|
2011-10-24 02:59:16 +01:00
|
|
|
end
|
2011-10-30 16:46:32 +00:00
|
|
|
|
2011-10-24 02:59:16 +01:00
|
|
|
def project_versions id
|
2011-10-30 16:46:32 +00:00
|
|
|
p = Project.find_by_id(id)
|
|
|
|
ActiveSupport::Notifications.instrument("event_log.observer", :object => p, :message => "список версий")
|
2011-10-30 19:01:08 +00:00
|
|
|
p.project_versions.collect {|tag| tag.name.gsub(/^\w+\./, "")} rescue 'not found'
|
2011-10-24 02:59:16 +01:00
|
|
|
end
|
2011-10-30 16:46:32 +00:00
|
|
|
|
2011-10-24 02:59:16 +01:00
|
|
|
def build_status id
|
2011-10-30 16:46:32 +00:00
|
|
|
bl = BuildList.find_by_id(id)
|
|
|
|
ActiveSupport::Notifications.instrument("event_log.observer", :object => bl, :message => 'статус сборки')
|
|
|
|
bl.try(:status) || 'not found'
|
2011-10-24 02:59:16 +01:00
|
|
|
end
|
2011-10-30 16:46:32 +00:00
|
|
|
|
2011-10-24 02:59:16 +01:00
|
|
|
def build_packet project_id, repo_id
|
2011-10-30 16:46:32 +00:00
|
|
|
# p = Project.find_by_id(project_id); r = Repository.find_by_id(repo_id)
|
|
|
|
ActiveSupport::Notifications.instrument("event_log.observer", :message => 'сборка пакета')
|
|
|
|
'unknown' # TODO: build packet
|
2011-10-24 02:59:16 +01:00
|
|
|
end
|
2011-10-28 18:55:40 +01:00
|
|
|
end
|