changeset 1336:b61a51fb42b9 live

Fixes to external helper scripts, including avoiding barfing on project XML
author Chris Cannam
date Thu, 20 Jun 2013 13:10:50 +0100
parents 2590a6fb900a
children 077b8890835a 25603efa57b5 c03a6c3c4db9 e5d5cb1bc3be
files extra/soundsoftware/convert-external-repos.rb extra/soundsoftware/update-external-repo.sh
diffstat 2 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/extra/soundsoftware/convert-external-repos.rb	Thu Jun 20 13:10:28 2013 +0100
+++ b/extra/soundsoftware/convert-external-repos.rb	Thu Jun 20 13:10:50 2013 +0100
@@ -34,7 +34,6 @@
 
 
 require 'getoptlong'
-require 'rdoc/usage'
 require 'find'
 require 'etc'
 
@@ -86,7 +85,7 @@
     when '--verbose';        $verbose += 1
     when '--test';           $test = true
     when '--version';        puts Version; exit
-    when '--help';           RDoc::usage
+    when '--help';           puts "Read source for documentation"; exit 
     when '--quiet';          $quiet = true
     end
   end
@@ -99,7 +98,7 @@
 end
 
 if ($redmine_host.empty? or $repos_base.empty? or $command.empty?)
-  RDoc::usage
+  puts "Read source for documentation"; exit
 end
 
 unless File.directory?($repos_base)
@@ -114,6 +113,7 @@
 
 class Project < ActiveResource::Base
   self.headers["User-agent"] = "SoundSoftware external repository converter/#{Version}"
+  self.format = :xml
 end
 
 log("querying Redmine for projects...", :level => 1);
@@ -128,6 +128,8 @@
 begin
   # Get all active projects that have the Repository module enabled
   projects = Project.find(:all, :params => {:key => $api_key})
+rescue ActiveResource::ForbiddenAccess
+  log("Request was denied by your Redmine server. Make sure that 'WS for repository management' is enabled in application settings and that you provided the correct API key.")
 rescue => e
   log("Unable to connect to #{Project.site}: #{e}", :exit => true)
 end
--- a/extra/soundsoftware/update-external-repo.sh	Thu Jun 20 13:10:28 2013 +0100
+++ b/extra/soundsoftware/update-external-repo.sh	Thu Jun 20 13:10:50 2013 +0100
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 mirrordir="/var/mirror"
-hg="/usr/local/bin/hg"
+hg="/usr/bin/hg"
 
 project="$1"
 local_repo="$2"