aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/environments/profiling.rb6
-rw-r--r--config/general.cs.yml145
-rw-r--r--config/initializers/rails2314_ruby193_monkey_patches.rb1
-rw-r--r--config/initializers/utf8_monkey_patches.rb90
-rw-r--r--spec/models/user_spec.rb9
5 files changed, 242 insertions, 9 deletions
diff --git a/config/environments/profiling.rb b/config/environments/profiling.rb
new file mode 100644
index 000000000..99064a1e2
--- /dev/null
+++ b/config/environments/profiling.rb
@@ -0,0 +1,6 @@
+config.cache_classes = true
+config.action_controller.consider_all_requests_local = false
+config.action_controller.perform_caching = true
+config.action_view.cache_template_loading = true
+
+config.log_level = :debug \ No newline at end of file
diff --git a/config/general.cs.yml b/config/general.cs.yml
new file mode 100644
index 000000000..50f48a92f
--- /dev/null
+++ b/config/general.cs.yml
@@ -0,0 +1,145 @@
+# general.yml-example:
+# Example values for the "general" config file.
+#
+# Configuration parameters, in YAML syntax.
+#
+# Copy this file to one called "general.yml" in the same directory. Or
+# have multiple config files and use a symlink to change between them.
+
+# Site name appears in various places throughout the site
+SITE_NAME: 'Informace pro vsechny'
+
+# Domain used in URLs generated by scripts (e.g. for going in some emails)
+DOMAIN: 'informaceprovsechny.cz'
+
+# ISO country code of country currrently deployed in
+# (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
+ISO_COUNTRY_CODE: CZ
+
+# These feeds are displayed accordingly on the Alaveteli "blog" page:
+BLOG_FEED: 'http://www.mysociety.org/category/projects/whatdotheyknow/feed/'
+TWITTER_USERNAME: 'Infoprovsechny'
+
+# Locales we wish to support in this app, space-delimited
+AVAILABLE_LOCALES: 'cs'
+DEFAULT_LOCALE: 'cs'
+USE_DEFAULT_BROWSER_LANGUAGE: true
+
+# How many days should have passed before an answer to a request is officially late?
+REPLY_LATE_AFTER_DAYS: 15
+REPLY_VERY_LATE_AFTER_DAYS: 40
+# We give some types of authority like schools a bit longer than everyone else
+SPECIAL_REPLY_VERY_LATE_AFTER_DAYS: 60
+
+# example public bodies for the home page, semicolon delimited - short_names
+FRONTPAGE_PUBLICBODY_EXAMPLES: 'mzv'
+
+# URL of theme to install (when running rails-post-deploy script)
+THEME_URLS:
+ - 'git://github.com/mysociety/adminbootstraptheme.git'
+ - 'git://github.com/pepe/ipvtheme.git'
+
+# Whether a user needs to sign in to start the New Request process
+FORCE_REGISTRATION_ON_NEW_REQUEST: true
+
+
+## Incoming email
+# Your email domain, e.g. 'foifa.com'
+INCOMING_EMAIL_DOMAIN: 'informaceprovsechny.cz'
+
+# An optional prefix to help you distinguish FOI requests, e.g. 'foi+'
+INCOMING_EMAIL_PREFIX: 'foi+'
+
+# used for hash in request email address
+INCOMING_EMAIL_SECRET: 'xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx'
+
+# used as envelope from at the incoming email domain for cases where we don't care about failure
+BLACKHOLE_PREFIX: 'do-not-reply-to-this-address'
+
+## Administration
+
+# Leave these two blank to skip admin authorisation
+ADMIN_USERNAME: 'admin'
+ADMIN_PASSWORD: 'info12345'
+
+# Email "from" details
+CONTACT_EMAIL: 'postmaster@informaceprovsechny.cz'
+CONTACT_NAME: 'Informace pro vsechny'
+
+# Email "from" details for track messages
+TRACK_SENDER_EMAIL: 'postmaster@informaceprovsechny.cz'
+TRACK_SENDER_NAME: 'Informace pro vsechny'
+
+# Where the raw incoming email data gets stored; make sure you back
+# this up!
+RAW_EMAILS_LOCATION: 'files/raw_emails'
+
+# The base URL for admin pages.
+# If not specified, it will default to the path to the admin controller,
+# which is usually what you want. It is useful in situations where admin
+# requests are proxied via a secure server, for example.
+ADMIN_BASE_URL: ''
+
+# Where /stylesheets sits under for admin pages. See asset_host in
+# config/environment.rb. Can be full domain or relative path (not an
+# absolute path beginning with /). Again, unlikely to want to change
+# this.
+ADMIN_PUBLIC_URL: ''
+
+# Secret key for signing cookie_store sessions
+COOKIE_STORE_SESSION_SECRET: 'your secret key here, make it long and random'
+
+# If present, puts the site in read only mode, and uses the text as reason
+# (whole paragraph). Please use a read-only database user as well, as it only
+# checks in a few obvious places.
+READ_ONLY: ''
+
+# Doesn't do anything right now.
+STAGING_SITE: 0
+
+# Recaptcha, for detecting humans. Get keys here: http://recaptcha.net/whyrecaptcha.html
+RECAPTCHA_PUBLIC_KEY: '6LdTk9MSAAAAADw9fxyh_cJeqe951ebaV0sWTbR4'
+RECAPTCHA_PRIVATE_KEY: '6LdTk9MSAAAAABR6Kq2dXJD3OChk8R69_QMnbiQa'
+
+# Number of days after which to send a 'new response reminder'
+NEW_RESPONSE_REMINDER_AFTER_DAYS: [3, 10, 24]
+
+# For debugging memory problems. If true, the app logs
+# the memory use increase of the Ruby process due to the
+# request (Linux only). Since Ruby never returns memory to the OS, if the
+# existing process previously served a larger request, this won't
+# show any consumption for the later request.
+DEBUG_RECORD_MEMORY: false
+
+# Currently we default to using pdftk to compress PDFs. You can
+# optionally try Ghostscript, which should do a better job of
+# compression. Some versions of pdftk are buggy with respect to
+# compression, in which case Alaveteli doesn't recompress the PDFs at
+# all and logs a warning message "Unable to compress PDF"; which would
+# be another reason to try this setting.
+USE_GHOSTSCRIPT_COMPRESSION: true
+
+# mySociety's gazeteer service. Shouldn't change.
+GAZE_URL: http://gaze.mysociety.org
+
+# The email address to which non-bounce responses should be forwarded
+FORWARD_NONBOUNCE_RESPONSES_TO: user-support@localhost
+
+# Path to a program that converts a page at a URL to HTML. It should
+# take two arguments: the URL, and a path to an output file. A static
+# binary of wkhtmltopdf is recommended:
+# http://code.google.com/p/wkhtmltopdf/downloads/list
+# If the command is not present, a text-only version will be rendered
+# instead.
+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:
+ - robin@example.org
+ - seb@example.org
+
+# This rate limiting can be turned off per-user via the admin interface
+MAX_REQUESTS_PER_USER_PER_DAY: 6
+
+VARNISH_HOST:
diff --git a/config/initializers/rails2314_ruby193_monkey_patches.rb b/config/initializers/rails2314_ruby193_monkey_patches.rb
new file mode 100644
index 000000000..8bc433b13
--- /dev/null
+++ b/config/initializers/rails2314_ruby193_monkey_patches.rb
@@ -0,0 +1 @@
+# # -*- encoding : utf-8 -*- # # This little guy is needed unless you want to define a helper for every single one of your controllers # MissingSourceFile::REGEXPS << [/^cannot load such file -- (.+)$/i, 1] # # # TZInfo needs to be patched. In particular, you'll need to re-implement the datetime_new! method: # require 'tzinfo' # # module TZInfo # # # Methods to support different versions of Ruby. # module RubyCoreSupport #:nodoc: # # Ruby 1.8.6 introduced new! and deprecated new0. # # Ruby 1.9.0 removed new0. # # Ruby trunk revision 31668 removed the new! method. # # Still support new0 for better performance on older versions of Ruby (new0 indicates # # that the rational has already been reduced to its lowest terms). # # Fallback to jd with conversion from ajd if new! and new0 are unavailable. # if DateTime.respond_to? :new! # def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) # DateTime.new!(ajd, of, sg) # end # elsif DateTime.respond_to? :new0 # def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) # DateTime.new0(ajd, of, sg) # end # else # HALF_DAYS_IN_DAY = rational_new!(1, 2) # # def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) # # Convert from an Astronomical Julian Day number to a civil Julian Day number. # jd = ajd + of + HALF_DAYS_IN_DAY # # # Ruby trunk revision 31862 changed the behaviour of DateTime.jd so that it will no # # longer accept a fractional civil Julian Day number if further arguments are specified. # # Calculate the hours, minutes and seconds to pass to jd. # # jd_i = jd.to_i # jd_i -= 1 if jd < 0 # hours = (jd - jd_i) * 24 # hours_i = hours.to_i # minutes = (hours - hours_i) * 60 # minutes_i = minutes.to_i # seconds = (minutes - minutes_i) * 60 # # DateTime.jd(jd_i, hours_i, minutes_i, seconds, of, sg) # end # end # end # end # # # Finally, we have this innocuous looking patch. Without it, queries like this: current_account.tickets.recent.count # # would instantiate AR objects all (!!) tickets in the account, not merely return a count of the recent ones. # # See https://rails.lighthouseapp.com/projects/8994/tickets/5410-multiple-database-queries-when-chaining-named-scopes-with-rails-238-and-ruby-192 # # (The patch in that lighthouse bug was not, in fact, merged in). # module ActiveRecord # module Associations # class AssociationProxy # def respond_to_missing?(meth, incl_priv) # false # end # end # end # end \ No newline at end of file
diff --git a/config/initializers/utf8_monkey_patches.rb b/config/initializers/utf8_monkey_patches.rb
new file mode 100644
index 000000000..2cead82ef
--- /dev/null
+++ b/config/initializers/utf8_monkey_patches.rb
@@ -0,0 +1,90 @@
+# if RUBY_VERSION.to_f >= 1.9
+# # -*- encoding : utf-8 -*-
+# # Make sure the logger supports encodings properly.
+# module ActiveSupport
+# class BufferedLogger
+# def add(severity, message = nil, progname = nil, &block)
+# return if @level > severity
+# message = (message || (block && block.call) || progname).to_s
+#
+# # If a newline is necessary then create a new message ending with a newline.
+# # Ensures that the original message is not mutated.
+# message = "#{message}\n" unless message[-1] == ?\n
+# buffer << message.force_encoding(Encoding.default_external)
+# auto_flush
+# message
+# end
+# end
+# end
+#
+# # This makes it so all parameters get converted to UTF-8 before they hit your app. If someone sends invalid UTF-8 to your server, raise an exception.
+# # At UserVoice, we rescue this exception and show a custom error page.
+# class ActionController::InvalidByteSequenceErrorFromParams < Encoding::InvalidByteSequenceError; end
+# class ActionController::Base
+#
+# def force_utf8_params
+# traverse = lambda do |object, block|
+# if object.kind_of?(Hash)
+# object.each_value { |o| traverse.call(o, block) }
+# elsif object.kind_of?(Array)
+# object.each { |o| traverse.call(o, block) }
+# else
+# block.call(object)
+# end
+# object
+# end
+# force_encoding = lambda do |o|
+# if o.respond_to?(:force_encoding)
+# o.force_encoding(Encoding::UTF_8)
+# raise ActionController::InvalidByteSequenceErrorFromParams unless o.valid_encoding?
+# end
+# if o.respond_to?(:original_filename)
+# o.original_filename.force_encoding(Encoding::UTF_8)
+# raise ActionController::InvalidByteSequenceErrorFromParams unless o.original_filename.valid_encoding?
+# end
+# end
+# traverse.call(params, force_encoding)
+# path_str = request.path.to_s
+# if path_str.respond_to?(:force_encoding)
+# path_str.force_encoding(Encoding::UTF_8)
+# raise ActionController::InvalidByteSequenceErrorFromParams unless path_str.valid_encoding?
+# end
+# end
+# before_filter :force_utf8_params
+# end
+#
+#
+# # Serialized columns in AR don't support UTF-8 well, so set the encoding on those as well.
+# class ActiveRecord::Base
+# def unserialize_attribute_with_utf8(attr_name)
+# traverse = lambda do |object, block|
+# if object.kind_of?(Hash)
+# object.each_value { |o| traverse.call(o, block) }
+# elsif object.kind_of?(Array)
+# object.each { |o| traverse.call(o, block) }
+# else
+# block.call(object)
+# end
+# object
+# end
+# force_encoding = lambda do |o|
+# o.force_encoding(Encoding::UTF_8) if o.respond_to?(:force_encoding)
+# end
+# value = unserialize_attribute_without_utf8(attr_name)
+# traverse.call(value, force_encoding)
+# end
+# alias_method_chain :unserialize_attribute, :utf8
+# end
+#
+# # Make sure the flash sets the encoding to UTF-8 as well.
+# module ActionController
+# module Flash
+# class FlashHash
+# def [](k)
+# v = super
+# v.is_a?(String) ? v.force_encoding("UTF-8") : v
+# end
+# end
+# end
+# end
+# end \ No newline at end of file
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 779b74d0c..e31c3f1b5 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -302,12 +302,3 @@ describe User, "when emails have bounced" do
user.email_bounce_message.should == "The reason we think the email bounced (e.g. a bounce message)"
end
end
-
-describe User, 'when asked if the user has exceeded their request limit' do
-
- it 'should return false if there is no max requests value set in the site configuration' do
- user = User.new
- lambda{ user.exceeded_limit? }.should_not raise_error
- end
-
-end