aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/about3
-rwxr-xr-xscript/alert-comment-on-request6
-rwxr-xr-xscript/alert-new-response-reminders6
-rwxr-xr-xscript/alert-not-clarified-request6
-rwxr-xr-xscript/alert-overdue-requests4
-rwxr-xr-xscript/alert-tracks7
-rwxr-xr-xscript/annotate-models2
-rwxr-xr-xscript/autospec6
-rwxr-xr-xscript/breakpointer3
-rwxr-xr-x[-rw-r--r--]script/cache-incoming-emails4
-rwxr-xr-xscript/check-recent-requests-sent7
-rwxr-xr-xscript/clear-caches5
-rwxr-xr-xscript/console3
-rwxr-xr-xscript/dbconsole3
-rwxr-xr-xscript/delete-old-things6
-rwxr-xr-xscript/destroy3
-rwxr-xr-xscript/direct-rspec8
-rwxr-xr-xscript/generate3
-rwxr-xr-xscript/handle-mail-replies.rb6
-rwxr-xr-xscript/load-mail-server-logs4
-rwxr-xr-xscript/load-sample-data26
-rwxr-xr-xscript/mailin2
-rwxr-xr-xscript/performance/benchmarker3
-rwxr-xr-xscript/performance/profiler3
-rwxr-xr-xscript/performance/request3
-rwxr-xr-xscript/plugin3
-rwxr-xr-xscript/process/inspector3
-rwxr-xr-xscript/process/reaper3
-rwxr-xr-xscript/process/spawner3
-rwxr-xr-xscript/purge-varnish4
-rwxr-xr-xscript/rails6
-rwxr-xr-xscript/rails-post-deploy11
-rwxr-xr-xscript/request-creation-graph2
-rwxr-xr-xscript/runner5
-rwxr-xr-xscript/server3
-rwxr-xr-xscript/spec10
-rwxr-xr-xscript/spec-all-pairs81
-rwxr-xr-xscript/spec_server116
-rwxr-xr-xscript/stop-new-responses-on-old-requests6
-rwxr-xr-xscript/test-run5
-rwxr-xr-xscript/user-use-graph2
-rwxr-xr-xscript/wraptest43
42 files changed, 57 insertions, 381 deletions
diff --git a/script/about b/script/about
deleted file mode 100755
index 49a7c2609..000000000
--- a/script/about
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/about'
diff --git a/script/alert-comment-on-request b/script/alert-comment-on-request
index 74782aa13..1222eecf1 100755
--- a/script/alert-comment-on-request
+++ b/script/alert-comment-on-request
@@ -1,7 +1,3 @@
#!/bin/bash
-cd "`dirname "$0"`"
-
-bundle exec ./runner 'RequestMailer.alert_comment_on_request'
-
-
+bundle exec rails runner 'RequestMailer.alert_comment_on_request'
diff --git a/script/alert-new-response-reminders b/script/alert-new-response-reminders
index 59fa76df1..97f558f43 100755
--- a/script/alert-new-response-reminders
+++ b/script/alert-new-response-reminders
@@ -1,7 +1,3 @@
#!/bin/bash
-cd "`dirname "$0"`"
-
-bundle exec ./runner 'RequestMailer.alert_new_response_reminders'
-
-
+bundle exec rails runner 'RequestMailer.alert_new_response_reminders'
diff --git a/script/alert-not-clarified-request b/script/alert-not-clarified-request
index a38fbc70e..fb562beeb 100755
--- a/script/alert-not-clarified-request
+++ b/script/alert-not-clarified-request
@@ -1,7 +1,3 @@
#!/bin/bash
-cd "`dirname "$0"`"
-
-bundle exec ./runner 'RequestMailer.alert_not_clarified_request'
-
-
+bundle exec rails runner 'RequestMailer.alert_not_clarified_request'
diff --git a/script/alert-overdue-requests b/script/alert-overdue-requests
index 46450f1f2..9e597d17d 100755
--- a/script/alert-overdue-requests
+++ b/script/alert-overdue-requests
@@ -1,5 +1,3 @@
#!/bin/bash
-cd "`dirname "$0"`"
-
-bundle exec ./runner 'RequestMailer.alert_overdue_requests()'
+bundle exec rails runner 'RequestMailer.alert_overdue_requests'
diff --git a/script/alert-tracks b/script/alert-tracks
index 117f7a406..9fd32f2a1 100755
--- a/script/alert-tracks
+++ b/script/alert-tracks
@@ -1,11 +1,8 @@
#!/bin/bash
-LOC=`dirname $0`
-
if [ "$1" == "--loop" ]
then
- "$LOC/runner" 'TrackMailer.alert_tracks_loop'
+ bundle exec rails runner 'TrackMailer.alert_tracks_loop'
else
- "$LOC/runner" 'TrackMailer.alert_tracks'
+ bundle exec rails runner 'TrackMailer.alert_tracks'
fi
-
diff --git a/script/annotate-models b/script/annotate-models
index b6e01c010..7b6daa3c5 100755
--- a/script/annotate-models
+++ b/script/annotate-models
@@ -2,4 +2,4 @@
#
# annotates the models in app/ with schema information
-bundle exec annotate -m -p before --exclude tests,fixtures
+bundle exec annotate --show-migration --position before --exclude tests,fixtures
diff --git a/script/autospec b/script/autospec
deleted file mode 100755
index 837bbd7f4..000000000
--- a/script/autospec
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env ruby
-gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
-ENV['RSPEC'] = 'true' # allows autotest to discover rspec
-ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
-system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
- $stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
diff --git a/script/breakpointer b/script/breakpointer
deleted file mode 100755
index 46a01d1b2..000000000
--- a/script/breakpointer
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/breakpointer'
diff --git a/script/cache-incoming-emails b/script/cache-incoming-emails
index 0b3069bd7..b13efbd8c 100644..100755
--- a/script/cache-incoming-emails
+++ b/script/cache-incoming-emails
@@ -4,6 +4,4 @@
# Will take a while to run! Can use after clear-caches to refresh the database
# level caches if you like.
-cd "`dirname "$0"`"
-
-bundle exec ./runner 'IncomingMessage.find_each() { |im| print "info request " + im.info_request.id.to_s + ", incoming message " + im.id.to_s + ": " + im.extract_attachments!.count.to_s + " attachments extracted to " + im.foi_attachments[0].directory + "; main body folded: " + im.get_main_body_text_folded.size.to_s + " attachment clipped:" + im.get_attachment_text_clipped.size.to_s + "\n" }'
+bundle exec rails runner 'IncomingMessage.find_each { |im| print "info request " + im.info_request.id.to_s + ", incoming message " + im.id.to_s + ": " + im.extract_attachments!.count.to_s + " attachments extracted to " + im.foi_attachments[0].directory + "; main body folded: " + im.get_main_body_text_folded.size.to_s + " attachment clipped:" + im.get_attachment_text_clipped.size.to_s + "\n" }'
diff --git a/script/check-recent-requests-sent b/script/check-recent-requests-sent
index 7840dba4a..1eb87d498 100755
--- a/script/check-recent-requests-sent
+++ b/script/check-recent-requests-sent
@@ -1,8 +1,3 @@
#!/bin/bash
-cd "`dirname "$0"`"
-
-bundle exec ./runner 'MailServerLog.check_recent_requests_have_been_sent'
-
-
-
+bundle exec rails runner 'MailServerLog.check_recent_requests_have_been_sent'
diff --git a/script/clear-caches b/script/clear-caches
index 43fec2811..f97c1f777 100755
--- a/script/clear-caches
+++ b/script/clear-caches
@@ -2,12 +2,11 @@
# Clear the cache of attachment and body text.
-cd "`dirname "$0"`"
+LOC="`dirname "$0"`"
-bundle exec ./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\")"
+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
-
diff --git a/script/console b/script/console
deleted file mode 100755
index 83386647f..000000000
--- a/script/console
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/console'
diff --git a/script/dbconsole b/script/dbconsole
deleted file mode 100755
index 39042fad3..000000000
--- a/script/dbconsole
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/dbconsole'
diff --git a/script/delete-old-things b/script/delete-old-things
index 063d85e1f..58c144958 100755
--- a/script/delete-old-things
+++ b/script/delete-old-things
@@ -1,6 +1,4 @@
#!/bin/bash
-cd "`dirname "$0"`"
-
-bundle exec ./runner 'PostRedirect.delete_old_post_redirects()'
-bundle exec ./runner 'TrackThingsSentEmail.delete_old_track_things_sent_email()'
+bundle exec rails runner 'PostRedirect.delete_old_post_redirects'
+bundle exec rails runner 'TrackThingsSentEmail.delete_old_track_things_sent_email'
diff --git a/script/destroy b/script/destroy
deleted file mode 100755
index fddc5160d..000000000
--- a/script/destroy
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/destroy'
diff --git a/script/direct-rspec b/script/direct-rspec
deleted file mode 100755
index 50a1daba1..000000000
--- a/script/direct-rspec
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-./vendor/plugins/rspec/bin/spec $1
-
-# spec/controllers/request_controller_spec.rb
-
-#ruby -I/home/francis/keep/devel/mysociety/foi/vendor/plugins/rspec/lib /home/francis/keep/devel/mysociety/foi/vendor/plugins/rspec/bin/spec spec/controllers/admin_public_body_controller_spec.rb spec/controllers/application_spec.rb spec/controllers/request_controller_spec.rb spec/controllers/user_controller_spec.rb spec/controllers/admin_controller_spec.rb spec/controllers/body_controller_spec.rb spec/models/incoming_message_spec.rb spec/models/user_spec.rb spec/models/request_mailer_spec.rb spec/models/post_redirect_spec.rb spec/models/public_body_spec.rb spec/models/info_request_spec.rb spec/models/user_mailer_spec.rb spec/models/outgoing_message_spec.rb --options /home/francis/keep/devel/mysociety/foi/spec/spec.opts
-
diff --git a/script/generate b/script/generate
deleted file mode 100755
index fb8139d12..000000000
--- a/script/generate
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/generate'
diff --git a/script/handle-mail-replies.rb b/script/handle-mail-replies.rb
index 4e35ee0cf..23430e20a 100755
--- a/script/handle-mail-replies.rb
+++ b/script/handle-mail-replies.rb
@@ -14,12 +14,8 @@
# 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"))
-require "configuration"
-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
@@ -165,7 +161,7 @@ def is_oof?(message)
end
def forward_on(raw_message)
- IO.popen("/usr/sbin/sendmail -i #{Configuration::forward_nonbounce_responses_to}", "w") do |f|
+ IO.popen("/usr/sbin/sendmail -i #{AlaveteliConfiguration::forward_nonbounce_responses_to}", "w") do |f|
f.write(raw_message);
f.close;
end
diff --git a/script/load-mail-server-logs b/script/load-mail-server-logs
index 9ff7a1401..770bf7026 100755
--- a/script/load-mail-server-logs
+++ b/script/load-mail-server-logs
@@ -14,7 +14,7 @@ then
*) f=$(pwd)/$1 ;;
esac
cd "$LOC"
- bundle exec ./runner 'MailServerLog.load_file("'$f'")'
+ bundle exec rails runner 'MailServerLog.load_file("'$f'")'
exit
fi
@@ -23,5 +23,5 @@ cd "$LOC"
LATEST=$( ls $OPTION_MTA_LOG_PATH 2>/dev/null | sort | tail -3 )
for X in $LATEST
do
- bundle exec ./runner 'MailServerLog.load_file("'$X'")'
+ bundle exec rails runner 'MailServerLog.load_file("'$X'")'
done
diff --git a/script/load-sample-data b/script/load-sample-data
index 86e1af128..e91516886 100755
--- a/script/load-sample-data
+++ b/script/load-sample-data
@@ -4,16 +4,28 @@
# the fact that the fixtures aren't aware of the fact that RawEmails
# have a filesystem representation of their contents
-LOC=`dirname "$0"`
+export LOC=`dirname "$0"`
-bundle exec rake --silent spec:db:fixtures:load
+bundle exec rails runner /dev/stdin <<END
+require 'rspec/rails'
+require "#{ENV['LOC']}/../spec/support/load_file_fixtures.rb"
+require "#{ENV['LOC']}/../spec/support/email_helpers.rb"
-"$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
+RSpec.configure do |config|
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+end
+
+# HACK: Normally to load fixtures you'd run `rake db:fixtures:load` but since we
+# have .csv files in the fixtures folder Rails tries to load those too. Therefore
+# we've pinched some code to load the fixtures:
+# https://github.com/rails/rails/blob/v3.1.11/activerecord/lib/active_record/railties/databases.rake#L311
+fixtures_dir = "#{ENV['LOC']}/../spec/fixtures"
+
+Dir["#{fixtures_dir}/**/*.yml"].each do |fixture_file|
+ ActiveRecord::Fixtures.create_fixtures(fixtures_dir, fixture_file[(fixtures_dir.size + 1)..-5])
+end
load_raw_emails_data
END
-echo "Loaded fixtures. You may now wish to run $LOC/update-xapian-index"
+echo "Loaded fixtures. You may now wish to run $LOC/update-xapian-index"
diff --git a/script/mailin b/script/mailin
index b4d77f7a4..6ed6bc7db 100755
--- a/script/mailin
+++ b/script/mailin
@@ -13,7 +13,7 @@ source commonlib/shlib/deployfns
read_conf config/general
-script/runner 'RequestMailer.receive(STDIN.read)' <"$INPUT" >"$OUTPUT" 2>&1
+rails runner 'RequestMailer.receive(STDIN.read)' <"$INPUT" >"$OUTPUT" 2>&1
ERROR_CODE=$?
if [ ! "$ERROR_CODE" = "0" ]
then
diff --git a/script/performance/benchmarker b/script/performance/benchmarker
deleted file mode 100755
index 28bfceea0..000000000
--- a/script/performance/benchmarker
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/performance/benchmarker'
diff --git a/script/performance/profiler b/script/performance/profiler
deleted file mode 100755
index 11baf44f2..000000000
--- a/script/performance/profiler
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/performance/profiler'
diff --git a/script/performance/request b/script/performance/request
deleted file mode 100755
index fff6fe660..000000000
--- a/script/performance/request
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/performance/request'
diff --git a/script/plugin b/script/plugin
deleted file mode 100755
index 49f5c441f..000000000
--- a/script/plugin
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/plugin'
diff --git a/script/process/inspector b/script/process/inspector
deleted file mode 100755
index 467962602..000000000
--- a/script/process/inspector
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/process/inspector'
diff --git a/script/process/reaper b/script/process/reaper
deleted file mode 100755
index 2eea898db..000000000
--- a/script/process/reaper
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/process/reaper'
diff --git a/script/process/spawner b/script/process/spawner
deleted file mode 100755
index ac417c3a7..000000000
--- a/script/process/spawner
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/process/spawner'
diff --git a/script/purge-varnish b/script/purge-varnish
index 932cf6635..7dcecd4f9 100755
--- a/script/purge-varnish
+++ b/script/purge-varnish
@@ -4,8 +4,8 @@ LOC=`dirname $0`
if [ "$1" == "--loop" ]
then
- "$LOC/runner" 'PurgeRequest.purge_all_loop'
+ rails runner 'PurgeRequest.purge_all_loop'
else
- "$LOC/runner" 'PurgeRequest.purge_all'
+ rails runner 'PurgeRequest.purge_all'
fi
diff --git a/script/rails b/script/rails
new file mode 100755
index 000000000..f8da2cffd
--- /dev/null
+++ b/script/rails
@@ -0,0 +1,6 @@
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+APP_PATH = File.expand_path('../../config/application', __FILE__)
+require File.expand_path('../../config/boot', __FILE__)
+require 'rails/commands'
diff --git a/script/rails-post-deploy b/script/rails-post-deploy
index a1c613312..a9e239423 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`
+APP_DIR="$(readlink -f $(dirname "$BASH_SOURCE")/..)"
+cd "$APP_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" ]
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/runner b/script/runner
index 1575848de..73b03847d 100755
--- a/script/runner
+++ b/script/runner
@@ -6,7 +6,6 @@ script_dir = File.dirname(__FILE__)
alaveteli_dir = File.expand_path(File.join(script_dir, ".."))
Dir.chdir(alaveteli_dir) do
- require File.join(alaveteli_dir, 'config', 'boot')
if daemon_mode
# Run in daemon mode.
@@ -20,7 +19,7 @@ Dir.chdir(alaveteli_dir) do
# Load the runner in a subprocess
pid = fork do
- require 'commands/runner'
+ `bundle exec rails runner #{ARGV[1]}`
exit 0
end
@@ -35,6 +34,6 @@ Dir.chdir(alaveteli_dir) do
Process.detach(pid)
else
# Not daemon mode
- require 'commands/runner'
+ `bundle exec rails runner #{ARGV[1]}`
end
end
diff --git a/script/server b/script/server
deleted file mode 100755
index dc3edabd5..000000000
--- a/script/server
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require File.expand_path(File.dirname(__FILE__) + '/../config/boot.rb')
-require 'commands/server'
diff --git a/script/spec b/script/spec
deleted file mode 100755
index 46fdbe6e4..000000000
--- a/script/spec
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env ruby
-if ARGV.any? {|arg| %w[--drb -X --generate-options -G --help -h --version -v].include?(arg)}
- require 'rubygems' unless ENV['NO_RUBYGEMS']
-else
- gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
- ENV["RAILS_ENV"] ||= 'test'
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment") unless defined?(RAILS_ROOT)
-end
-require 'spec/autorun'
-exit ::Spec::Runner::CommandLine.run
diff --git a/script/spec-all-pairs b/script/spec-all-pairs
deleted file mode 100755
index 6d7bb17c4..000000000
--- a/script/spec-all-pairs
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/bin/bash
-
-# Try all ordered pairs of spec files,
-# to winkle out order-dependent failures.
-
-log_file=/dev/null
-
-test_pair () {
- bundle exec 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/spec_server b/script/spec_server
deleted file mode 100755
index dfdf8ff6c..000000000
--- a/script/spec_server
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/env ruby
-$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
-require 'rubygems'
-require 'drb/drb'
-require 'rbconfig'
-require 'spec'
-require 'optparse'
-
-# This is based on Florian Weber's TDDMate
-module Spec
- module Runner
- class RailsSpecServer
- def run(argv, stderr, stdout)
- $stdout = stdout
- $stderr = stderr
-
- base = ActiveRecord::Base
- def base.clear_reloadable_connections!
- active_connections.each do |name, conn|
- if conn.requires_reloading?
- conn.disconnect!
- active_connections.delete(name)
- end
- end
- end
-
- if ActionController.const_defined?(:Dispatcher)
- dispatcher = ::ActionController::Dispatcher.new($stdout)
- dispatcher.cleanup_application
- elsif ::Dispatcher.respond_to?(:reset_application!)
- ::Dispatcher.reset_application!
- else
- raise "Application reloading failed"
- end
- if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache)
- Fixtures.reset_cache
- end
-
- ::Dependencies.mechanism = :load
- require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
- load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
-
- if in_memory_database?
- load "#{Rails.root}/db/schema.rb" # use db agnostic schema by default
- ActiveRecord::Migrator.up('db/migrate') # use migrations
- end
-
- ::Spec::Runner::CommandLine.run(
- ::Spec::Runner::OptionParser.parse(
- argv,
- $stderr,
- $stdout
- )
- )
- end
-
- def in_memory_database?
- ENV["RAILS_ENV"] == "test" and
- ::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and
- ::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
- end
- end
- end
-end
-puts "Loading Rails environment"
-
-ENV["RAILS_ENV"] = "test"
-require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
-require 'dispatcher'
-
-def restart_test_server
- puts "restarting"
- config = ::Config::CONFIG
- ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
- command_line = [ruby, $0, ARGV].flatten.join(' ')
- exec(command_line)
-end
-
-def daemonize(pid_file = nil)
- return yield if $DEBUG
- pid = Process.fork{
- Process.setsid
- Dir.chdir(Rails.root)
- trap("SIGINT"){ exit! 0 }
- trap("SIGTERM"){ exit! 0 }
- trap("SIGHUP"){ restart_test_server }
- File.open("/dev/null"){|f|
- STDERR.reopen f
- STDIN.reopen f
- STDOUT.reopen f
- }
- yield
- }
- puts "spec_server launched. (PID: %d)" % pid
- File.open(pid_file,"w"){|f| f.puts pid } if pid_file
- exit! 0
-end
-
-options = Hash.new
-opts = OptionParser.new
-opts.on("-d", "--daemon"){|v| options[:daemon] = true }
-opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v }
-opts.parse!(ARGV)
-
-puts "Ready"
-exec_server = lambda {
- trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
- DRb.start_service("druby://localhost:8989", Spec::Runner::RailsSpecServer.new)
- DRb.thread.join
-}
-
-if options[:daemon]
- daemonize(options[:pid], &exec_server)
-else
- exec_server.call
-end
diff --git a/script/stop-new-responses-on-old-requests b/script/stop-new-responses-on-old-requests
index 1e325403e..f317f11ff 100755
--- a/script/stop-new-responses-on-old-requests
+++ b/script/stop-new-responses-on-old-requests
@@ -1,7 +1,3 @@
#!/bin/bash
-cd "`dirname "$0"`"
-
-bundle exec ./runner 'InfoRequest.stop_new_responses_on_old_requests()'
-
-
+bundle exec rails runner 'InfoRequest.stop_new_responses_on_old_requests'
diff --git a/script/test-run b/script/test-run
deleted file mode 100755
index 7810b57d5..000000000
--- a/script/test-run
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-cd ../
-bundle exec rake spec
-
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"
diff --git a/script/wraptest b/script/wraptest
deleted file mode 100755
index 780c9b4a2..000000000
--- a/script/wraptest
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env ruby
-#
-# wraptest:
-# Test email wrapping function
-#
-# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
-#
-
-$:.push(File.join(File.dirname(__FILE__), '../../rblib'))
-load "format.rb"
-
-test_email = '''Dear Sir or Madam,
-
-Again and again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet again I extend this sentence and yet
-
-Hey you.
-
-Yours faithfully,
-
-Boo!
-
---
-
-Sent using GovernmentSpy, a project of UKCOD, registered charity number
-1076346. Is frabcus@fastmail.fm the wrong
-address for Freedom of Information requests to The Geraldine Quango? If so please let us know by emailing
-team@governmentspy quoting reference PB2.
-We\'ll make sure future ones go to the right place.
-'''
-
-test_email.gsub!(/\n/, "\r\n")
-
-puts MySociety::Format.wrap_email_body(test_email)
-
-#puts MySociety::Format.wrap_email_body("Hello this is a string.
-#
-#And another.
-#And a third.")
-
-
-
-