download jobs to Jenkins-compatible structure
diff --git a/scraping-jenkins/rename.sh b/scraping-jenkins/rename.sh
index 30ae52c..32314ba 100755
--- a/scraping-jenkins/rename.sh
+++ b/scraping-jenkins/rename.sh
@@ -3,14 +3,16 @@
pushd `dirname $0`/jobs > /dev/null
+shopt -s nullglob # empty directory will return empty list
+
# convert to all-lower-case
-for i in *.config.xml; do
- mv "$i" "${i,,}" 2> /dev/null || true
+for dir in ./*/;do
+ mv "$dir" "${dir,,}" 2> /dev/null || true
done
# replace %20% by hyphen
-for i in *.config.xml; do
- mv "$i" "${i//%20/-}" 2> /dev/null || true
+for dir in ./*/;do
+ mv "$dir" "${dir//%20/-}" 2> /dev/null || true
done
popd > /dev/null
diff --git a/scraping-jenkins/scrape.sh b/scraping-jenkins/scrape.sh
index 781f20d..db801b8 100755
--- a/scraping-jenkins/scrape.sh
+++ b/scraping-jenkins/scrape.sh
@@ -25,11 +25,12 @@
while IFS='' read -r jobname || [[ -n $jobname ]]; do
echo "scraping job: $jobname"
- curl --show-error "http://basti1302:$JENKINS_API_TOKEN@ci.couchdb.org:8888/jobs/$jobname/config.xml" > "jobs/$jobname.config.xml"
+ mkdir -p "jobs/$jobname"
+ curl --show-error "http://basti1302:$JENKINS_API_TOKEN@ci.couchdb.org:8888/jobs/$jobname/config.xml" > "jobs/$jobname/config.xml"
done < jobnames.txt
# rename jobs to a sane naming pattern
./rename.sh
-pop > /dev/null
+popd > /dev/null