Merge branch 'master' of github.com:warpc/rosa-build
This commit is contained in:
commit
f54fc40cd9
2
Gemfile
2
Gemfile
|
@ -29,7 +29,7 @@ gem 'unicorn'
|
||||||
|
|
||||||
# XML-RPC support
|
# XML-RPC support
|
||||||
# gem 'actionwebservice' #, :git => 'git://github.com/ywen/actionwebservice.git'
|
# gem 'actionwebservice' #, :git => 'git://github.com/ywen/actionwebservice.git'
|
||||||
gem "rails-xmlrpc"
|
gem "rails-xmlrpc", :git => 'git://github.com/chipiga/rails-xmlrpc.git'
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
gem "airbrake"
|
gem "airbrake"
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
GIT
|
||||||
|
remote: git://github.com/chipiga/rails-xmlrpc.git
|
||||||
|
revision: 3cf79e062c65447809209724a0cb8d1ea5af2e57
|
||||||
|
specs:
|
||||||
|
rails-xmlrpc (0.3.1)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git@github.com:warpc/gitolito.git
|
remote: git@github.com:warpc/gitolito.git
|
||||||
revision: 8608b9bdfd33e961d9f9d71dd594e62780c074f6
|
revision: 8608b9bdfd33e961d9f9d71dd594e62780c074f6
|
||||||
|
@ -189,7 +195,6 @@ GEM
|
||||||
activesupport (= 3.0.10)
|
activesupport (= 3.0.10)
|
||||||
bundler (~> 1.0)
|
bundler (~> 1.0)
|
||||||
railties (= 3.0.10)
|
railties (= 3.0.10)
|
||||||
rails-xmlrpc (0.3.2)
|
|
||||||
rails3-generators (0.17.4)
|
rails3-generators (0.17.4)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
railties (3.0.10)
|
railties (3.0.10)
|
||||||
|
@ -280,7 +285,7 @@ DEPENDENCIES
|
||||||
paperclip (~> 2.3)
|
paperclip (~> 2.3)
|
||||||
pg (~> 0.11.0)
|
pg (~> 0.11.0)
|
||||||
rails (= 3.0.10)
|
rails (= 3.0.10)
|
||||||
rails-xmlrpc
|
rails-xmlrpc!
|
||||||
rails3-generators
|
rails3-generators
|
||||||
rspec-rails (~> 2.7.0)
|
rspec-rails (~> 2.7.0)
|
||||||
ruby-debug
|
ruby-debug
|
||||||
|
|
|
@ -3,7 +3,8 @@ class RpcController < ApplicationController
|
||||||
|
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
before_filter :check_global_access
|
before_filter :check_global_access
|
||||||
|
before_filter lambda { EventLog.current_controller = self }, :only => :xe_index # should be after auth callback
|
||||||
|
|
||||||
## Usage example:
|
## Usage example:
|
||||||
#
|
#
|
||||||
# require 'xmlrpc/client'
|
# require 'xmlrpc/client'
|
||||||
|
@ -11,27 +12,31 @@ class RpcController < ApplicationController
|
||||||
# client.call("project_versions", 1)
|
# client.call("project_versions", 1)
|
||||||
|
|
||||||
def platforms
|
def platforms
|
||||||
|
ActiveSupport::Notifications.instrument("event_log.observer", :message => 'список платформ')
|
||||||
return Platform.select('id, unixname').where("platform_type = ?", 'main').map(&:attributes)
|
return Platform.select('id, unixname').where("platform_type = ?", 'main').map(&:attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_projects
|
|
||||||
current_user.projects.map{|pr| { :id => pr.id, :unixname => pr.unixname } }
|
|
||||||
end
|
|
||||||
|
|
||||||
def project_versions id
|
|
||||||
pr = Project.findby_id(id)
|
|
||||||
return nil if pr.blank?
|
|
||||||
pr.project_versions.collect { |tag| [tag.name.gsub(/^\w+\./, ""), tag.name] }.select { |pv| pv[1] =~ /^v\./ }
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_status id
|
|
||||||
BuildList.find_by_id(id).try(:status)
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_packet project_id, repo_id
|
|
||||||
# TODO: build packet
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def user_projects
|
||||||
|
ActiveSupport::Notifications.instrument("event_log.observer", :message => 'список пользовательских проектов')
|
||||||
|
current_user.projects.map{|p| { :id => p.id, :unixname => p.unixname } }
|
||||||
|
end
|
||||||
|
|
||||||
|
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\./}
|
||||||
|
end
|
||||||
|
|
||||||
|
def build_status id
|
||||||
|
bl = BuildList.find_by_id(id)
|
||||||
|
ActiveSupport::Notifications.instrument("event_log.observer", :object => bl, :message => 'статус сборки')
|
||||||
|
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 => 'сборка пакета')
|
||||||
|
'unknown' # TODO: build packet
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,9 +18,9 @@ class EventLog < ActiveRecord::Base
|
||||||
create(attributes) do |el|
|
create(attributes) do |el|
|
||||||
el.user = current_controller.current_user
|
el.user = current_controller.current_user
|
||||||
el.ip = current_controller.request.remote_ip
|
el.ip = current_controller.request.remote_ip
|
||||||
el.protocol = 'web' # TODO pass protocol through controller or calculate by name
|
|
||||||
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')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Project < ActiveRecord::Base
|
||||||
after_create :create_git_repo
|
after_create :create_git_repo
|
||||||
before_update :update_git_repo
|
before_update :update_git_repo
|
||||||
after_destroy :destroy_git_repo
|
after_destroy :destroy_git_repo
|
||||||
after_rollback lambda { destroy_git_repo rescue true }
|
after_rollback lambda { destroy_git_repo rescue true if new_record? }
|
||||||
|
|
||||||
def project_versions
|
def project_versions
|
||||||
#tags.collect { |tag| [tag.name, tag.name.gsub(/^\w+\./, "")] }.select { |pv| pv[0] =~ /^v\./ }
|
#tags.collect { |tag| [tag.name, tag.name.gsub(/^\w+\./, "")] }.select { |pv| pv[0] =~ /^v\./ }
|
||||||
|
|
|
@ -11,7 +11,7 @@ class ProjectToRepository < ActiveRecord::Base
|
||||||
|
|
||||||
after_create lambda { project.xml_rpc_create(repository) }
|
after_create lambda { project.xml_rpc_create(repository) }
|
||||||
after_destroy lambda { project.xml_rpc_destroy(repository) }
|
after_destroy lambda { project.xml_rpc_destroy(repository) }
|
||||||
after_rollback lambda { project.xml_rpc_destroy(repository) rescue true }
|
after_rollback lambda { project.xml_rpc_destroy(repository) rescue true if new_record? }
|
||||||
|
|
||||||
#def path
|
#def path
|
||||||
# build_path(project.unixname)
|
# build_path(project.unixname)
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'xmlrpc/client'
|
require 'xmlrpc/client'
|
||||||
require 'ap' # awesome_print
|
require 'awesome_print'
|
||||||
|
|
||||||
# Please correctly fill following vars
|
# Please correctly fill following vars
|
||||||
@host = 'localhost'
|
@host = 'localhost'
|
||||||
@port = 3000
|
@port = 3000
|
||||||
@user = 'user@email'
|
@user = 'pchipiga@ya.ru'
|
||||||
@password = ''
|
@password = '123456'
|
||||||
|
|
||||||
puts 'PLATFORMS'
|
puts 'PLATFORMS'
|
||||||
client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900)
|
client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900)
|
||||||
|
|
|
@ -10,6 +10,7 @@ ru:
|
||||||
'devise/sessions_controller': 'Аутентификация пользователей'
|
'devise/sessions_controller': 'Аутентификация пользователей'
|
||||||
'devise/passwords_controller': 'Восстановление пароля'
|
'devise/passwords_controller': 'Восстановление пароля'
|
||||||
'users/omniauth_callbacks_controller': 'Внешняя аутентификация пользователей'
|
'users/omniauth_callbacks_controller': 'Внешняя аутентификация пользователей'
|
||||||
|
rpc_controller: XML RPC
|
||||||
actions:
|
actions:
|
||||||
'devise/sessions_controller':
|
'devise/sessions_controller':
|
||||||
create: 'вход'
|
create: 'вход'
|
||||||
|
@ -22,6 +23,8 @@ ru:
|
||||||
build_lists_controller:
|
build_lists_controller:
|
||||||
cancel: 'сборка отменена'
|
cancel: 'сборка отменена'
|
||||||
publish: 'сборка опубликована'
|
publish: 'сборка опубликована'
|
||||||
|
rpc_controller:
|
||||||
|
xe_index: запрос
|
||||||
create: 'создано'
|
create: 'создано'
|
||||||
update: 'обновлено'
|
update: 'обновлено'
|
||||||
destroy: 'удалено'
|
destroy: 'удалено'
|
||||||
|
|
|
@ -271,11 +271,10 @@ ActiveRecord::Schema.define(:version => 20111029150934) do
|
||||||
|
|
||||||
create_table "users", :force => true do |t|
|
create_table "users", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", :default => "", :null => false
|
||||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||||
t.string "password_salt", :default => "", :null => false
|
|
||||||
t.string "reset_password_token"
|
t.string "reset_password_token"
|
||||||
t.string "remember_token"
|
t.datetime "reset_password_sent_at"
|
||||||
t.datetime "remember_created_at"
|
t.datetime "remember_created_at"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
|
|
Loading…
Reference in New Issue