config 0.0.1 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +6 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +23 -0
- data/Appraisals +15 -0
- data/CHANGELOG.md +25 -0
- data/Gemfile +6 -0
- data/LICENSE.md +27 -0
- data/README.md +315 -0
- data/Rakefile +42 -0
- data/config.gemspec +46 -0
- data/gemfiles/rails_3.gemfile +7 -0
- data/gemfiles/rails_4.1.gemfile +7 -0
- data/gemfiles/rails_4.2.gemfile +7 -0
- data/gemfiles/rails_4.gemfile +7 -0
- data/lib/config.rb +64 -0
- data/lib/config/engine.rb +5 -0
- data/lib/config/integration/rails.rb +36 -0
- data/lib/config/integration/sinatra.rb +26 -0
- data/lib/config/options.rb +157 -0
- data/lib/config/rack/reloader.rb +15 -0
- data/lib/config/railtie.rb +9 -0
- data/lib/config/sources/yaml_source.rb +26 -0
- data/lib/config/tasks.rb +59 -0
- data/lib/config/tasks/heroku.rake +8 -0
- data/lib/config/version.rb +3 -0
- data/lib/generators/config/install_generator.rb +32 -0
- data/lib/generators/config/templates/rails_config.rb +3 -0
- data/lib/generators/config/templates/settings.local.yml +0 -0
- data/lib/generators/config/templates/settings.yml +0 -0
- data/lib/generators/config/templates/settings/development.yml +0 -0
- data/lib/generators/config/templates/settings/production.yml +0 -0
- data/lib/generators/config/templates/settings/test.yml +0 -0
- data/spec/app/rails_3/Rakefile +7 -0
- data/spec/app/rails_3/app/assets/javascripts/application.js +13 -0
- data/spec/app/rails_3/app/assets/stylesheets/application.css +13 -0
- data/spec/app/rails_3/app/controllers/application_controller.rb +3 -0
- data/spec/app/rails_3/app/helpers/application_helper.rb +2 -0
- data/spec/app/rails_3/app/models/.gitkeep +0 -0
- data/spec/app/rails_3/app/views/layouts/application.html.erb +14 -0
- data/spec/app/rails_3/bin/bundle +3 -0
- data/spec/app/rails_3/bin/rails +4 -0
- data/spec/app/rails_3/bin/rake +4 -0
- data/spec/app/rails_3/config.ru +4 -0
- data/spec/app/rails_3/config/application.rb +29 -0
- data/spec/app/rails_3/config/boot.rb +5 -0
- data/spec/app/rails_3/config/database.yml +25 -0
- data/spec/app/rails_3/config/environment.rb +5 -0
- data/spec/app/rails_3/config/environments/development.rb +42 -0
- data/spec/app/rails_3/config/environments/production.rb +72 -0
- data/spec/app/rails_3/config/environments/test.rb +42 -0
- data/spec/app/rails_3/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/app/rails_3/config/initializers/inflections.rb +15 -0
- data/spec/app/rails_3/config/initializers/mime_types.rb +5 -0
- data/spec/app/rails_3/config/initializers/secret_token.rb +7 -0
- data/spec/app/rails_3/config/initializers/session_store.rb +8 -0
- data/spec/app/rails_3/config/initializers/wrap_parameters.rb +14 -0
- data/spec/app/rails_3/config/locales/en.yml +5 -0
- data/spec/app/rails_3/config/routes.rb +2 -0
- data/spec/app/rails_3/config/settings.yml +7 -0
- data/spec/app/rails_3/db/.gitkeep +0 -0
- data/spec/app/rails_3/public/404.html +26 -0
- data/spec/app/rails_3/public/422.html +26 -0
- data/spec/app/rails_3/public/500.html +25 -0
- data/spec/app/rails_3/script/rails +6 -0
- data/spec/app/rails_4.1/Rakefile +6 -0
- data/spec/app/rails_4.1/app/assets/javascripts/application.js +13 -0
- data/spec/app/rails_4.1/app/assets/stylesheets/application.css +15 -0
- data/spec/app/rails_4.1/app/controllers/application_controller.rb +5 -0
- data/spec/app/rails_4.1/app/helpers/application_helper.rb +2 -0
- data/spec/app/rails_4.1/app/models/.keep +0 -0
- data/spec/app/rails_4.1/app/views/layouts/application.html.erb +14 -0
- data/spec/app/rails_4.1/bin/bundle +3 -0
- data/spec/app/rails_4.1/bin/rails +4 -0
- data/spec/app/rails_4.1/bin/rake +4 -0
- data/spec/app/rails_4.1/config.ru +4 -0
- data/spec/app/rails_4.1/config/application.rb +27 -0
- data/spec/app/rails_4.1/config/boot.rb +5 -0
- data/spec/app/rails_4.1/config/database.yml +25 -0
- data/spec/app/rails_4.1/config/environment.rb +5 -0
- data/spec/app/rails_4.1/config/environments/development.rb +42 -0
- data/spec/app/rails_4.1/config/environments/production.rb +88 -0
- data/spec/app/rails_4.1/config/environments/test.rb +44 -0
- data/spec/app/rails_4.1/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/app/rails_4.1/config/initializers/cookies_serializer.rb +3 -0
- data/spec/app/rails_4.1/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/app/rails_4.1/config/initializers/inflections.rb +16 -0
- data/spec/app/rails_4.1/config/initializers/mime_types.rb +4 -0
- data/spec/app/rails_4.1/config/initializers/session_store.rb +3 -0
- data/spec/app/rails_4.1/config/initializers/wrap_parameters.rb +14 -0
- data/spec/app/rails_4.1/config/locales/en.yml +23 -0
- data/spec/app/rails_4.1/config/routes.rb +2 -0
- data/spec/app/rails_4.1/config/secrets.yml +22 -0
- data/spec/app/rails_4.1/config/settings.yml +7 -0
- data/spec/app/rails_4.1/db/.keep +0 -0
- data/spec/app/rails_4.1/public/404.html +67 -0
- data/spec/app/rails_4.1/public/422.html +67 -0
- data/spec/app/rails_4.1/public/500.html +66 -0
- data/spec/app/rails_4.2/Rakefile +6 -0
- data/spec/app/rails_4.2/app/assets/images/.keep +0 -0
- data/spec/app/rails_4.2/app/assets/javascripts/application.js +16 -0
- data/spec/app/rails_4.2/app/assets/stylesheets/application.css +15 -0
- data/spec/app/rails_4.2/app/controllers/application_controller.rb +5 -0
- data/spec/app/rails_4.2/app/controllers/concerns/.keep +0 -0
- data/spec/app/rails_4.2/app/helpers/application_helper.rb +2 -0
- data/spec/app/rails_4.2/app/mailers/.keep +0 -0
- data/spec/app/rails_4.2/app/models/.keep +0 -0
- data/spec/app/rails_4.2/app/models/concerns/.keep +0 -0
- data/spec/app/rails_4.2/app/views/layouts/application.html.erb +14 -0
- data/spec/app/rails_4.2/bin/bundle +3 -0
- data/spec/app/rails_4.2/bin/rails +8 -0
- data/spec/app/rails_4.2/bin/rake +8 -0
- data/spec/app/rails_4.2/bin/setup +29 -0
- data/spec/app/rails_4.2/bin/spring +15 -0
- data/spec/app/rails_4.2/config.ru +4 -0
- data/spec/app/rails_4.2/config/application.rb +31 -0
- data/spec/app/rails_4.2/config/boot.rb +3 -0
- data/spec/app/rails_4.2/config/database.yml +25 -0
- data/spec/app/rails_4.2/config/environment.rb +5 -0
- data/spec/app/rails_4.2/config/environments/development.rb +41 -0
- data/spec/app/rails_4.2/config/environments/production.rb +79 -0
- data/spec/app/rails_4.2/config/environments/test.rb +42 -0
- data/spec/app/rails_4.2/config/initializers/assets.rb +11 -0
- data/spec/app/rails_4.2/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/app/rails_4.2/config/initializers/cookies_serializer.rb +3 -0
- data/spec/app/rails_4.2/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/app/rails_4.2/config/initializers/inflections.rb +16 -0
- data/spec/app/rails_4.2/config/initializers/mime_types.rb +4 -0
- data/spec/app/rails_4.2/config/initializers/session_store.rb +3 -0
- data/spec/app/rails_4.2/config/initializers/wrap_parameters.rb +14 -0
- data/spec/app/rails_4.2/config/locales/en.yml +23 -0
- data/spec/app/rails_4.2/config/routes.rb +56 -0
- data/spec/app/rails_4.2/config/secrets.yml +22 -0
- data/spec/app/rails_4.2/config/settings.yml +7 -0
- data/spec/app/rails_4.2/db/seeds.rb +7 -0
- data/spec/app/rails_4.2/public/404.html +67 -0
- data/spec/app/rails_4.2/public/422.html +67 -0
- data/spec/app/rails_4.2/public/500.html +66 -0
- data/spec/app/rails_4.2/public/favicon.ico +0 -0
- data/spec/app/rails_4.2/public/robots.txt +5 -0
- data/spec/app/rails_4/Rakefile +6 -0
- data/spec/app/rails_4/app/assets/javascripts/application.js +13 -0
- data/spec/app/rails_4/app/assets/stylesheets/application.css +13 -0
- data/spec/app/rails_4/app/controllers/application_controller.rb +5 -0
- data/spec/app/rails_4/app/helpers/application_helper.rb +2 -0
- data/spec/app/rails_4/app/models/.keep +0 -0
- data/spec/app/rails_4/app/views/layouts/application.html.erb +14 -0
- data/spec/app/rails_4/bin/bundle +3 -0
- data/spec/app/rails_4/bin/rails +4 -0
- data/spec/app/rails_4/bin/rake +4 -0
- data/spec/app/rails_4/config.ru +4 -0
- data/spec/app/rails_4/config/application.rb +27 -0
- data/spec/app/rails_4/config/boot.rb +5 -0
- data/spec/app/rails_4/config/database.yml +25 -0
- data/spec/app/rails_4/config/environment.rb +5 -0
- data/spec/app/rails_4/config/environments/development.rb +34 -0
- data/spec/app/rails_4/config/environments/production.rb +85 -0
- data/spec/app/rails_4/config/environments/test.rb +41 -0
- data/spec/app/rails_4/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/app/rails_4/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/app/rails_4/config/initializers/inflections.rb +16 -0
- data/spec/app/rails_4/config/initializers/mime_types.rb +5 -0
- data/spec/app/rails_4/config/initializers/secret_token.rb +12 -0
- data/spec/app/rails_4/config/initializers/session_store.rb +3 -0
- data/spec/app/rails_4/config/initializers/wrap_parameters.rb +14 -0
- data/spec/app/rails_4/config/locales/en.yml +23 -0
- data/spec/app/rails_4/config/routes.rb +2 -0
- data/spec/app/rails_4/config/settings.yml +7 -0
- data/spec/app/rails_4/db/.keep +0 -0
- data/spec/app/rails_4/public/404.html +58 -0
- data/spec/app/rails_4/public/422.html +58 -0
- data/spec/app/rails_4/public/500.html +57 -0
- data/spec/config_spec.rb +317 -0
- data/spec/fixtures/bool_override/config1.yml +2 -0
- data/spec/fixtures/bool_override/config2.yml +2 -0
- data/spec/fixtures/custom_types/hash.yml +7 -0
- data/spec/fixtures/deep_merge/config1.yml +28 -0
- data/spec/fixtures/deep_merge/config2.yml +28 -0
- data/spec/fixtures/deep_merge2/config1.yml +3 -0
- data/spec/fixtures/deep_merge2/config2.yml +2 -0
- data/spec/fixtures/development.yml +4 -0
- data/spec/fixtures/empty1.yml +0 -0
- data/spec/fixtures/empty2.yml +0 -0
- data/spec/fixtures/env/settings.yml +4 -0
- data/spec/fixtures/malformed.yml +6 -0
- data/spec/fixtures/reserved_keywords.yml +2 -0
- data/spec/fixtures/settings.yml +21 -0
- data/spec/fixtures/settings2.yml +1 -0
- data/spec/fixtures/with_erb.yml +4 -0
- data/spec/options_spec.rb +84 -0
- data/spec/sources/yaml_source_spec.rb +77 -0
- data/spec/spec_helper.rb +54 -0
- data/spec/support/rails_config_helper.rb +22 -0
- data/spec/support/shared_contexts/rake.rb +8 -0
- data/spec/tasks/db_spec.rb +9 -0
- metadata +580 -42
@@ -0,0 +1,85 @@
|
|
1
|
+
Rails4::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both thread web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
+
# config.action_dispatch.rack_cache = true
|
21
|
+
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
+
config.serve_static_assets = false
|
24
|
+
|
25
|
+
# Compress JavaScripts and CSS.
|
26
|
+
config.assets.js_compressor = :uglifier
|
27
|
+
# config.assets.css_compressor = :sass
|
28
|
+
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
+
config.assets.compile = false
|
31
|
+
|
32
|
+
# Generate digests for assets URLs.
|
33
|
+
config.assets.digest = true
|
34
|
+
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
36
|
+
config.assets.version = '1.0'
|
37
|
+
|
38
|
+
# Specifies the header that your server uses for sending files.
|
39
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
+
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
+
# config.force_ssl = true
|
44
|
+
|
45
|
+
# Set to :debug to see everything in the log.
|
46
|
+
config.log_level = :info
|
47
|
+
|
48
|
+
# Prepend all log lines with the following tags.
|
49
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
50
|
+
|
51
|
+
# Use a different logger for distributed setups.
|
52
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
53
|
+
|
54
|
+
# Use a different cache store in production.
|
55
|
+
# config.cache_store = :mem_cache_store
|
56
|
+
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
58
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
59
|
+
|
60
|
+
# Precompile additional assets.
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
62
|
+
# config.assets.precompile += %w( search.js )
|
63
|
+
|
64
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
65
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
66
|
+
# config.action_mailer.raise_delivery_errors = false
|
67
|
+
|
68
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
70
|
+
config.i18n.fallbacks = true
|
71
|
+
|
72
|
+
# Send deprecation notices to registered listeners.
|
73
|
+
config.active_support.deprecation = :notify
|
74
|
+
|
75
|
+
# Disable automatic flushing of the log to improve performance.
|
76
|
+
# config.autoflush_log = false
|
77
|
+
|
78
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
+
config.log_formatter = ::Logger::Formatter.new
|
80
|
+
|
81
|
+
##
|
82
|
+
# Config
|
83
|
+
#
|
84
|
+
config_available?
|
85
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Rails4::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Print deprecation notices to the stderr.
|
35
|
+
config.active_support.deprecation = :stderr
|
36
|
+
|
37
|
+
##
|
38
|
+
# Config
|
39
|
+
#
|
40
|
+
config_available?
|
41
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Rails4::Application.config.secret_key_base = '59ffaa3abc9de803724495249f6592fc549691880df31f7cbaef33a9dda20345210f90ba8843cc631f6f0c8ab8f538946f9f595dd92947e6a608152a0e54e03f'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
File without changes
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/404.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
54
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/422.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>The change you wanted was rejected.</h1>
|
54
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
55
|
+
</div>
|
56
|
+
<p>If you are the application owner check the logs for more information.</p>
|
57
|
+
</body>
|
58
|
+
</html>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<style>
|
6
|
+
body {
|
7
|
+
background-color: #EFEFEF;
|
8
|
+
color: #2E2F30;
|
9
|
+
text-align: center;
|
10
|
+
font-family: arial, sans-serif;
|
11
|
+
}
|
12
|
+
|
13
|
+
div.dialog {
|
14
|
+
width: 25em;
|
15
|
+
margin: 4em auto 0 auto;
|
16
|
+
border: 1px solid #CCC;
|
17
|
+
border-right-color: #999;
|
18
|
+
border-left-color: #999;
|
19
|
+
border-bottom-color: #BBB;
|
20
|
+
border-top: #B00100 solid 4px;
|
21
|
+
border-top-left-radius: 9px;
|
22
|
+
border-top-right-radius: 9px;
|
23
|
+
background-color: white;
|
24
|
+
padding: 7px 4em 0 4em;
|
25
|
+
}
|
26
|
+
|
27
|
+
h1 {
|
28
|
+
font-size: 100%;
|
29
|
+
color: #730E15;
|
30
|
+
line-height: 1.5em;
|
31
|
+
}
|
32
|
+
|
33
|
+
body > p {
|
34
|
+
width: 33em;
|
35
|
+
margin: 0 auto 1em;
|
36
|
+
padding: 1em 0;
|
37
|
+
background-color: #F7F7F7;
|
38
|
+
border: 1px solid #CCC;
|
39
|
+
border-right-color: #999;
|
40
|
+
border-bottom-color: #999;
|
41
|
+
border-bottom-left-radius: 4px;
|
42
|
+
border-bottom-right-radius: 4px;
|
43
|
+
border-top-color: #DADADA;
|
44
|
+
color: #666;
|
45
|
+
box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
|
46
|
+
}
|
47
|
+
</style>
|
48
|
+
</head>
|
49
|
+
|
50
|
+
<body>
|
51
|
+
<!-- This file lives in public/500.html -->
|
52
|
+
<div class="dialog">
|
53
|
+
<h1>We're sorry, but something went wrong.</h1>
|
54
|
+
</div>
|
55
|
+
<p>If you are the application owner check the logs for more information.</p>
|
56
|
+
</body>
|
57
|
+
</html>
|
data/spec/config_spec.rb
ADDED
@@ -0,0 +1,317 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Config do
|
4
|
+
it "should get setting files" do
|
5
|
+
config = Config.setting_files("root/config", "test")
|
6
|
+
expect(config).to eq([
|
7
|
+
'root/config/settings.yml',
|
8
|
+
'root/config/settings/test.yml',
|
9
|
+
'root/config/environments/test.yml',
|
10
|
+
'root/config/settings.local.yml',
|
11
|
+
'root/config/settings/test.local.yml',
|
12
|
+
'root/config/environments/test.local.yml'
|
13
|
+
])
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should load a basic config file" do
|
17
|
+
config = Config.load_files("#{fixture_path}/settings.yml")
|
18
|
+
expect(config.size).to eq(1)
|
19
|
+
expect(config.server).to eq("google.com")
|
20
|
+
expect(config['1']).to eq('one')
|
21
|
+
expect(config.photo_sizes.avatar).to eq([60, 60])
|
22
|
+
expect(config.root['yahoo.com']).to eq(2)
|
23
|
+
expect(config.root['google.com']).to eq(3)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should load 2 basic config files" do
|
27
|
+
config = Config.load_files("#{fixture_path}/settings.yml", "#{fixture_path}/settings2.yml")
|
28
|
+
expect(config.size).to eq(1)
|
29
|
+
expect(config.server).to eq("google.com")
|
30
|
+
expect(config.another).to eq("something")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should load empty config for a missing file path" do
|
34
|
+
config = Config.load_files("#{fixture_path}/some_file_that_doesnt_exist.yml")
|
35
|
+
expect(config).to be_empty
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should load an empty config for multiple missing file paths" do
|
39
|
+
files = ["#{fixture_path}/doesnt_exist1.yml", "#{fixture_path}/doesnt_exist2.yml"]
|
40
|
+
config = Config.load_files(files)
|
41
|
+
expect(config).to be_empty
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should load empty config for an empty setting file" do
|
45
|
+
config = Config.load_files("#{fixture_path}/empty1.yml")
|
46
|
+
expect(config).to be_empty
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should convert to a hash" do
|
50
|
+
config = Config.load_files("#{fixture_path}/development.yml").to_hash
|
51
|
+
expect(config[:section][:servers]).to be_kind_of(Array)
|
52
|
+
expect(config[:section][:servers][0][:name]).to eq("yahoo.com")
|
53
|
+
expect(config[:section][:servers][1][:name]).to eq("amazon.com")
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should convert to a hash (We Need To Go Deeper)" do
|
57
|
+
config = Config.load_files("#{fixture_path}/development.yml").to_hash
|
58
|
+
servers = config[:section][:servers]
|
59
|
+
expect(servers).to eq([ { name: "yahoo.com" }, { name: "amazon.com" } ])
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should convert to a json" do
|
63
|
+
config = Config.load_files("#{fixture_path}/development.yml").to_json
|
64
|
+
expect(JSON.parse(config)["section"]["servers"]).to be_kind_of(Array)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should load an empty config for multiple missing file paths" do
|
68
|
+
files = ["#{fixture_path}/empty1.yml", "#{fixture_path}/empty2.yml"]
|
69
|
+
config = Config.load_files(files)
|
70
|
+
expect(config).to be_empty
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should allow overrides" do
|
74
|
+
files = ["#{fixture_path}/settings.yml", "#{fixture_path}/development.yml"]
|
75
|
+
config = Config.load_files(files)
|
76
|
+
expect(config.server).to eq("google.com")
|
77
|
+
expect(config.size).to eq(2)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should allow full reload of the settings files" do
|
81
|
+
files = ["#{fixture_path}/settings.yml"]
|
82
|
+
Config.load_and_set_settings(files)
|
83
|
+
expect(Settings.server).to eq("google.com")
|
84
|
+
expect(Settings.size).to eq(1)
|
85
|
+
|
86
|
+
files = ["#{fixture_path}/settings.yml", "#{fixture_path}/development.yml"]
|
87
|
+
Settings.reload_from_files(files)
|
88
|
+
expect(Settings.server).to eq("google.com")
|
89
|
+
expect(Settings.size).to eq(2)
|
90
|
+
end
|
91
|
+
|
92
|
+
context "ENV variables" do
|
93
|
+
let(:config) do
|
94
|
+
Config.load_files("#{fixture_path}/settings.yml")
|
95
|
+
end
|
96
|
+
|
97
|
+
before :all do
|
98
|
+
load_env("#{fixture_path}/env/settings.yml")
|
99
|
+
Config.use_env = true
|
100
|
+
end
|
101
|
+
|
102
|
+
after :all do
|
103
|
+
Config.use_env = false
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should load basic ENV variables" do
|
107
|
+
config.load_env!
|
108
|
+
expect(config.test_var).to eq("123")
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should load nested sections" do
|
112
|
+
config.load_env!
|
113
|
+
expect(config.hash_test.one).to eq("1-1")
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should override settings from files" do
|
117
|
+
Config.load_and_set_settings ["#{fixture_path}/settings.yml"]
|
118
|
+
expect(Settings.server).to eq("google.com")
|
119
|
+
expect(Settings.size).to eq("3")
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should reload env" do
|
123
|
+
Config.load_and_set_settings ["#{fixture_path}/settings.yml"]
|
124
|
+
Config.reload!
|
125
|
+
expect(Settings.server).to eq("google.com")
|
126
|
+
expect(Settings.size).to eq("3")
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
context "Nested Settings" do
|
131
|
+
let(:config) do
|
132
|
+
Config.load_files("#{fixture_path}/development.yml")
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should allow nested sections" do
|
136
|
+
expect(config.section.size).to eq(3)
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should allow configuration collections (arrays)" do
|
140
|
+
expect(config.section.servers[0].name).to eq("yahoo.com")
|
141
|
+
expect(config.section.servers[1].name).to eq("amazon.com")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context "Settings with ERB tags" do
|
146
|
+
let(:config) do
|
147
|
+
Config.load_files("#{fixture_path}/with_erb.yml")
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should evaluate ERB tags" do
|
151
|
+
expect(config.computed).to eq(6)
|
152
|
+
end
|
153
|
+
|
154
|
+
it "should evaluated nested ERB tags" do
|
155
|
+
expect(config.section.computed1).to eq(1)
|
156
|
+
expect(config.section.computed2).to eq(2)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context "Deep Merging" do
|
161
|
+
let(:config) do
|
162
|
+
files = ["#{fixture_path}/deep_merge/config1.yml", "#{fixture_path}/deep_merge/config2.yml"]
|
163
|
+
Config.load_files(files)
|
164
|
+
end
|
165
|
+
|
166
|
+
it "should merge hashes from multiple configs" do
|
167
|
+
expect(config.inner.marshal_dump.keys.size).to eq(3)
|
168
|
+
expect(config.inner2.inner2_inner.marshal_dump.keys.size).to eq(3)
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should merge arrays from multiple configs" do
|
172
|
+
expect(config.arraylist1.size).to eq(6)
|
173
|
+
expect(config.arraylist2.inner.size).to eq(6)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
context "Boolean Overrides" do
|
178
|
+
let(:config) do
|
179
|
+
files = ["#{fixture_path}/bool_override/config1.yml", "#{fixture_path}/bool_override/config2.yml"]
|
180
|
+
Config.load_files(files)
|
181
|
+
end
|
182
|
+
|
183
|
+
it "should allow overriding of bool settings" do
|
184
|
+
expect(config.override_bool).to eq(false)
|
185
|
+
expect(config.override_bool_opposite).to eq(true)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
context "Custom Configuration" do
|
190
|
+
it "should have the default settings constant as 'Settings'" do
|
191
|
+
expect(Config.const_name).to eq("Settings")
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should be able to assign a different settings constant" do
|
195
|
+
Config.setup { |config| config.const_name = "Settings2" }
|
196
|
+
expect(Config.const_name).to eq("Settings2")
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
context "Settings with a type value of 'hash'" do
|
201
|
+
let(:config) do
|
202
|
+
files = ["#{fixture_path}/custom_types/hash.yml"]
|
203
|
+
Config.load_files(files)
|
204
|
+
end
|
205
|
+
|
206
|
+
it "should turn that setting into a Real Hash" do
|
207
|
+
expect(config.prices).to be_kind_of(Hash)
|
208
|
+
end
|
209
|
+
|
210
|
+
it "should map the hash values correctly" do
|
211
|
+
expect(config.prices[1]).to eq(2.99)
|
212
|
+
expect(config.prices[5]).to eq(9.99)
|
213
|
+
expect(config.prices[15]).to eq(19.99)
|
214
|
+
expect(config.prices[30]).to eq(29.99)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
context "Merging hash at runtime" do
|
219
|
+
let(:config) { Config.load_files("#{fixture_path}/settings.yml") }
|
220
|
+
let(:hash) { { :options => { :suboption => 'value' }, :server => 'amazon.com' } }
|
221
|
+
|
222
|
+
it 'should be chainable' do
|
223
|
+
expect(config.merge!({})).to eq(config)
|
224
|
+
end
|
225
|
+
|
226
|
+
it 'should preserve existing keys' do
|
227
|
+
expect { config.merge!({}) }.to_not change { config.keys }
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'should recursively merge keys' do
|
231
|
+
config.merge!(hash)
|
232
|
+
expect(config.options.suboption).to eq('value')
|
233
|
+
end
|
234
|
+
|
235
|
+
it 'should rewrite a merged value' do
|
236
|
+
expect { config.merge!(hash) }.to change { config.server }.from('google.com').to('amazon.com')
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
context "Merging nested hash at runtime" do
|
241
|
+
let(:config) { Config.load_files("#{fixture_path}/deep_merge/config1.yml") }
|
242
|
+
let(:hash) { { :inner => { :something1 => 'changed1', :something3 => 'changed3' } } }
|
243
|
+
|
244
|
+
it 'should preserve first level keys' do
|
245
|
+
expect { config.merge!(hash) }.to_not change { config.keys }
|
246
|
+
end
|
247
|
+
|
248
|
+
it 'should preserve nested key' do
|
249
|
+
config.merge!(hash)
|
250
|
+
expect(config.inner.something2).to eq('blah2')
|
251
|
+
end
|
252
|
+
|
253
|
+
it 'should add new nested key' do
|
254
|
+
expect { config.merge!(hash) }.to change { config.inner.something3 }.from(nil).to("changed3")
|
255
|
+
end
|
256
|
+
|
257
|
+
it 'should rewrite a merged value' do
|
258
|
+
expect { config.merge!(hash) }.to change { config.inner.something1 }.from('blah1').to('changed1')
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
context "[] accessors" do
|
263
|
+
let(:config) do
|
264
|
+
files = ["#{fixture_path}/development.yml"]
|
265
|
+
Config.load_files(files)
|
266
|
+
end
|
267
|
+
|
268
|
+
it "should access attributes using []" do
|
269
|
+
expect(config.section['size']).to eq(3)
|
270
|
+
expect(config.section[:size]).to eq(3)
|
271
|
+
expect(config[:section][:size]).to eq(3)
|
272
|
+
end
|
273
|
+
|
274
|
+
it "should set values using []=" do
|
275
|
+
config.section[:foo] = 'bar'
|
276
|
+
expect(config.section.foo).to eq('bar')
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
context "enumerable" do
|
281
|
+
let(:config) do
|
282
|
+
files = ["#{fixture_path}/development.yml"]
|
283
|
+
Config.load_files(files)
|
284
|
+
end
|
285
|
+
|
286
|
+
it "should enumerate top level parameters" do
|
287
|
+
keys = []
|
288
|
+
config.each { |key, value| keys << key }
|
289
|
+
expect(keys).to eq([:size, :section])
|
290
|
+
end
|
291
|
+
|
292
|
+
it "should enumerate inner parameters" do
|
293
|
+
keys = []
|
294
|
+
config.section.each { |key, value| keys << key }
|
295
|
+
expect(keys).to eq([:size, :servers])
|
296
|
+
end
|
297
|
+
|
298
|
+
it "should have methods defined by Enumerable" do
|
299
|
+
expect(config.map { |key, value| key }).to eq([:size, :section])
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
context "keys" do
|
304
|
+
let(:config) do
|
305
|
+
files = ["#{fixture_path}/development.yml"]
|
306
|
+
Config.load_files(files)
|
307
|
+
end
|
308
|
+
|
309
|
+
it "should return array of keys" do
|
310
|
+
expect(config.keys).to contain_exactly(:size, :section)
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should return array of keys for nested entry" do
|
314
|
+
expect(config.section.keys).to contain_exactly(:size, :servers)
|
315
|
+
end
|
316
|
+
end
|
317
|
+
end
|