aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/application.rb30
-rw-r--r--config/deploy.rb3
-rw-r--r--config/environments/development.rb14
-rw-r--r--config/environments/production.rb17
-rw-r--r--config/environments/test.rb5
-rw-r--r--config/general.yml-example33
-rw-r--r--config/initializers/acts_as_xapian.rb25
-rw-r--r--config/initializers/alaveteli.rb3
-rw-r--r--config/initializers/has_tag_string.rb2
-rw-r--r--config/initializers/rails_security_patches.rb22
-rw-r--r--config/initializers/strip_attributes.rb2
-rw-r--r--config/initializers/theme_loader.rb4
-rw-r--r--config/test.yml2
13 files changed, 127 insertions, 35 deletions
diff --git a/config/application.rb b/config/application.rb
index c70a639e2..3c749a531 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -6,7 +6,7 @@ require File.dirname(__FILE__) + '/../lib/configuration'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
-Bundler.require(:default, Rails.env) if defined?(Bundler)
+Bundler.require(:default, :assets, Rails.env) if defined?(Bundler)
module Alaveteli
class Application < Rails::Application
@@ -33,7 +33,6 @@ module Alaveteli
# config.i18n.default_locale = :de
I18n.config.enforce_available_locales = false
-
# JavaScript files you want as :defaults (application.js is always included).
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
@@ -77,5 +76,32 @@ module Alaveteli
# Insert a bit of middleware code to prevent uneeded cookie setting.
require "#{Rails.root}/lib/whatdotheyknow/strip_empty_sessions"
config.middleware.insert_before ::ActionDispatch::Cookies, WhatDoTheyKnow::StripEmptySessions, :key => '_wdtk_cookie_session', :path => "/", :httponly => true
+
+ # Enable the asset pipeline
+ config.assets.enabled = true
+
+ # Version of your assets, change this if you want to expire all your assets
+ config.assets.version = '1.0'
+
+ # Change the path that assets are served from
+ # config.assets.prefix = "/assets"
+
+ # These additional precompiled Javascript files are actually
+ # manifests that require the real javascript files:
+ config.assets.precompile += ['admin.js',
+ 'profile-photos.js',
+ 'stats.js']
+ # ... while these are individual files that can't easily be
+ # grouped:
+ config.assets.precompile += ['jquery.fancybox-1.3.4.pack.js',
+ 'jquery.fancybox-1.3.4.css',
+ 'jquery.Jcrop.css',
+ 'excanvas.min.js',
+ 'fonts.css',
+ 'print.css',
+ 'admin.css',
+ 'ie6.css',
+ 'ie7.css']
+
end
end
diff --git a/config/deploy.rb b/config/deploy.rb
index 8ab67bc98..3a4f175b4 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -55,10 +55,9 @@ namespace :deploy do
"#{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",
- "#{release_path}/public/favicon.ico" => "#{shared_path}/favicon.ico",
"#{release_path}/files" => "#{shared_path}/files",
"#{release_path}/cache" => "#{shared_path}/cache",
- "#{release_path}/vendor/plugins/acts_as_xapian/xapiandbs" => "#{shared_path}/xapiandbs",
+ "#{release_path}/lib/acts_as_xapian/xapiandbs" => "#{shared_path}/xapiandbs",
}
# "ln -sf <a> <b>" creates a symbolic link but deletes <b> if it already exists
diff --git a/config/environments/development.rb b/config/environments/development.rb
index a912dd5de..dbf8d7b2a 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -32,4 +32,18 @@ Alaveteli::Application.configure do
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
+
+ # Do not compress assets
+ config.assets.compress = false
+
+ # Expands the lines which load the assets
+ config.assets.debug = true
+
+ # Raise exception on mass assignment protection for Active Record models
+ config.active_record.mass_assignment_sanitizer = :strict
+
+ # Log the query plan for queries taking more than this (works
+ # with SQLite, MySQL, and PostgreSQL)
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
+
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 0c1929366..a3e3cebd2 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -31,4 +31,21 @@ Alaveteli::Application.configure do
if AlaveteliConfiguration::force_ssl
config.middleware.insert_before ActionDispatch::Cookies, ::Rack::SSL
end
+
+ # Compress JavaScripts and CSS
+ config.assets.compress = true
+
+ # Choose the compressors to use
+ # config.assets.js_compressor = :uglifier
+ # config.assets.css_compressor = :yui
+
+ # Don't fallback to assets pipeline if a precompiled asset is missed
+ config.assets.compile = false
+
+ # Generate digests for assets URLs.
+ config.assets.digest = true
+
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
+ # config.assets.precompile += %w( search.js )
+
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index df39e8873..97c2d4f7c 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -24,4 +24,9 @@ Alaveteli::Application.configure do
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
+ if !AlaveteliConfiguration.exception_notifications_from.blank? && !AlaveteliConfiguration.exception_notifications_to.blank?
+ middleware.use ExceptionNotifier,
+ :sender_address => AlaveteliConfiguration::exception_notifications_from,
+ :exception_recipients => AlaveteliConfiguration::exception_notifications_to
+ end
end
diff --git a/config/general.yml-example b/config/general.yml-example
index b8c805533..bd835494b 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -172,11 +172,6 @@ VARNISH_HOST: localhost
# Adding a value here will enable Google Analytics on all non-admin pages for non-admin users.
GA_CODE: ''
-# We need to add the WDTK survey variables here, or else the deployment
-# system will cry.
-SURVEY_SECRET: ''
-SURVEY_URL: ''
-
# If you want to override *all* the public body request emails with your own
# email so that request emails that would normally go to the public body
# go to you, then uncomment below and fill in your email.
@@ -219,3 +214,31 @@ USE_MAILCATCHER_IN_DEVELOPMENT: true
# only have an effect in environments where
# config.action_controller.perform_caching is set to true
CACHE_FRAGMENTS: true
+
+# In some deployments of Alaveteli you may wish to install each newly
+# deployed version alongside the previous ones, in which case certain
+# files and resources should be shared between these installations:
+# for example, the 'files' directory, the 'cache' directory and the
+# generated graphs such as 'public/foi-live-creation.png'. If you're
+# installing Alaveteli in such a setup then set SHARED_FILES_PATH to
+# the directory you're keeping these files under. Otherwise, leave it
+# blank.
+SHARED_FILES_PATH: ''
+
+# If you have SHARED_FILES_PATH set, then these options list the files
+# and directories that are shared; i.e. those that the deploy scripts
+# should create symlinks to from the repository.
+SHARED_FILES:
+ - config/database.yml
+ - config/general.yml
+ - config/rails_env.rb
+ - config/newrelic.yml
+ - config/httpd.conf
+ - public/foi-live-creation.png
+ - public/foi-user-use.png
+ - config/aliases
+SHARED_DIRECTORIES:
+ - files/
+ - cache/
+ - lib/acts_as_xapian/xapiandbs/
+ - vendor/bundle
diff --git a/config/initializers/acts_as_xapian.rb b/config/initializers/acts_as_xapian.rb
new file mode 100644
index 000000000..f82193c85
--- /dev/null
+++ b/config/initializers/acts_as_xapian.rb
@@ -0,0 +1,25 @@
+# acts_as_xapian/init.rb:
+#
+# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
+
+# We're moving plugins out of vendor/plugins, since keeping them there
+# is deprecated as of Rails 3.2, and the xapiandbs directory should be
+# moved out of there along with the plugin itself.
+
+old_xapiandbs_path = Rails.root.join('vendor',
+ 'plugins',
+ 'acts_as_xapian',
+ 'xapiandbs')
+
+current_xapiandbs_path = Rails.root.join('lib',
+ 'acts_as_xapian',
+ 'xapiandbs')
+
+if File.exists? old_xapiandbs_path
+ unless File.exists? current_xapiandbs_path
+ File.rename old_xapiandbs_path, current_xapiandbs_path
+ end
+end
+
+require 'acts_as_xapian/acts_as_xapian'
diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb
index 631251b87..cabe96efa 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.15'
+ALAVETELI_VERSION = '0.16'
# Add new inflection rules using the following format
# (all these examples are active by default):
@@ -50,7 +50,6 @@ require 'normalize_string'
require 'alaveteli_file_types'
require 'alaveteli_localization'
require 'message_prominence'
-require 'actionmailer_patches'
require 'theme'
AlaveteliLocalization.set_locales(AlaveteliConfiguration::available_locales,
diff --git a/config/initializers/has_tag_string.rb b/config/initializers/has_tag_string.rb
new file mode 100644
index 000000000..5fa33cc70
--- /dev/null
+++ b/config/initializers/has_tag_string.rb
@@ -0,0 +1,2 @@
+require 'has_tag_string/has_tag_string'
+
diff --git a/config/initializers/rails_security_patches.rb b/config/initializers/rails_security_patches.rb
deleted file mode 100644
index b7f013d04..000000000
--- a/config/initializers/rails_security_patches.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# Temporary patches for Rails security alert made on 03/12/2013
-
-# CVE-2013-6414 https://groups.google.com/forum/#!topic/rubyonrails-security/A-ebV4WxzKg
-
-ActiveSupport.on_load(:action_view) do
- ActionView::LookupContext::DetailsKey.class_eval do
- class << self
- alias :old_get :get
-
- def get(details)
- if details[:formats]
- details = details.dup
- syms = Set.new Mime::SET.symbols
- details[:formats] = details[:formats].select { |v|
- syms.include? v
- }
- end
- old_get details
- end
- end
- end
-end
diff --git a/config/initializers/strip_attributes.rb b/config/initializers/strip_attributes.rb
new file mode 100644
index 000000000..25f70b2f3
--- /dev/null
+++ b/config/initializers/strip_attributes.rb
@@ -0,0 +1,2 @@
+require 'strip_attributes/strip_attributes'
+ActiveRecord::Base.extend(StripAttributes)
diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb
index b3ae11e1e..9c79e513c 100644
--- a/config/initializers/theme_loader.rb
+++ b/config/initializers/theme_loader.rb
@@ -3,7 +3,9 @@
$alaveteli_route_extensions = []
def require_theme(theme_name)
- theme_main_include = File.expand_path "../../../vendor/plugins/#{theme_name}/lib/alavetelitheme.rb", __FILE__
+ theme_lib = Rails.root.join 'lib', 'themes', theme_name, 'lib'
+ $LOAD_PATH.unshift theme_lib.to_s
+ theme_main_include = Rails.root.join theme_lib, "alavetelitheme.rb"
if File.exists? theme_main_include
require theme_main_include
end
diff --git a/config/test.yml b/config/test.yml
index b26ca99d4..599e1e81a 100644
--- a/config/test.yml
+++ b/config/test.yml
@@ -116,7 +116,7 @@ HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64
# Exception notifications
EXCEPTION_NOTIFICATIONS_FROM: do-not-reply-to-this-address@example.com
-EXCEPTION_NOTIFICATIONS_TO:
+EXCEPTION_NOTIFICATIONS_TO: exception-recipient@example.com
MAX_REQUESTS_PER_USER_PER_DAY: 2