summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/application.rb60
-rw-r--r--config/boot.rb5
-rw-r--r--config/defaults.yml1
-rw-r--r--config/environment.rb6
-rw-r--r--config/environments/development.rb48
-rw-r--r--config/environments/production.rb70
-rw-r--r--config/environments/test.rb33
-rw-r--r--config/initializers/client_side_validations.rb12
-rw-r--r--config/initializers/customization.rb2
-rw-r--r--config/initializers/error_constants.rb5
-rw-r--r--config/initializers/simple_form_bootstrap.rb12
-rw-r--r--config/initializers/validations.rb4
-rw-r--r--config/locales/en/generic.en.yml2
-rw-r--r--config/routes.rb16
14 files changed, 141 insertions, 135 deletions
diff --git a/config/application.rb b/config/application.rb
index b13c7d9..0e00356 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -4,20 +4,16 @@ require File.expand_path('../boot', __FILE__)
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
-require "active_resource/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"
-if defined?(Bundler)
- # If you precompile assets before deploying to production, use this line
- Bundler.require(*Rails.groups(:assets => %w(development test)))
- # If you want your assets lazily compiled in production, use this line
- # Bundler.require(:default, :assets, Rails.env)
-end
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
APP_CONFIG = ["defaults.yml", "config.yml"].inject({}) {|config, file|
filepath = File.expand_path(file, File.dirname(__FILE__))
- if File.exists?(filepath) && settings = YAML.load_file(filepath)[Rails.env]
+ if File.exist?(filepath) && settings = YAML.load_file(filepath)[Rails.env]
config.merge(settings)
else
config
@@ -30,16 +26,6 @@ module LeapWeb
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
- # Custom directories with classes and modules you want to be autoloadable.
- # config.autoload_paths += %W(#{config.root}/extras)
-
- # Only load the plugins named here, in the order given (default is alphabetical).
- # :all can be used as a placeholder for all plugins not explicitly named.
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
- # Activate observers that should always be running.
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
@@ -48,48 +34,18 @@ module LeapWeb
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
- # Configure the default encoding used in templates for Ruby 1.9.
- config.encoding = "utf-8"
-
- # Configure sensitive parameters which will be filtered from the log file.
- config.filter_parameters += [:password]
-
if APP_CONFIG[:logfile].present?
config.logger = Logger.new(APP_CONFIG[:logfile])
end
- # Enable escaping HTML in JSON.
- config.active_support.escape_html_entities_in_json = true
-
- # Use SQL instead of Active Record's schema dumper when creating the database.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
-
- # Enforce whitelist mode for mass assignment.
- # This will create an empty whitelist of attributes available for mass-assignment for all models
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
- # parameters by using an attr_accessible or attr_protected declaration.
- # config.active_record.whitelist_attributes = true
-
- ##
- ## ASSETS
- ##
-
- # Enable the asset pipeline
- config.assets.enabled = true
- config.assets.initialize_on_precompile = true # don't change this (see customization.rb)
-
- # Version of your assets, change this if you want to expire all your assets
- config.assets.version = '1.0'
-
- # Set to false in order to see asset requests in the log
- config.quiet_assets = true
-
##
## CUSTOMIZATION
## see initializers/customization.rb
##
+
+ # don't change this (see customization.rb)
+ config.assets.initialize_on_precompile = true
+
if APP_CONFIG["customization_directory"]
custom_view_path = (Pathname.new(APP_CONFIG["customization_directory"]).relative_path_from(Rails.root) + 'views').to_s
else
diff --git a/config/boot.rb b/config/boot.rb
index 4489e58..6b750f0 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,6 +1,3 @@
-require 'rubygems'
-
-# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
+require 'bundler/setup' # Set up gems listed in the Gemfile.
diff --git a/config/defaults.yml b/config/defaults.yml
index 844adaa..7e2ea58 100644
--- a/config/defaults.yml
+++ b/config/defaults.yml
@@ -87,6 +87,7 @@ common: &common
soledad-service: 'public/1/config/soledad-service.json'
eip-service: 'public/1/config/eip-service.json'
smtp-service: 'public/1/config/smtp-service.json'
+ provider: 'config/provider/provider.json'
mailer:
from_address: 'noreply'
diff --git a/config/environment.rb b/config/environment.rb
index fe16a54..00a613f 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,5 +1,5 @@
-# Load the rails application
+# Load the rails application.
require File.expand_path('../application', __FILE__)
-# Initialize the rails application
-LeapWeb::Application.initialize!
+# Initialize the rails application.
+Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 3c0ff0f..4112c6d 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,38 +1,58 @@
-LeapWeb::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ ##
+ # DEFAULT:
+ #
+ # rails default settings in their natural order
+ ##
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
- # Log error messages when you accidentally call methods on nil.
- config.whiny_nils = true
+ # Do not eager load code on boot.
+ config.eager_load = false
- # Show full error reports and disable caching
+ # Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
- # Don't care if the mailer can't send
+ # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
- # Print deprecation notices to the Rails logger
+ # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
- # Only use best-standards-support built into browsers
- config.action_dispatch.best_standards_support = :builtin
+ # Debug mode disables concatenation and preprocessing of assets.
+ # This option may cause significant delays in view rendering with a large
+ # number of complex assets.
+ config.assets.debug = true
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found)
- config.i18n.fallbacks = true
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
+ config.assets.digest = true
- # Do not compress assets
- config.assets.compress = false
+ # Adds additional error checking when serving assets at runtime.
+ # Checks for improperly declared sprockets dependencies.
+ # Raises helpful error messages.
+ config.assets.raise_runtime_errors = true
# If set to true, each asset file is loaded separately. If you are not
# debugging js or css, it is much faster to set this to false.
config.assets.debug = false
+ ##
+ # CUSTOM:
+ #
+ # our own settings
+ ##
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
# super hacky, but otherwise getting certificate error, and doesn't seem dangerous in development mode:
OpenSSL::SSL.send(:remove_const, "VERIFY_PEER")
OpenSSL::SSL.const_set("VERIFY_PEER", OpenSSL::SSL::VERIFY_NONE)
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 7acca75..acdfc1d 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,37 +1,56 @@
-LeapWeb::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
- # Code is not reloaded between requests
+ # Code is not reloaded between requests.
config.cache_classes = true
- # Full error reports are disabled and caching is turned on
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- # Disable Rails's static asset server (Apache or nginx will already do this)
- config.serve_static_assets = false
- # Compress JavaScripts and CSS
- config.assets.compress = true
+ # Dble Rack::Cache to put a simple HTTP cache in front of your application
+ # Add `rack-cache` to your Gemfile before enabling this.
+ # For large-scale production use, consider using a caching reverse proxy like
+ # NGINX, varnish or squid.
+ # config.action_dispatch.rack_cache = true
+
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
+
+ # Compress JavaScripts and CSS.
+ config.assets.js_compressor = :uglifier
+ # config.assets.css_compressor = :sass
- # Don't fallback to assets pipeline if a precompiled asset is missed
+ #Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # Generate digests for assets URLs
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
+ # yet still be able to expire them through the digest params.
config.assets.digest = true
- # Defaults to nil and saved in location specified by config.assets.prefix
- # config.assets.manifest = YOUR_PATH
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
- # Specifies the header that your server uses for sending files
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = APP_CONFIG[:force_ssl]
- # See everything in the log (default is :info)
- # config.log_level = :debug
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
+
+ # Prepend all log lines with the following tags.
+ # config.log_tags = [ :subdomain, :uuid ]
# Use syslog if no file has been specified
if APP_CONFIG[:logfile].blank?
@@ -39,26 +58,23 @@ LeapWeb::Application.configure do
config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new('webapp'))
end
- # Use a different cache store in production
+ # Use a different cache store in production.
# config.cache_store = :mem_cache_store
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com"
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
- # config.assets.precompile += %w( search.js )
-
- # Disable delivery errors, bad email addresses will be ignored
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
- # Enable threaded mode
- # config.threadsafe!
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation can not be found)
+ # the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
+ # Use default logging formatter so that PID and timestamp are not suppressed.
+ config.log_formatter = ::Logger::Formatter.new
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 1a38df7..0ba4fbd 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,5 +1,7 @@
-LeapWeb::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ config.assets.debug = true
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
@@ -7,29 +9,36 @@ LeapWeb::Application.configure do
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
- # Configure static asset server for tests with Cache-Control for performance
- config.serve_static_assets = true
- config.static_cache_control = "public, max-age=3600"
+ # Do not eager load code on boot. This avoids loading your whole application
+ # just for the purpose of running a single test. If you are using a tool that
+ # preloads Rails for running tests, you may have to set it to true.
+ config.eager_load = false
- # Log error messages when you accidentally call methods on nil
- config.whiny_nils = true
+ # Configure static asset server for tests with Cache-Control for performance
+ config.serve_static_files = true
+ config.static_cache_control = 'public, max-age=3600'
- # Show full error reports and disable caching
+ # Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
- # Raise exceptions instead of rendering exception templates
+ # Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
- # Disable request forgery protection in test environment
- config.action_controller.allow_forgery_protection = false
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
+ # Randomize the order test cases are executed.
+ config.active_support.test_order = :random
- # Print deprecation notices to the stderr
+ # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
end
diff --git a/config/initializers/client_side_validations.rb b/config/initializers/client_side_validations.rb
index 252aded..f7a658a 100644
--- a/config/initializers/client_side_validations.rb
+++ b/config/initializers/client_side_validations.rb
@@ -1,9 +1,16 @@
# ClientSideValidations Initializer
-# Uncomment to disable uniqueness validator, possible security issue
-ClientSideValidations::Config.disabled_validators = [:uniqueness]
+# Disabled validators. The uniqueness validator is disabled by default for security issues. Enable it on your own responsibility!
+# ClientSideValidations::Config.disabled_validators = [:uniqueness]
+
+# Uncomment to validate number format with current I18n locale
+# ClientSideValidations::Config.number_format_with_locale = true
# Uncomment the following block if you want each input field to have the validation messages attached.
+#
+# Note: client_side_validation requires the error to be encapsulated within
+# <label for="#{instance.send(:tag_id)}" class="message"></label>
+
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
unless html_tag =~ /^<label/
%{<div class="field_with_errors">#{html_tag}<label for="#{instance.send(:tag_id)}" class="message">#{instance.error_message.first}</label></div>}.html_safe
@@ -11,4 +18,3 @@ ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
%{<div class="field_with_errors">#{html_tag}</div>}.html_safe
end
end
-
diff --git a/config/initializers/customization.rb b/config/initializers/customization.rb
index aaa2939..9f537e9 100644
--- a/config/initializers/customization.rb
+++ b/config/initializers/customization.rb
@@ -26,7 +26,7 @@ Rails.application.config.assets.paths.unshift "#{customization_directory}/styles
#
# Copy files to public
#
-if !defined?(RAKE) && Dir.exists?("#{customization_directory}/public")
+if !defined?(RAKE) && Dir.exist?("#{customization_directory}/public")
require 'fileutils'
FileUtils.cp_r("#{customization_directory}/public/.", "#{Rails.root}/public", :preserve => true)
end
diff --git a/config/initializers/error_constants.rb b/config/initializers/error_constants.rb
index fdd3624..bf2dad4 100644
--- a/config/initializers/error_constants.rb
+++ b/config/initializers/error_constants.rb
@@ -1,3 +1,8 @@
require 'ruby-srp'
WRONG_PASSWORD = SRP::WrongPassword
+
+# In case we use a different ORM at some point
+VALIDATION_FAILED = CouchRest::Model::Errors::Validations
+RECORD_NOT_FOUND = CouchRest::Model::DocumentNotFound
+RESOURCE_NOT_FOUDN = CouchRest::NotFound
diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb
index c949f5e..720174f 100644
--- a/config/initializers/simple_form_bootstrap.rb
+++ b/config/initializers/simple_form_bootstrap.rb
@@ -1,17 +1,17 @@
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
- config.wrappers :bootstrap, :tag => 'div', :class => 'control-group', :error_class => 'error' do |b|
+ config.wrappers :bootstrap, :tag => 'div', :class => 'form-group', :error_class => 'error' do |b|
b.use :html5
b.use :placeholder
- b.use :label
- b.wrapper :tag => 'div', :class => 'controls' do |ba|
+ b.use :label, :class => 'col-sm-2'
+ b.wrapper :tag => 'div', :class => 'col-sm-10' do |ba|
ba.use :input
ba.use :error, :wrap_with => { :tag => 'span', :class => 'help-inline' }
ba.use :hint, :wrap_with => { :tag => 'p', :class => 'help-block' }
end
end
- config.wrappers :prepend, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
+ config.wrappers :prepend, :tag => 'div', :class => "form-group", :error_class => 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
@@ -24,7 +24,7 @@ SimpleForm.setup do |config|
end
end
- config.wrappers :append, :tag => 'div', :class => "control-group", :error_class => 'error' do |b|
+ config.wrappers :append, :tag => 'div', :class => "form-group", :error_class => 'error' do |b|
b.use :html5
b.use :placeholder
b.use :label
@@ -38,7 +38,7 @@ SimpleForm.setup do |config|
end
#
- # when you don't want any bootstrap "control-group" or "controls" wrappers.
+ # when you don't want any bootstrap "form-group" or "controls" wrappers.
#
config.wrappers :none, :tag => 'div', :error_class => 'error' do |b|
b.use :html5
diff --git a/config/initializers/validations.rb b/config/initializers/validations.rb
deleted file mode 100644
index e8acfbe..0000000
--- a/config/initializers/validations.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# In case we use a different ORM at some point
-VALIDATION_FAILED = CouchRest::Model::Errors::Validations
-RECORD_NOT_FOUND = CouchRest::Model::DocumentNotFound
-RESOURCE_NOT_FOUND = RestClient::ResourceNotFound
diff --git a/config/locales/en/generic.en.yml b/config/locales/en/generic.en.yml
index be62a40..617116f 100644
--- a/config/locales/en/generic.en.yml
+++ b/config/locales/en/generic.en.yml
@@ -21,7 +21,7 @@ en:
example_email: 'user@domain.org'
- no_such_thing: "No such %{thing}."
+ no_such_user: "No such user."
create_thing: "Create %{thing}"
overview: "Overview"
diff --git a/config/routes.rb b/config/routes.rb
index e370aa4..b152c9c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -10,8 +10,8 @@ LeapWeb::Application.routes.draw do
# HTTP Error Handling
# instead of the default error pages use the errors controller and views
#
- match '/404' => 'errors#not_found'
- match '/500' => 'errors#server_error'
+ match '/404' => 'errors#not_found', via: [:get, :post]
+ match '/500' => 'errors#server_error', via: [:get, :post]
scope "(:locale)", :locale => CommonLanguages.match_available, :controller => 'pages', :action => 'show' do
get 'privacy-policy', :as => 'privacy_policy'
@@ -24,10 +24,10 @@ LeapWeb::Application.routes.draw do
get '/provider.json' => 'static_config#provider'
- namespace "api", { module: "v1",
- path: "/1/",
- defaults: {format: 'json'},
- :constraints => { :id => /[^\/]+(?=\.json\z)|[^\/]+/ }
+ namespace "api", { module: "api",
+ path: "/:version/",
+ defaults: {version: '2', format: 'json'},
+ :constraints => { :id => /[^\/]+(?=\.json\z)|[^\/]+/, :version => /[12]/ }
} do
resources :sessions, :only => [:new, :create, :update]
delete "logout" => "sessions#destroy", :as => "logout"
@@ -44,8 +44,8 @@ LeapWeb::Application.routes.draw do
get "login" => "sessions#new", :as => "login"
delete "logout" => "sessions#destroy", :as => "logout"
- get "signup" => "users#new", :as => "signup"
- resources :users, :except => [:create, :update] do
+ get "signup" => "account#new", :as => "signup"
+ resources :users, :except => [:new, :create, :update] do
# resource :email_settings, :only => [:edit, :update]
# resources :email_aliases, :only => [:destroy], :id => /.*/
post 'deactivate', on: :member