diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/.gitignore | 1 | ||||
-rw-r--r-- | config/alert-tracks-debian.ugly | 6 | ||||
-rw-r--r-- | config/application.rb | 5 | ||||
-rw-r--r-- | config/crontab-example (renamed from config/crontab.ugly) | 6 | ||||
-rw-r--r-- | config/database.yml-example | 2 | ||||
-rw-r--r-- | config/deploy.rb | 1 | ||||
-rw-r--r-- | config/general.yml-example | 5 | ||||
-rw-r--r-- | config/httpd.conf-example | 4 | ||||
-rw-r--r-- | config/initializers/alaveteli.rb | 13 | ||||
-rw-r--r-- | config/initializers/secret_token.rb | 7 | ||||
-rw-r--r-- | config/initializers/theme_loader.rb | 21 | ||||
l--------- | config/locales | 1 | ||||
-rw-r--r-- | config/packages | 4 | ||||
-rw-r--r-- | config/packages_development | 9 | ||||
-rw-r--r-- | config/purge-varnish-debian.ugly | 6 | ||||
-rw-r--r-- | config/routes.rb | 20 |
16 files changed, 73 insertions, 38 deletions
diff --git a/config/.gitignore b/config/.gitignore index 5ad2de008..fbe4a97d3 100644 --- a/config/.gitignore +++ b/config/.gitignore @@ -8,3 +8,4 @@ memcached.yml *.deployed deploy.yml newrelic.yml +crontab diff --git a/config/alert-tracks-debian.ugly b/config/alert-tracks-debian.ugly index 2b52ad840..29a350a0e 100644 --- a/config/alert-tracks-debian.ugly +++ b/config/alert-tracks-debian.ugly @@ -1,13 +1,13 @@ #!/bin/bash # ### BEGIN INIT INFO -# Provides: alert-tracks +# Provides: !!(*= $daemon_name *)!! # 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 Alaveteli email alerts -# Description: alert-tracks send Alaveteli email alerts as required +# Short-Description: !!(*= $daemon_name *)!! is a daemon running the Alaveteli email alerts +# Description: !!(*= $daemon_name *)!! sends Alaveteli email alerts as required ### END INIT INFO # # !!(*= $daemon_name *)!! Start the Alaveteli email alert daemon diff --git a/config/application.rb b/config/application.rb index f5b525a36..92fd30685 100644 --- a/config/application.rb +++ b/config/application.rb @@ -55,8 +55,11 @@ module Alaveteli # will be in this time zone config.time_zone = ::AlaveteliConfiguration::time_zone - config.after_initialize do + config.after_initialize do |app| require 'routing_filters.rb' + # Add a catch-all route to force routing errors to be handled by the application, + # rather than by middleware. + app.routes.append{ match '*path', :to => 'general#not_found' } end config.autoload_paths << "#{Rails.root.to_s}/lib/mail_handler" diff --git a/config/crontab.ugly b/config/crontab-example index d33450df4..32baff170 100644 --- a/config/crontab.ugly +++ b/config/crontab-example @@ -1,7 +1,7 @@ -# crontab.ugly: -# Timed tasks for FOI site. Template file. +# crontab-example: +# Timed tasks for Alaveteli site. Template file. # -# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved. +# Copyright (c) 2013 UK Citizens Online Democracy. All rights reserved. # Email: hello@mysociety.org. WWW: http://www.mysociety.org/ PATH=/usr/local/bin:/usr/bin:/bin diff --git a/config/database.yml-example b/config/database.yml-example index b1597e6fe..e48577f23 100644 --- a/config/database.yml-example +++ b/config/database.yml-example @@ -19,6 +19,8 @@ test: password: <password> host: localhost port: 5432 +# Uncomment the following if the user is not a postgres superuser +# constraint_disabling: false production: adapter: postgresql diff --git a/config/deploy.rb b/config/deploy.rb index 5e660434a..3ce1a1969 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -50,6 +50,7 @@ namespace :deploy do "#{release_path}/config/general.yml" => "#{shared_path}/general.yml", "#{release_path}/config/rails_env.rb" => "#{shared_path}/rails_env.rb", "#{release_path}/config/newrelic.yml" => "#{shared_path}/newrelic.yml", + "#{release_path}/config/httpd.conf" => "#{shared_path}/httpd.conf", "#{release_path}/config/aliases" => "#{shared_path}/aliases", "#{release_path}/public/foi-live-creation.png" => "#{shared_path}/foi-live-creation.png", "#{release_path}/public/foi-user-use.png" => "#{shared_path}/foi-user-use.png", diff --git a/config/general.yml-example b/config/general.yml-example index 17e1aa552..0753af46b 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -187,3 +187,8 @@ MTA_LOG_PATH: '/var/log/exim4/exim-mainlog-*' # Whether we are using "exim" or "postfix" for our MTA MTA_LOG_TYPE: "exim" + +# URL where people can donate to the organisation running the site. If set, +# this will be included in the message people see when their request is +# successful. +DONATION_URL: "http://www.mysociety.org/donate/" diff --git a/config/httpd.conf-example b/config/httpd.conf-example index 0115ad8d9..1326252f5 100644 --- a/config/httpd.conf-example +++ b/config/httpd.conf-example @@ -1,4 +1,4 @@ -# Apache configuracreated_attion for FOI site. +# Apache configuration for FOI site. # # For development ignore this, you can just run ./scripts/server as for any # Ruby on Rails application. @@ -51,7 +51,7 @@ RewriteRule ^/request/((\d{1,3})\d*)/(response/\d+/attach/(html/)?\d+/.+) /views # Recommend setting this to 3 or less on servers with 512MB RAM PassengerMaxPoolSize 6 # The RackEnv variable applies to Rails 3 applications, while - # the RailsEnv variable applies to applicatoins for earlier + # the RailsEnv variable applies to applications for earlier # versions of Rails. There doesn't seem to be any harm in # setting both, however. RailsEnv production diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index 35d486837..d78bc3925 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -10,7 +10,7 @@ load "debug_helpers.rb" load "util.rb" # Application version -ALAVETELI_VERSION = '0.10' +ALAVETELI_VERSION = '0.12' # Add new inflection rules using the following format # (all these examples are active by default): @@ -43,15 +43,11 @@ I18n.locale = default_locale I18n.available_locales = available_locales.map {|locale_name| locale_name.to_sym} I18n.default_locale = default_locale -# Customise will_paginate URL generation -WillPaginate::ViewHelpers.pagination_options[:renderer] = 'WillPaginateExtension::LinkRenderer' - # Load monkey patches and other things from lib/ require 'ruby19.rb' require 'activesupport_cache_extensions.rb' require 'use_spans_for_errors.rb' require 'activerecord_errors_extensions.rb' -require 'willpaginate_extension.rb' require 'i18n_fixes.rb' require 'world_foi_websites.rb' require 'alaveteli_external_command.rb' @@ -59,3 +55,10 @@ require 'quiet_opener.rb' require 'mail_handler' require 'public_body_categories' require 'ability' +require 'normalize_string' +require 'alaveteli_file_types' + +# Allow tests to be run under a non-superuser database account if required +if Rails.env == 'test' and ActiveRecord::Base.configurations['test']['constraint_disabling'] == false + require 'no_constraint_disabling' +end diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index f82348169..d120b94ae 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -4,4 +4,9 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -Alaveteli::Application.config.secret_token = AlaveteliConfiguration::cookie_store_session_secret + +# Just plopping an extra character on the secret_token so that any sessions on upgrading from +# Rails 2 to Rails 3 version of Alaveteli are invalidated. +# See http://blog.carbonfive.com/2011/03/19/rails-3-upgrade-tip-invalidate-session-cookies/ + +Alaveteli::Application.config.secret_token = "3" + AlaveteliConfiguration::cookie_store_session_secret diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb index 4c8967c97..1ad2d01f1 100644 --- a/config/initializers/theme_loader.rb +++ b/config/initializers/theme_loader.rb @@ -2,12 +2,23 @@ # It is used by our config/routes.rb to decide which route extension files to load. $alaveteli_route_extensions = [] -if ENV["RAILS_ENV"] != "test" # Don't let the themes interfere with Alaveteli specs +def require_theme(theme_name) + theme_main_include = File.expand_path "../../../vendor/plugins/#{theme_name}/lib/alavetelitheme.rb", __FILE__ + if File.exists? theme_main_include + require theme_main_include + end +end + +if Rails.env == "test" + # By setting this ALAVETELI_TEST_THEME to a theme name, theme tests can run in the Rails + # context with the theme loaded. Otherwise the themes from the config aren't loaded in testing + # so they don't interfere with core Alaveteli tests + if defined? ALAVETELI_TEST_THEME + require_theme(ALAVETELI_TEST_THEME) + end +else for url in AlaveteliConfiguration::theme_urls.reverse theme_name = url.sub(/.*\/(.*).git/, "\\1") - theme_main_include = File.expand_path "../../../vendor/plugins/#{theme_name}/lib/alavetelitheme.rb", __FILE__ - if File.exists? theme_main_include - require theme_main_include - end + require_theme(theme_name) end end diff --git a/config/locales b/config/locales deleted file mode 120000 index 10a4f96c3..000000000 --- a/config/locales +++ /dev/null @@ -1 +0,0 @@ -../vendor/rails-locales/rails/locale
\ No newline at end of file diff --git a/config/packages b/config/packages index db51e5bdd..f4d0a674c 100644 --- a/config/packages +++ b/config/packages @@ -20,7 +20,6 @@ gnuplot-nox php5-cli sharutils unzip -wdg-html-validator mutt tnef (>= 1.4.5) gettext @@ -36,4 +35,5 @@ rake (>= 0.9.2.2) build-essential bundler sqlite3 -libsqlite3-dev
\ No newline at end of file +libsqlite3-dev +libicu-dev diff --git a/config/packages_development b/config/packages_development new file mode 100644 index 000000000..14ca815a2 --- /dev/null +++ b/config/packages_development @@ -0,0 +1,9 @@ +# This is a list of packages needed on a fresh Ubuntu installation for +# development. +# +# It assumes you're using RVM or a similar Ruby manager and have already +# run `bundle install`. +# +# To install, paste this list after `sudo apt-get install` and run. + +postgresql sharutils pdftk elinks php5-cli tnef python-yaml diff --git a/config/purge-varnish-debian.ugly b/config/purge-varnish-debian.ugly index af32650a8..04458ea78 100644 --- a/config/purge-varnish-debian.ugly +++ b/config/purge-varnish-debian.ugly @@ -1,13 +1,13 @@ #!/bin/bash # ### BEGIN INIT INFO -# Provides: purge-varnish +# Provides: !!(*= $daemon_name *)!! # Required-Start: $local_fs $syslog # Required-Stop: $local_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: purge-varnish is a daemon purging the Alaveteli varnish cache -# Description: purge-varnish purge the Alaveteli varnish cache +# Short-Description: !!(*= $daemon_name *)!! is a daemon purging the Alaveteli varnish cache +# Description: !!(*= $daemon_name *)!! purges the Alaveteli varnish cache ### END INIT INFO # # !!(*= $daemon_name *)!! Start the Alaveteli email purge-varnish daemon diff --git a/config/routes.rb b/config/routes.rb index 10f6a3284..5af94768c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 # config/routes.rb: # Mapping URLs to controllers for FOIFA. # @@ -13,7 +14,6 @@ Alaveteli::Application.routes.draw do #### General contoller match '/' => 'general#frontpage', :as => :frontpage match '/blog' => 'general#blog', :as => :blog - match '/stylesheets/custom.css' => 'general#custom_css', :as => :custom_css match '/search' => 'general#search_redirect', :as => :search_redirect match '/search/all' => 'general#search_redirect', :as => :search_redirect # XXX combined is the search query, and then if sorted a "/newest" at the end. @@ -23,8 +23,7 @@ Alaveteli::Application.routes.draw do match '/search/*combined/all' => 'general#search', :as => :search_general, :view => 'all' match '/search(/*combined)' => 'general#search', :as => :search_general match '/advancedsearch' => 'general#search_redirect', :as => :advanced_search, :advanced => true - - match '/random' => 'general#random_request', :as => :random_request + match '/version.:format' => 'general#version', :as => :version ##### ##### Request controller @@ -51,22 +50,19 @@ Alaveteli::Application.routes.draw do match '/request/:url_title/describe/:described_state' => 'request#describe_state_message', :as => :describe_state_message match '/request/:id/response' => 'request#show_response', :as => :show_response_no_followup match '/request/:id/response/:incoming_message_id' => 'request#show_response', :as => :show_response - match '/request/:id/response/:incoming_message_id/attach/html/:part/*file_name' => 'request#get_attachment_as_html', :as => :get_attachment_as_html - match '/request/:id/response/:incoming_message_id/attach/:part(/*file_name)' => 'request#get_attachment', :as => :get_attachment + match '/request/:id/response/:incoming_message_id/attach/html/:part/*file_name' => 'request#get_attachment_as_html', :format => false, :as => :get_attachment_as_html + match '/request/:id/response/:incoming_message_id/attach/:part(/*file_name)' => 'request#get_attachment', :format => false, :as => :get_attachment match '/request_event/:info_request_event_id' => 'request#show_request_event', :as => :info_request_event match '/upload/request/:url_title' => 'request#upload_response', :as => :upload_response match '/request/:url_title/download' => 'request#download_entire_request', :as => :download_entire_request - - # It would be nice to add :conditions => { :method => :post } to this next one, - # because it ought not really to be available as a GET request since it changes - # the server state. Unfortunately this doesn’t play well with the PostRedirect - # mechanism, which assumes all post-login actions are available via GET, so we - # refrain. - match '/request/:url_title/report' => 'request#report_request', :as => :report #### + resources :request, :only => [] do + resource :report, :only => [:new, :create] + end + #### User controller # Use /profile for things to do with the currently signed in user. # Use /user/XXXX for things that anyone can see about that user. |