changeset 218:292cde42265a feature_20

* Enable Embedded on projects that have new documentation
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 11 Feb 2011 16:21:55 +0000
parents 1e55195bca45
children 45c691a2b709 c3544e9fd588
files config/routes.rb extra/soundsoftware/extract-docs.sh
diffstat 2 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/config/routes.rb	Mon Feb 07 16:46:28 2011 +0000
+++ b/config/routes.rb	Fri Feb 11 16:21:55 2011 +0000
@@ -236,7 +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/embedded.:format', :action => 'set_embedded_active', :conditions => { :method => :get } #todo: should be post
+    sys.connect 'sys/projects/:id/embedded.:format', :action => 'set_embedded_active', :conditions => { :method => :post }
   end
  
   # Install the default route as the lowest priority.
--- a/extra/soundsoftware/extract-docs.sh	Mon Feb 07 16:46:28 2011 +0000
+++ b/extra/soundsoftware/extract-docs.sh	Fri Feb 11 16:21:55 2011 +0000
@@ -8,6 +8,11 @@
 hgdir="/var/hg"
 docdir="/var/doc"
 
+apikey=""
+apihost=""
+apiuser=""
+apipass=""
+
 progdir=$(dirname $0)
 case "$progdir" in
     /*) ;;
@@ -23,6 +28,16 @@
     fi
 done
 
+enable_embedded()
+{
+    p="$1"
+    if [ -n "$apiuser" ]; then
+	curl -u "$apiuser":"$apipass" "http://$apihost/sys/projects/$p/embedded.xml?enable=1&key=$apikey" -d ""
+    else
+	curl "http://$apihost/sys/projects/$p/embedded.xml?enable=1&key=$apikey" -d ""
+    fi
+}
+
 for projectdir in "$hgdir"/* ; do
 
     if [ -d "$projectdir" ] && [ -d "$projectdir/.hg" ]; then
@@ -59,6 +74,7 @@
 # # If we have just written something to a doc directory that was
 # # previously empty, we should switch on Embedded for this project
 		echo "This project hasn't had doc extracted before -- I should switch on Embedded for it at this point"
+		enable_embedded "$project"
 	    fi
 
 	    if [ -d "$targetdir" ]; then