aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/application.rb29
-rw-r--r--config/deploy.rb2
-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/initializers/acts_as_xapian.rb25
-rw-r--r--config/initializers/has_tag_string.rb2
-rw-r--r--config/initializers/strip_attributes.rb2
-rw-r--r--config/initializers/theme_loader.rb4
-rw-r--r--config/test.yml2
10 files changed, 98 insertions, 4 deletions
diff --git a/config/application.rb b/config/application.rb
index 245a60782..dba3a0c57 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
@@ -31,6 +31,7 @@ module Alaveteli
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# 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)
@@ -75,5 +76,31 @@ 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.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..a0189c855 100644
--- a/config/deploy.rb
+++ b/config/deploy.rb
@@ -58,7 +58,7 @@ namespace :deploy do
"#{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/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/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/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