aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/clear-caches2
-rwxr-xr-xscript/generate_pot.sh4
-rwxr-xr-xscript/handle-mail-replies9
-rwxr-xr-xscript/load-sample-data13
-rwxr-xr-xscript/rails-post-deploy27
-rwxr-xr-xscript/rebuild-xapian-index4
-rwxr-xr-xscript/spec-all-pairs81
-rwxr-xr-xscript/update-xapian-index2
8 files changed, 105 insertions, 37 deletions
diff --git a/script/clear-caches b/script/clear-caches
index 2d91774ef..be1d3d017 100755
--- a/script/clear-caches
+++ b/script/clear-caches
@@ -4,7 +4,7 @@
LOC=`dirname $0`
-"$LOC/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, safe_mail_from = null, mail_from_domain = null, valid_to_reply_to = null\")"
+"$LOC/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
diff --git a/script/generate_pot.sh b/script/generate_pot.sh
index 287d33e7f..0c5dfda36 100755
--- a/script/generate_pot.sh
+++ b/script/generate_pot.sh
@@ -3,6 +3,6 @@
cd `dirname $0`
rake gettext:store_model_attributes
-rake gettext:find
-git checkout ../locale/*/app.po
+rake gettext:findpot
+echo "Now commit the new app.pot and push. See TRANSLATE.md for next steps" \ No newline at end of file
diff --git a/script/handle-mail-replies b/script/handle-mail-replies
index 9451bc9f2..68cab9035 100755
--- a/script/handle-mail-replies
+++ b/script/handle-mail-replies
@@ -120,12 +120,21 @@ def is_oof?(message)
end
end
+ if message.header_string("Auto-Submitted") == "auto-generated"
+ if subject =~ /out of( the)? office/
+ return true
+ end
+ end
+
if subject.start_with? "out of office autoreply:"
return true
end
if subject == "out of office"
return true
end
+ if subject == "out of office reply"
+ return true
+ end
if subject.end_with? "is out of the office"
return true
end
diff --git a/script/load-sample-data b/script/load-sample-data
index 0521ef849..e5f1be4cd 100755
--- a/script/load-sample-data
+++ b/script/load-sample-data
@@ -4,9 +4,16 @@
# the fact that the fixtures aren't aware of the fact that RawEmails
# have a filesystem representation of their contents
-LOC=`dirname $0`
+LOC=`dirname "$0"`
+
rake --silent spec:db:fixtures:load
-"$LOC/runner" 'puts File.expand_path(File.dirname(__FILE__) + "/spec/spec_helper"); require File.expand_path(File.dirname(__FILE__) + "/spec/spec_helper"); RawEmail.all().each {|email| email.data = load_file_fixture("useless_raw_email.email")}'
+"$LOC/runner" /dev/stdin <<END
+env = ENV["RAILS_ENV"]
+require "spec/spec_helper.rb" # this sets RAILS_ENV to 'test'
+ENV["RAILS_ENV"] = env # so restore to what it was before
+
+load_raw_emails_data
+END
-echo "Loaded fixtures." \ No newline at end of file
+echo "Loaded fixtures. You may now wish to run $LOC/update-xapian-index"
diff --git a/script/rails-post-deploy b/script/rails-post-deploy
index df9f67528..263d5d926 100755
--- a/script/rails-post-deploy
+++ b/script/rails-post-deploy
@@ -55,33 +55,6 @@ cd log
touch development.log fastcgi.crash.log production.log test.log
cd ..
-# Force appropriate environment (via a hack in config/boot.rb which needs
-# applying to your rails app, see foi/config/boot.rb)
-if [ ! -e "config/rails_env.rb" ]
-then
- cat <<END
-
-*****************************************************************
-WARNING: About to make config/rails_env.rb which, via special
-code in config/boot.rb, forces the Rails environment to be a
-particular one - this is used for the mySociety deployment
-system. You don't want it for local development, because it will
-not work in a confusing way you try and use two environments
-(e.g. development and test) in the same working directory.
-*****************************************************************
-
-END
-fi
-if [ "$OPTION_STAGING_SITE" = "0" ]
-then
- echo "ENV['RAILS_ENV'] = 'production'" > config/rails_env.rb
-elif [[ "$OPTION_DOMAIN" == *"test"* ]]
-then
- echo "ENV['RAILS_ENV'] = 'test'" > config/rails_env.rb
-else
- echo "ENV['RAILS_ENV'] = 'development'" > config/rails_env.rb
-fi
-
if [ -n "$OPTION_THEME_URL" ]
then
script/plugin install --force $OPTION_THEME_URL
diff --git a/script/rebuild-xapian-index b/script/rebuild-xapian-index
index 11e4a46be..5986f5259 100755
--- a/script/rebuild-xapian-index
+++ b/script/rebuild-xapian-index
@@ -1,6 +1,4 @@
#!/bin/bash
cd `dirname $0`
-rake --silent xapian:rebuild_index models="PublicBody User InfoRequestEvent"
-
-
+rake --silent "$@" xapian:rebuild_index models="PublicBody User InfoRequestEvent"
diff --git a/script/spec-all-pairs b/script/spec-all-pairs
new file mode 100755
index 000000000..5b6439a4e
--- /dev/null
+++ b/script/spec-all-pairs
@@ -0,0 +1,81 @@
+#!/bin/bash
+
+# Try all ordered pairs of spec files,
+# to winkle out order-dependent failures.
+
+log_file=/dev/null
+
+test_pair () {
+ rake db:test:prepare > /dev/null 2>&1
+ output=$(script/spec "$1" "$2" 2>&1)
+ if [ $? -eq 0 ]
+ then
+ echo "OK: $1 $2"
+ return 0
+ else
+ echo >> "$log_file" "FAILED: $1 $2"
+ echo >> "$log_file" "======================================="
+ echo >> "$log_file" "$output"
+ echo >> "$log_file"
+
+ echo "FAILED: $1 $2"
+ return 1
+ fi
+}
+
+all_pairs() {
+ specs=spec/*/*.rb
+
+ for spec1 in $specs
+ do
+ all_okay=true
+ for spec2 in $specs
+ do
+ if ! test_pair "$spec1" "$spec2"
+ then
+ all_okay=false
+ fi
+ done
+ done
+
+ $all_okay
+ return $?
+}
+
+pairs_from_stdin() {
+ all_okay=true
+ while read line
+ do
+ case "$line" in
+ \*\ FAILED:\ *|\
+ spec/*.rb\ spec/*.rb)
+ line=${line#\* FAILED: }
+ if ! test_pair $line
+ then
+ all_okay=false
+ fi
+ ;;
+ *)
+ echo "No match: $line"
+ ;;
+ esac
+ done
+
+ $all_okay
+ return $?
+}
+
+if [ "$1" = --log ]
+then
+ shift
+ log_file=$1
+ shift
+ cp /dev/null "$log_file"
+fi
+if [ "$1" = "-" ]
+then
+ pairs_from_stdin
+else
+ all_pairs
+fi
+exit $?
diff --git a/script/update-xapian-index b/script/update-xapian-index
index 8d1fa7d0c..6ece02de0 100755
--- a/script/update-xapian-index
+++ b/script/update-xapian-index
@@ -1,5 +1,5 @@
#!/bin/bash
cd `dirname $0`
-rake --silent xapian:update_index
+rake --silent xapian:update_index "$@"