add local option to support local development
authorIan Kelling <ian@iankelling.org>
Wed, 22 Jun 2016 17:43:46 +0000 (10:43 -0700)
committerIan Kelling <ian@iankelling.org>
Wed, 22 Jun 2016 17:43:46 +0000 (10:43 -0700)
get-wiki-snapshot

index b71c9ec37c8ce111d6d075600f9c4faa8dc110a7..578732ba0c1f185fdafd716014c75dde94617e68 100755 (executable)
@@ -6,17 +6,20 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 
 cd "${BASH_SOURCE%/*}"
 
+
 script_file=mw-setup-script
 page_file=Mediawiki_Setup_Guide
 start=' *<source lang="bash"> *'
 end=' *<\/source> *'
 
-ruby <<'EOF' > $page_file
+if [[ $1 != -l ]]; then # use local file
+    ruby <<'EOF' > $page_file
 require 'json'
 puts JSON.parse(`curl -k 'https://ofswiki.org/w/api.php?\
 action=query&titles=Mediawiki_Setup_Guide&prop=revisions&rvprop=content&\
 format=json'`.chomp)['query']['pages'].values[0]['revisions'][0]['*']
 EOF
+fi
 
 { cat <<'EOF'
 #!/bin/bash