Add xml_rpc_create call on project to repository linking
This commit is contained in:
parent
00f61f0446
commit
f497fc3d89
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue