diff options
Diffstat (limited to 'script')
-rwxr-xr-x | script/alert-comment-on-request | 3 | ||||
-rwxr-xr-x | script/alert-new-response-reminders | 3 | ||||
-rwxr-xr-x | script/alert-not-clarified-request | 3 | ||||
-rwxr-xr-x | script/alert-overdue-requests | 3 | ||||
-rwxr-xr-x | script/alert-tracks | 3 | ||||
-rwxr-xr-x | script/check-recent-requests-sent | 3 | ||||
-rwxr-xr-x | script/clear-caches | 11 | ||||
-rwxr-xr-x | script/delete-old-things | 3 | ||||
-rwxr-xr-x | script/handle-mail-replies.rb | 4 | ||||
-rwxr-xr-x | script/mailin | 2 | ||||
-rwxr-xr-x | script/purge-varnish | 7 | ||||
-rwxr-xr-x | script/rails-post-deploy | 21 | ||||
-rwxr-xr-x | script/request-creation-graph | 2 | ||||
-rwxr-xr-x | script/stop-new-responses-on-old-requests | 3 | ||||
-rwxr-xr-x | script/user-use-graph | 2 |
15 files changed, 45 insertions, 28 deletions
diff --git a/script/alert-comment-on-request b/script/alert-comment-on-request index 1222eecf1..849f4a8d8 100755 --- a/script/alert-comment-on-request +++ b/script/alert-comment-on-request @@ -1,3 +1,4 @@ #!/bin/bash - +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" bundle exec rails runner 'RequestMailer.alert_comment_on_request' diff --git a/script/alert-new-response-reminders b/script/alert-new-response-reminders index 97f558f43..148706d49 100755 --- a/script/alert-new-response-reminders +++ b/script/alert-new-response-reminders @@ -1,3 +1,4 @@ #!/bin/bash - +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" bundle exec rails runner 'RequestMailer.alert_new_response_reminders' diff --git a/script/alert-not-clarified-request b/script/alert-not-clarified-request index fb562beeb..8d61c1800 100755 --- a/script/alert-not-clarified-request +++ b/script/alert-not-clarified-request @@ -1,3 +1,4 @@ #!/bin/bash - +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" bundle exec rails runner 'RequestMailer.alert_not_clarified_request' diff --git a/script/alert-overdue-requests b/script/alert-overdue-requests index 9e597d17d..ebc2897a0 100755 --- a/script/alert-overdue-requests +++ b/script/alert-overdue-requests @@ -1,3 +1,4 @@ #!/bin/bash - +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" bundle exec rails runner 'RequestMailer.alert_overdue_requests' diff --git a/script/alert-tracks b/script/alert-tracks index 9fd32f2a1..17426b4e0 100755 --- a/script/alert-tracks +++ b/script/alert-tracks @@ -1,5 +1,6 @@ #!/bin/bash - +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" if [ "$1" == "--loop" ] then bundle exec rails runner 'TrackMailer.alert_tracks_loop' diff --git a/script/check-recent-requests-sent b/script/check-recent-requests-sent index 1eb87d498..8f21fb6e7 100755 --- a/script/check-recent-requests-sent +++ b/script/check-recent-requests-sent @@ -1,3 +1,4 @@ #!/bin/bash - +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" bundle exec rails runner 'MailServerLog.check_recent_requests_have_been_sent' diff --git a/script/clear-caches b/script/clear-caches index f97c1f777..20ee3df19 100755 --- a/script/clear-caches +++ b/script/clear-caches @@ -1,12 +1,11 @@ #!/bin/bash - +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" # Clear the cache of attachment and body text. -LOC="`dirname "$0"`" - bundle exec rails runner "ActiveRecord::Base.connection.execute(\"update incoming_messages set cached_attachment_text_clipped = null, cached_main_body_text_unfolded = null, cached_main_body_text_folded = null, sent_at = null, subject = null, mail_from = null, mail_from_domain = null, valid_to_reply_to = null, last_parsed = null\")" # Remove page cache (do it in two stages so live site gets cache cleared faster) -rm -fr $LOC/../old-cache -mv $LOC/../cache $LOC/../old-cache -rm -fr $LOC/../old-cache +rm -fr $TOP_DIR/old-cache +mv $TOP_DIR/cache $TOP_DIR/old-cache +rm -fr $TOP_DIR/old-cache diff --git a/script/delete-old-things b/script/delete-old-things index 58c144958..a97ba4869 100755 --- a/script/delete-old-things +++ b/script/delete-old-things @@ -1,4 +1,5 @@ #!/bin/bash - +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" bundle exec rails runner 'PostRedirect.delete_old_post_redirects' bundle exec rails runner 'TrackThingsSentEmail.delete_old_track_things_sent_email' diff --git a/script/handle-mail-replies.rb b/script/handle-mail-replies.rb index 23430e20a..da0fc8e96 100755 --- a/script/handle-mail-replies.rb +++ b/script/handle-mail-replies.rb @@ -14,8 +14,12 @@ # config file ourselves. $alaveteli_dir = File.expand_path(File.join(File.dirname(__FILE__), '..')) $:.push(File.join($alaveteli_dir, "commonlib", "rblib")) +load 'config.rb' $:.push(File.join($alaveteli_dir, "lib")) $:.push(File.join($alaveteli_dir, "lib", "mail_handler")) +load 'configuration.rb' +MySociety::Config.set_file(File.join($alaveteli_dir, 'config', 'general'), true) +MySociety::Config.load_default require 'mail_handler' if RUBY_VERSION.to_f >= 1.9 # the default encoding for IO is utf-8, and we use utf-8 internally diff --git a/script/mailin b/script/mailin index 6ed6bc7db..f782df215 100755 --- a/script/mailin +++ b/script/mailin @@ -13,7 +13,7 @@ source commonlib/shlib/deployfns read_conf config/general -rails runner 'RequestMailer.receive(STDIN.read)' <"$INPUT" >"$OUTPUT" 2>&1 +bundle exec rails runner 'RequestMailer.receive(STDIN.read)' <"$INPUT" >"$OUTPUT" 2>&1 ERROR_CODE=$? if [ ! "$ERROR_CODE" = "0" ] then diff --git a/script/purge-varnish b/script/purge-varnish index 7dcecd4f9..abc6daeaf 100755 --- a/script/purge-varnish +++ b/script/purge-varnish @@ -1,11 +1,12 @@ #!/bin/bash -LOC=`dirname $0` +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" if [ "$1" == "--loop" ] then - rails runner 'PurgeRequest.purge_all_loop' + bundle exec rails runner 'PurgeRequest.purge_all_loop' else - rails runner 'PurgeRequest.purge_all' + bundle exec rails runner 'PurgeRequest.purge_all' fi diff --git a/script/rails-post-deploy b/script/rails-post-deploy index a1c613312..4048c852f 100755 --- a/script/rails-post-deploy +++ b/script/rails-post-deploy @@ -6,15 +6,20 @@ # recent version. # # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org; WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org; WWW: http://www.mysociety.org/ set -e #set -x # debug -APP_DIR=`pwd` +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" # make sure that there is an app directory, so are in a rails app tree -cd app/.. +if ! [ -d app ] +then + echo "Error: the 'app' directory didn't exist" + exit 1 +fi # read config file in for later (STAGING_SITE) if [ -e "config/general" ] || [ -e "config/general.yml" ] @@ -27,11 +32,11 @@ else fi # create initial log files -if [ -e $APP_DIR/../logs ] +if [ -e $TOP_DIR/../logs ] then # mySociety servers have logs dir in level above rm -f log - ln -s $APP_DIR/../logs log + ln -s $TOP_DIR/../logs log else # otherwise just make the directory if [ -h log ] @@ -42,10 +47,10 @@ else mkdir -p log fi # link the "downloads" directory in the cache to somewhere it can be served -if [ ! -e "$APP_DIR/public/download" ] +if [ ! -e "$TOP_DIR/public/download" ] then - mkdir -p "$APP_DIR/cache/zips/download" - ln -s "$APP_DIR/cache/zips/download" "$APP_DIR/public/" + mkdir -p "$TOP_DIR/cache/zips/download" + ln -s "$TOP_DIR/cache/zips/download" "$TOP_DIR/public/" fi cd log diff --git a/script/request-creation-graph b/script/request-creation-graph index d49a361b8..ef1d2cf73 100755 --- a/script/request-creation-graph +++ b/script/request-creation-graph @@ -3,7 +3,7 @@ # Plot graph of rate of request creation # # Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org. WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org. WWW: http://www.mysociety.org/ GPLOT_OUTPUT="set terminal png font 'Vera.ttf' 9 size 1600,600" EXTENSION=".png" diff --git a/script/stop-new-responses-on-old-requests b/script/stop-new-responses-on-old-requests index f317f11ff..07257d6b2 100755 --- a/script/stop-new-responses-on-old-requests +++ b/script/stop-new-responses-on-old-requests @@ -1,3 +1,4 @@ #!/bin/bash - +TOP_DIR="$(dirname "$BASH_SOURCE")/.." +cd "$TOP_DIR" bundle exec rails runner 'InfoRequest.stop_new_responses_on_old_requests' diff --git a/script/user-use-graph b/script/user-use-graph index 205e02416..f508c9cb6 100755 --- a/script/user-use-graph +++ b/script/user-use-graph @@ -3,7 +3,7 @@ # Plot graph of user use of site. # # Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved. -# Email: francis@mysociety.org. WWW: http://www.mysociety.org/ +# Email: hello@mysociety.org. WWW: http://www.mysociety.org/ GPLOT_OUTPUT="set terminal png font 'Vera.ttf' 9 size 1200,400" EXTENSION=".png" |