aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/handle-mail-replies2
-rwxr-xr-xscript/mailin2
-rwxr-xr-xscript/request-creation-graph6
-rwxr-xr-xscript/user-use-graph6
4 files changed, 4 insertions, 12 deletions
diff --git a/script/handle-mail-replies b/script/handle-mail-replies
index 15454b311..267ad5632 100755
--- a/script/handle-mail-replies
+++ b/script/handle-mail-replies
@@ -1,4 +1,4 @@
#!/bin/bash
-cd "`dirname "$0"`"
+cd "`dirname "${BASH_SOURCE[0]}"`"
exec bundle exec ./handle-mail-replies.rb "$@"
diff --git a/script/mailin b/script/mailin
index 5f2a9c243..48e236cfe 100755
--- a/script/mailin
+++ b/script/mailin
@@ -8,7 +8,7 @@ OUTPUT=$(mktemp -t foi-mailin-output-XXXXXXXX)
# Read the email message from stdin, and write it to the file $INPUT
cat >"$INPUT"
-cd "$(dirname "$0")"/..
+cd "$(dirname "${BASH_SOURCE[0]}")"/..
source commonlib/shlib/deployfns
read_conf config/general
diff --git a/script/request-creation-graph b/script/request-creation-graph
index f3baa2326..9b91e44b9 100755
--- a/script/request-creation-graph
+++ b/script/request-creation-graph
@@ -17,11 +17,7 @@ cd `dirname $0`
cd ../
source commonlib/shlib/deployfns
-# TODO: this is nasty :)
-OPTION_FOI_DB_HOST=`grep "host:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_PORT=`grep "port:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_NAME=`grep "database:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_USER=`grep "username:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
+read OPTION_FOI_DB_HOST OPTION_FOI_DB_PORT OPTION_FOI_DB_NAME OPTION_FOI_DB_USER <<<$(ruby -r yaml -e 'db = YAML::load(STDIN.read); pr = db["production"]; puts pr["host"], pr["port"], pr["database"], pr["username"]' < config/database.yml)
SOURCEA=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM
SOURCEB=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM
diff --git a/script/user-use-graph b/script/user-use-graph
index 00eeb36f8..aad471a4b 100755
--- a/script/user-use-graph
+++ b/script/user-use-graph
@@ -16,11 +16,7 @@ cd `dirname $0`
cd ../
source commonlib/shlib/deployfns
-# TODO: this is nasty :)
-OPTION_FOI_DB_HOST=`grep "host:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_PORT=`grep "port:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_NAME=`grep "database:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
-OPTION_FOI_DB_USER=`grep "username:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
+read OPTION_FOI_DB_HOST OPTION_FOI_DB_PORT OPTION_FOI_DB_NAME OPTION_FOI_DB_USER <<<$(ruby -r yaml -e 'db = YAML::load(STDIN.read); pr = db["production"]; puts pr["host"], pr["port"], pr["database"], pr["username"]' < config/database.yml)
SOURCEA=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM
SOURCEB=/tmp/foi-creation-rate-graph-data-$RANDOM$RANDOM