aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/.gitignore1
-rw-r--r--config/alert-tracks-debian.ugly81
-rw-r--r--config/boot.rb21
-rw-r--r--config/crontab.ugly2
-rw-r--r--config/environment.rb17
-rw-r--r--config/general-example16
-rw-r--r--config/initializers/fast_gettext.rb1
l---------config/locales2
-rw-r--r--config/packages1
-rw-r--r--config/routes.rb2
10 files changed, 126 insertions, 18 deletions
diff --git a/config/.gitignore b/config/.gitignore
index 541e7c4a5..b2ceae33c 100644
--- a/config/.gitignore
+++ b/config/.gitignore
@@ -1,3 +1,4 @@
+/config.tmp
/general
/general.deployed
/database.yml
diff --git a/config/alert-tracks-debian.ugly b/config/alert-tracks-debian.ugly
new file mode 100644
index 000000000..e4cc12b38
--- /dev/null
+++ b/config/alert-tracks-debian.ugly
@@ -0,0 +1,81 @@
+#!/bin/bash
+#
+### BEGIN INIT INFO
+# Provides: alert-tracks
+# Required-Start: $local_fs $syslog
+# Required-Stop: $local_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: alert-tracks is a daemon running the WhatDoTheyKnow email alerts
+# Description: alert-tracks send WhatDoTheyKnow email alerts as required
+### END INIT INFO
+#
+# !!(*= $daemon_name *)!! Start the WhatDoTheyKnow email alert daemon
+
+NAME=!!(*= $daemon_name *)!!
+DAEMON=/data/vhost/!!(*= $vhost *)!!/alaveteli/script/runner
+DAEMON_ARGS="--daemon TrackMailer.alert_tracks_loop"
+PIDFILE=/data/vhost/!!(*= $vhost *)!!/alert-tracks.pid
+LOGFILE=/data/vhost/!!(*= $vhost *)!!/logs/alert-tracks.log
+DUSER=!!(*= $user *)!!
+
+trap "" 1
+
+export PIDFILE LOGFILE
+
+quietly_start_daemon() {
+ /sbin/start-stop-daemon --quiet --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS
+}
+
+start_daemon() {
+ /sbin/start-stop-daemon --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS
+}
+
+stop_daemon() {
+ /sbin/start-stop-daemon --stop --pidfile "$PIDFILE"
+}
+
+restart() { stop; start; }
+
+case "$1" in
+ check)
+ quietly_start_daemon
+ if [ $? -ne 1 ]
+ then
+ echo "WhatDoTheyKnow alert daemon was not running; now restarted"
+ exit 1
+ else
+ exit 0
+ fi
+ ;;
+
+ start)
+ echo -n "Starting WhatDoTheyKnow alert daemon: $NAME"
+ start_daemon
+ ;;
+
+ stop)
+ echo -n "Stopping WhatDoTheyKnow alert daemon: $NAME"
+ stop_daemon
+ ;;
+
+ restart)
+ echo -n "Restarting WhatDoTheyKnow alert daemon: $NAME"
+ stop_daemon
+ start_daemon
+ ;;
+
+ *)
+ echo "Usage: /etc/init.d/$NAME {start|stop|restart|check}"
+ exit 1
+ ;;
+esac
+
+if [ $? -eq 0 ]; then
+ echo .
+ exit 0
+else
+ echo " failed"
+ exit 1
+fi
+
diff --git a/config/boot.rb b/config/boot.rb
index 30e4851a5..90fd9cd4d 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -54,6 +54,7 @@ module Rails
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
+ Rails::GemDependency.add_frozen_gem_path
end
end
@@ -71,13 +72,17 @@ module Rails
gem 'rails'
end
rescue Gem::LoadError => load_error
- $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
- exit 1
+ if load_error.message =~ /Could not find RubyGem rails/
+ STDERR.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
+ exit 1
+ else
+ raise
+ end
end
class << self
def rubygems_version
- Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion
+ Gem::RubyGemsVersion rescue nil
end
def gem_version
@@ -91,15 +96,16 @@ module Rails
end
def load_rubygems
+ min_version = '1.3.2'
require 'rubygems'
- unless rubygems_version >= '0.9.4'
- $stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.)
+ unless rubygems_version >= min_version
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
- $stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org)
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
exit 1
end
@@ -115,5 +121,8 @@ module Rails
end
end
+
+
# All that for this:
Rails.boot!
+
diff --git a/config/crontab.ugly b/config/crontab.ugly
index d572e1a9a..5820151a0 100644
--- a/config/crontab.ugly
+++ b/config/crontab.ugly
@@ -12,7 +12,7 @@ MAILTO=cron-!!(*= $site *)!!@mysociety.org
# Every 5 minutes
*/5 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/update-xapian-index.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/update-xapian-index || echo "stalled?"
# Every 10 minutes
-5,15,25,35,45,55 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/alert-tracks.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/alert-tracks || echo "stalled?"
+5,15,25,35,45,55 * * * * !!(*= $user *)!! /etc/init.d/foi-alert-tracks check
# Once an hour
39 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/alert-overdue-requests.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/alert-overdue-requests || echo "stalled?"
diff --git a/config/environment.rb b/config/environment.rb
index 77d212f2f..f268233c6 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -6,7 +6,7 @@
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
+RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
@@ -51,6 +51,8 @@ Rails::Initializer.run do |config|
# config.log_level = :debug
#
# Specify gems that this application depends on and have them installed with rake gems:install
+ config.gem "locale", :version => '>=2.0.5'
+ config.gem "gettext", :version => '>=1.9.3'
config.gem "fast_gettext", :version => '>=0.4.8'
config.gem "rack", :version => '1.1.0'
config.gem "recaptcha", :lib => "recaptcha/rails"
@@ -63,7 +65,7 @@ Rails::Initializer.run do |config|
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
config.action_controller.session = {
- :session_key => '_wdtk_cookie_session',
+ :key => '_wdtk_cookie_session',
:secret => MySociety::Config.get("COOKIE_STORE_SESSION_SECRET", 'this default is insecure as code is open source, please override for live sites in config/general; this will do for local development')
}
config.action_controller.session_store = :cookie_store
@@ -106,7 +108,7 @@ ActionMailer::Base.default_url_options[:host] = MySociety::Config.get("DOMAIN",
if (MySociety::Config.get("DOMAIN", "") != "")
ActionController::Base.asset_host = Proc.new { |source, request|
if request.fullpath.match(/^\/admin\//)
- MySociety::Config.get("ADMIN_PUBLIC_URL", "/")
+ MySociety::Config.get("ADMIN_PUBLIC_URL", "")
else
MySociety::Config.get("DOMAIN", 'localhost:3000')
end
@@ -115,8 +117,13 @@ end
# fallback locale and available locales
I18n.default_locale = :sq
-available_locales = MySociety::Config.get('AVAILABLE_LOCALES', 'sq en sr')
-FastGettext.default_available_locales = available_locales.split(/ /)
+if ENV["RAILS_ENV"] == "test"
+ # The tests assume that the "en" and "es" locales are available
+ FastGettext.default_available_locales = ["en", "es"]
+else
+ available_locales = MySociety::Config.get('AVAILABLE_LOCALES', 'sq en sr')
+ FastGettext.default_available_locales = available_locales.split(/ /)
+end
# Load monkey patches and other things from lib/
require 'tmail_extensions.rb'
diff --git a/config/general-example b/config/general-example
index 29f29ca8d..a3d1aed2a 100644
--- a/config/general-example
+++ b/config/general-example
@@ -39,8 +39,8 @@ define('OPTION_BLACKHOLE_PREFIX', 'do-not-reply-to-this-address'); // used as en
define('OPTION_CONTACT_EMAIL', 'admin@localhost');
define('OPTION_ADMIN_BASE_URL', '/admin/');
// Where /stylesheets sits under for admin pages. See asset_host in
-// config/environment.rb. Can be full domain or relative path.
-define('OPTION_ADMIN_PUBLIC_URL', '/');
+// config/environment.rb. Can be full domain or relative path (not an absolute path beginning with /).
+define('OPTION_ADMIN_PUBLIC_URL', '');
// Secret key for signing cookie_store sessions
define('OPTION_COOKIE_STORE_SESSION_SECRET', 'your secret key here, make it long and random');
@@ -55,5 +55,15 @@ define('OPTION_RECAPTCHA_PUBLIC_KEY', 'x');
define('OPTION_RECAPTCHA_PRIVATE_KEY', 'x');
// Locales we wish to support in this app
-define('OPTION_AVAILABLE_LOCALES', 'en es')
+define('OPTION_AVAILABLE_LOCALES', 'en es');
+
+// example searches for the home page, semicolon delimited
+define('OPTION_FRONTPAGE_SEARCH_EXAMPLES', 'Geraldine Quango; Department for Humpadinking');
+
+// example public bodies for the home page, semicolon delimited - short_names
+define('OPTION_FRONTPAGE_PUBLICBODY_EXAMPLES', 'tgq');
+
+// URL of theme to install
+define('OPTION_THEME_URL', 'git://github.com/mysociety/whatdotheyknow-theme.git');
+
?>
diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb
index 4c000d97d..026c4111c 100644
--- a/config/initializers/fast_gettext.rb
+++ b/config/initializers/fast_gettext.rb
@@ -1,3 +1,2 @@
FastGettext.add_text_domain 'app', :path => 'locale', :type => :po
-FastGettext.default_available_locales = ['sq','en','sr'] #all you want to allow
FastGettext.default_text_domain = 'app'
diff --git a/config/locales b/config/locales
index 748fbfcbe..10a4f96c3 120000
--- a/config/locales
+++ b/config/locales
@@ -1 +1 @@
-/home/seb/Code/alaveteli/vendor/rails-locales/rails/locale \ No newline at end of file
+../vendor/rails-locales/rails/locale \ No newline at end of file
diff --git a/config/packages b/config/packages
index 73f554acd..95c3dcfed 100644
--- a/config/packages
+++ b/config/packages
@@ -38,3 +38,4 @@ libmemcache-client-ruby (>= 1.7.8-2)
memcached
rubygems
libfcgi-dev
+gettext
diff --git a/config/routes.rb b/config/routes.rb
index 9320d5b60..60a49a6e0 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -169,7 +169,7 @@ ActionController::Routing::Routes.draw do |map|
admin.admin_request_generate_upload_url '/admin/request/generate_upload_url/:id', :action => 'generate_upload_url'
admin.admin_request_show_raw_email '/admin/request/show_raw_email/:id', :action => 'show_raw_email'
admin.admin_request_download_raw_email '/admin/request/download_raw_email/:id', :action => 'download_raw_email'
- admin.admin_request_clarification '/admin/request/clarification', :action => 'mark_event_as_clarification'
+ admin.admin_request_clarification '/admin/request/mark_event_as_clarification', :action => 'mark_event_as_clarification'
end
map.with_options :controller => 'admin_user' do |user|