Add xml_rpc_create call on project to repository linking

This commit is contained in:
konstantin.grabar 2011-10-28 03:37:19 +04:00
parent 00f61f0446
commit f497fc3d89
2 changed files with 13 additions and 9 deletions

View File

@ -80,6 +80,15 @@ class Project < ActiveRecord::Base
build_path(git_repo_name)
end
def xml_rpc_create
result = BuildServer.create_project unixname, repository.platform.unixname, repository.unixname
if result == BuildServer::SUCCESS
return true
else
raise "Failed to create project #{name} (repo #{repository.name}) inside platform #{repository.platform.name}."
end
end
protected
def build_path(dir)
@ -123,15 +132,6 @@ class Project < ActiveRecord::Base
end
end
def xml_rpc_create
result = BuildServer.create_project unixname, repository.platform.unixname, repository.unixname
if result == BuildServer::SUCCESS
return true
else
raise "Failed to create project #{name} (repo #{repository.name}) inside platform #{repository.platform.name}."
end
end
def xml_rpc_destroy
result = BuildServer.delete_project unixname, repository.platform.unixname
if result == BuildServer::SUCCESS

View File

@ -4,6 +4,10 @@ class ProjectToRepository < ActiveRecord::Base
before_save :create_link
after_destroy :remove_link
after_create lambda {
project.xml_rpc_create
}
def path
build_path(project.unixname)