access_policy_rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +6 -0
  4. data/Gemfile +7 -0
  5. data/Guardfile +25 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +71 -0
  8. data/Rakefile +14 -0
  9. data/access_policy_rails.gemspec +48 -0
  10. data/lib/access_policy_rails/change_storage_scope.rb +15 -0
  11. data/lib/access_policy_rails/controller_extensions.rb +69 -0
  12. data/lib/access_policy_rails/policy_wrapper.rb +11 -0
  13. data/lib/access_policy_rails/railtie.rb +11 -0
  14. data/lib/access_policy_rails/request_local_storage.rb +12 -0
  15. data/lib/access_policy_rails/version.rb +3 -0
  16. data/lib/access_policy_rails.rb +13 -0
  17. data/spec/acceptance/dummy/README.rdoc +28 -0
  18. data/spec/acceptance/dummy/Rakefile +6 -0
  19. data/spec/acceptance/dummy/app/assets/images/.keep +0 -0
  20. data/spec/acceptance/dummy/app/assets/javascripts/application.js +13 -0
  21. data/spec/acceptance/dummy/app/assets/stylesheets/application.css +13 -0
  22. data/spec/acceptance/dummy/app/controllers/application_controller.rb +5 -0
  23. data/spec/acceptance/dummy/app/controllers/concerns/.keep +0 -0
  24. data/spec/acceptance/dummy/app/helpers/application_helper.rb +2 -0
  25. data/spec/acceptance/dummy/app/mailers/.keep +0 -0
  26. data/spec/acceptance/dummy/app/models/.keep +0 -0
  27. data/spec/acceptance/dummy/app/models/concerns/.keep +0 -0
  28. data/spec/acceptance/dummy/app/views/layouts/application.html.erb +14 -0
  29. data/spec/acceptance/dummy/bin/bundle +3 -0
  30. data/spec/acceptance/dummy/bin/rails +4 -0
  31. data/spec/acceptance/dummy/bin/rake +4 -0
  32. data/spec/acceptance/dummy/config/application.rb +28 -0
  33. data/spec/acceptance/dummy/config/boot.rb +5 -0
  34. data/spec/acceptance/dummy/config/environment.rb +5 -0
  35. data/spec/acceptance/dummy/config/environments/development.rb +27 -0
  36. data/spec/acceptance/dummy/config/environments/production.rb +80 -0
  37. data/spec/acceptance/dummy/config/environments/test.rb +36 -0
  38. data/spec/acceptance/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/acceptance/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  40. data/spec/acceptance/dummy/config/initializers/inflections.rb +16 -0
  41. data/spec/acceptance/dummy/config/initializers/mime_types.rb +5 -0
  42. data/spec/acceptance/dummy/config/initializers/secret_token.rb +12 -0
  43. data/spec/acceptance/dummy/config/initializers/session_store.rb +3 -0
  44. data/spec/acceptance/dummy/config/initializers/wrap_parameters.rb +9 -0
  45. data/spec/acceptance/dummy/config/locales/en.yml +23 -0
  46. data/spec/acceptance/dummy/config/routes.rb +56 -0
  47. data/spec/acceptance/dummy/config.ru +4 -0
  48. data/spec/acceptance/dummy/lib/assets/.keep +0 -0
  49. data/spec/acceptance/dummy/log/.keep +0 -0
  50. data/spec/acceptance/dummy/log/test.log +0 -0
  51. data/spec/acceptance/dummy/public/404.html +58 -0
  52. data/spec/acceptance/dummy/public/422.html +58 -0
  53. data/spec/acceptance/dummy/public/500.html +57 -0
  54. data/spec/acceptance/dummy/public/favicon.ico +0 -0
  55. data/spec/acceptance/enables_permission_query_spec.rb +49 -0
  56. data/spec/acceptance/enforce_authorize_outside_of_action_spec.rb +67 -0
  57. data/spec/acceptance/protect_controller_actions_spec.rb +25 -0
  58. data/spec/acceptance/support/dummy_controller.rb +13 -0
  59. data/spec/acceptance/support/dummy_controller_policy.rb +11 -0
  60. data/spec/acceptance/support/feature.rb +30 -0
  61. data/spec/acceptance/use_different_user_for_policy_checks_spec.rb +40 -0
  62. data/spec/acceptance_spec_helper.rb +12 -0
  63. data/spec/spec_helper.rb +42 -0
  64. data/spec/support/base_controller_dummy.rb +26 -0
  65. data/spec/unit/lib/access_policy_rails/controller_extensions_spec.rb +89 -0
  66. data/spec/unit/lib/access_policy_rails/policy_wrapper_spec.rb +20 -0
  67. data/spec/unit/lib/access_policy_rails/request_local_storage_spec.rb +52 -0
  68. data/spec/unit_spec_helper.rb +1 -0
  69. metadata +387 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 90e7d6b18bd059963e82d1cbc2486150a71a5a3c
4
+ data.tar.gz: 0a532c786ab1a225dab5ef6d8cb074083619aa5b
5
+ SHA512:
6
+ metadata.gz: b4bbbde1e2ef3549b244a87206d706dd0b87daa64aed228e709241bb7e086e262a73116f314620f4ea8fbdae4e5c7bc54b6def6ed579c11bab8c20c5abbef51b
7
+ data.tar.gz: a1ae44e5234d0ebeab0d19c99bd585cd7ba6b7e4e52415d9178f1a2f7d4458654f52e8e994c86e1defabcef14da9439e13d2545b80119e2588e14f9e156f5e82
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format Fuubar
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ notifications:
5
+ recipients:
6
+ - shad0wrunner@gmx.de
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in access_policy_rails.gemspec
4
+ gemspec
5
+
6
+ gem 'simplecov', require: false, group: :test
7
+ gem 'coveralls', require: false
data/Guardfile ADDED
@@ -0,0 +1,25 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec, all_after_pass: true ,
5
+ all_on_start: true do
6
+
7
+ watch(%r{^spec/.+_spec\.rb$})
8
+
9
+ watch('lib/yaoc.rb') { "spec" }
10
+
11
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/unit/lib/#{m[1]}_spec.rb" }
12
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/integration/lib/#{m[1]}_spec.rb" }
13
+
14
+ watch('spec/spec_helper.rb') { "spec" }
15
+
16
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
17
+
18
+ end
19
+
20
+
21
+ guard :bundler do
22
+ watch('Gemfile')
23
+ # Uncomment next line if your Gemfile contains the `gemspec' command.
24
+ watch(/^.+\.gemspec/)
25
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Dieter Späth
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # AccessPolicyRails [![Code Climate](https://codeclimate.com/github/slowjack2k/access_policy_rails.png)](https://codeclimate.com/github/slowjack2k/access_policy_rails) [![Build Status](https://travis-ci.org/slowjack2k/access_policy_rails.png?branch=master)](https://travis-ci.org/slowjack2k/access_policy_rails) [![Coverage Status](https://coveralls.io/repos/slowjack2k/access_policy_rails/badge.png?branch=master)](https://coveralls.io/r/slowjack2k/access_policy_rails?branch=master) [![Gem Version](https://badge.fury.io/rb/access_policy_rails.png)](http://badge.fury.io/rb/access_policy_rails)
2
+
3
+ Rails extension for AccessPolicy. Stores the policy_check_user (default current_user)
4
+ in a RequestLocalStorage. So it is not needed to pass the user around.
5
+
6
+ Further more some macros are provided to query permissions and protect actions.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ gem 'access_policy_rails'
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install access_policy_rails
21
+
22
+ ## Usage
23
+
24
+ ```ruby
25
+
26
+ class DummyController < ActionController::Base
27
+ attr_accessor :current_user
28
+
29
+ # instead of
30
+ #
31
+ # def create
32
+ # end
33
+ #
34
+ # def show
35
+ # end
36
+
37
+ guarded_action :create do
38
+
39
+ end
40
+
41
+ guarded_action :show do
42
+
43
+ end
44
+ end
45
+
46
+
47
+ DummyControllerPolicy = Struct.new(:current_user, :controller) do
48
+ def create?
49
+ !! (current_user && current_user.create_allowed?)
50
+ end
51
+
52
+ def show?
53
+ !! (current_user && current_user.show_allowed?)
54
+ end
55
+ end
56
+
57
+ # Query permissions in controller or view
58
+
59
+ policy_for(an_object).allow?(:create)
60
+
61
+ ```
62
+
63
+
64
+
65
+ ## Contributing
66
+
67
+ 1. Fork it ( http://github.com/slowjack2k/access_policy_rails/fork )
68
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
69
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
70
+ 4. Push to the branch (`git push origin my-new-feature`)
71
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+
7
+ task :default => :spec
8
+ task :test => :spec
9
+
10
+ desc "Run RSpec with code coverage"
11
+ task :coverage do
12
+ ENV['SIMPLE_COVERAGE'] = "true"
13
+ Rake::Task["spec"].execute
14
+ end
@@ -0,0 +1,48 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'access_policy_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "access_policy_rails"
8
+ spec.version = AccessPolicyRails::VERSION
9
+ spec.authors = ["Dieter Späth"]
10
+ spec.email = ["shad0wrunner@gmx.de"]
11
+ spec.summary = %q{Object oriented authorization for ruby.}
12
+ spec.description = %q{Object oriented authorization for ruby.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency 'access_policy'
22
+ spec.add_runtime_dependency 'request_store'
23
+ spec.add_runtime_dependency 'activesupport', '~> 4.0'
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.5"
26
+ spec.add_development_dependency "rake"
27
+
28
+
29
+ spec.add_development_dependency "rails", '~>4.0.1'
30
+ spec.add_development_dependency "rspec-rails", "2.99.0.beta1"
31
+
32
+ # show nicely how many specs have to be run
33
+ spec.add_development_dependency "fuubar"
34
+ # extended console
35
+ spec.add_development_dependency "pry"
36
+ spec.add_development_dependency 'pry-remote'
37
+
38
+ # automatic execute tasks on file changes
39
+ spec.add_development_dependency 'guard'
40
+ spec.add_development_dependency 'guard-rspec'
41
+ spec.add_development_dependency 'guard-bundler'
42
+ spec.add_development_dependency 'rb-fsevent'
43
+
44
+ # https://github.com/pry/pry-stack_explorer
45
+ spec.add_development_dependency 'pry-stack_explorer'
46
+ # https://github.com/nixme/pry-debugger
47
+ spec.add_development_dependency 'pry-debugger'
48
+ end
@@ -0,0 +1,15 @@
1
+ module AccessPolicyRails
2
+
3
+ module ChangedScopeStorage
4
+ def self.call
5
+ AccessPolicy.module_exec do
6
+ def _scope_storage
7
+ AccessPolicyRails::RequestLocalStorage
8
+ end
9
+ end
10
+ end
11
+ end
12
+
13
+ end
14
+
15
+ AccessPolicyRails::ChangedScopeStorage.call
@@ -0,0 +1,69 @@
1
+ module AccessPolicyRails
2
+ module ControllerExtensions
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ include AccessPolicy
7
+
8
+ AccessPolicy.instance_methods.each do |method|
9
+ hide_action method
10
+ end
11
+
12
+ hide_action :policy_check_user
13
+ hide_action :authorize
14
+ hide_action :policy_for
15
+
16
+ helper_method :policy_for
17
+
18
+ end
19
+
20
+ def policy_check_user
21
+ current_user
22
+ end
23
+
24
+ def authorize(*args, &block)
25
+ _guard.authorize(*args, &block)
26
+ end
27
+
28
+ def policy_for(object_to_guard=self)
29
+ _guard.send(:switched_user_or_role, policy_check_user) do
30
+ PolicyWrapper.new(_guard.policy_for(object_to_guard))
31
+ end
32
+ end
33
+
34
+ module ClassMethods
35
+ def guarded_action(action_name, authorize_action: true, &block)
36
+ if authorize_action
37
+ authorized_action(action_name, &block)
38
+ else
39
+ authorized_service(action_name, &block)
40
+ end
41
+ end
42
+
43
+ def authorized_action(action_name, &block)
44
+ action_name_guarded = "#{action_name}_with_guard".to_sym
45
+ policy_guarded_method action_name_guarded, action_name ,&block
46
+
47
+ define_method action_name do
48
+ with_user_or_role(policy_check_user) do
49
+ self.send(action_name_guarded)
50
+ end
51
+ end
52
+
53
+ hide_action action_name_guarded
54
+ hide_action unsafe_action_name(action_name_guarded)
55
+ end
56
+
57
+ def authorized_service(action_name, &block)
58
+
59
+ define_method action_name do
60
+ with_user_or_role(policy_check_user) do
61
+ instance_exec &block
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,11 @@
1
+ module AccessPolicyRails
2
+ require 'delegate'
3
+
4
+ class PolicyWrapper < SimpleDelegator
5
+ def allow?(permission)
6
+ permission = permission.to_s.end_with?('?') ? permission : "#{permission}?"
7
+ self.send(permission)
8
+ end
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ module AccessPolicyRails
2
+ class Railtie < ::Rails::Railtie
3
+ initializer "access_policy_rails.extend_controllers" do |app|
4
+
5
+ ActiveSupport.on_load :action_controller do
6
+ include AccessPolicyRails::ControllerExtensions
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ module AccessPolicyRails
2
+ require 'request_store'
3
+
4
+ class RequestLocalStorage < ScopedStorage::ThreadLocalStorage
5
+
6
+ def self.for(scope_name="default")
7
+ RequestStore.store["_#{name}_#{scope_name}"] ||= new
8
+ end
9
+
10
+ end
11
+ end
12
+
@@ -0,0 +1,3 @@
1
+ module AccessPolicyRails
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,13 @@
1
+ require 'access_policy_rails/version'
2
+ require 'access_policy'
3
+ require 'active_support/concern'
4
+
5
+ module AccessPolicyRails
6
+
7
+ end
8
+
9
+ require 'access_policy_rails/request_local_storage'
10
+ require 'access_policy_rails/change_storage_scope'
11
+ require 'access_policy_rails/controller_extensions'
12
+ require 'access_policy_rails/policy_wrapper'
13
+ require 'access_policy_rails/railtie' if defined?(Rails)
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Dummy::Application.load_tasks
File without changes
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", media: "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,28 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ # require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "action_mailer/railtie"
7
+ # require "sprockets/railtie"
8
+ require "rails/test_unit/railtie"
9
+
10
+ Bundler.require(*Rails.groups)
11
+ require "access_policy_rails"
12
+
13
+ module Dummy
14
+ class Application < Rails::Application
15
+ # Settings in config/environments/* take precedence over those specified here.
16
+ # Application configuration should go into files in config/initializers
17
+ # -- all .rb files in that directory are automatically loaded.
18
+
19
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
20
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
21
+ # config.time_zone = 'Central Time (US & Canada)'
22
+
23
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
24
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
25
+ # config.i18n.default_locale = :de
26
+ end
27
+ end
28
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Dummy::Application.initialize!
@@ -0,0 +1,27 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+
23
+ # Debug mode disables concatenation and preprocessing of assets.
24
+ # This option may cause significant delays in view rendering with a large
25
+ # number of complex assets.
26
+ config.assets.debug = true
27
+ end
@@ -0,0 +1,80 @@
1
+ Dummy::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
+ end