diff app/controllers/sys_controller.rb @ 214:e0cbb39c0429 feature_73

* Add method to retrieve external repo URL (via /sys/projects/<id>/external-repository.xml?key=<key>)
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 10 Feb 2011 14:40:44 +0000
parents 513646585e45
children 6c282df74a30
line wrap: on
line diff
--- 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