# HG changeset patch # User Chris Cannam # Date 1297348844 0 # Node ID e0cbb39c04290672b72917f4616b2da8630c900d # Parent ff5112f823e565ca3dde51c22ea671e7242051e8 * Add method to retrieve external repo URL (via /sys/projects//external-repository.xml?key=) diff -r ff5112f823e5 -r e0cbb39c0429 app/controllers/sys_controller.rb --- a/app/controllers/sys_controller.rb Tue Feb 08 13:24:51 2011 +0000 +++ b/app/controllers/sys_controller.rb Thu Feb 10 14:40:44 2011 +0000 @@ -55,6 +55,20 @@ render :nothing => true, :status => 404 end + def get_external_repo_url + project = Project.find(params[:id]) + if project.repository + repo = project.repository + if repo.is_external? + render :text => repo.external_url, :status => 200 + else + render :nothing => true, :status => 200 + end + end + rescue ActiveRecord::RecordNotFound + render :nothing => true, :status => 404 + end + protected def check_enabled diff -r ff5112f823e5 -r e0cbb39c0429 config/routes.rb --- a/config/routes.rb Tue Feb 08 13:24:51 2011 +0000 +++ b/config/routes.rb Thu Feb 10 14:40:44 2011 +0000 @@ -236,6 +236,7 @@ map.with_options :controller => 'sys' do |sys| sys.connect 'sys/projects.:format', :action => 'projects', :conditions => {:method => :get} sys.connect 'sys/projects/:id/repository.:format', :action => 'create_project_repository', :conditions => {:method => :post} + sys.connect 'sys/projects/:id/external-repository.:format', :action => 'get_external_repo_url', :conditions => {:method => :get} end # Install the default route as the lowest priority.