auth0 4.0.0 → 4.1.0

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 (145) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +2 -1
  4. data/.rubocop_todo.yml +0 -2
  5. data/.travis.yml +4 -2
  6. data/CHANGELOG.md +40 -38
  7. data/DEPLOYMENT.md +5 -0
  8. data/Gemfile +1 -1
  9. data/README.md +20 -2
  10. data/Rakefile +1 -1
  11. data/auth0.gemspec +4 -3
  12. data/doc_config/templates/default/layout/html/footer.erb +1 -1
  13. data/examples/ruby-api/.gitignore +86 -0
  14. data/examples/ruby-api/Gemfile +8 -0
  15. data/examples/ruby-api/README.md +24 -0
  16. data/examples/ruby-api/config.ru +2 -0
  17. data/examples/ruby-api/main.rb +33 -0
  18. data/examples/ruby-on-rails-api/.gitignore +18 -0
  19. data/examples/ruby-on-rails-api/Gemfile +48 -0
  20. data/examples/ruby-on-rails-api/README.md +27 -0
  21. data/examples/ruby-on-rails-api/Rakefile +6 -0
  22. data/examples/ruby-on-rails-api/app/assets/images/.keep +0 -0
  23. data/examples/ruby-on-rails-api/app/assets/javascripts/application.js +16 -0
  24. data/examples/ruby-on-rails-api/app/assets/stylesheets/application.css +15 -0
  25. data/examples/ruby-on-rails-api/app/controllers/application_controller.rb +8 -0
  26. data/examples/ruby-on-rails-api/app/controllers/concerns/.keep +0 -0
  27. data/examples/ruby-on-rails-api/app/controllers/ping_controller.rb +6 -0
  28. data/examples/ruby-on-rails-api/app/controllers/secured_ping_controller.rb +11 -0
  29. data/examples/ruby-on-rails-api/app/helpers/application_helper.rb +3 -0
  30. data/examples/ruby-on-rails-api/app/mailers/.keep +0 -0
  31. data/examples/ruby-on-rails-api/app/models/.keep +0 -0
  32. data/examples/ruby-on-rails-api/app/models/concerns/.keep +0 -0
  33. data/examples/ruby-on-rails-api/app/views/layouts/application.html.erb +14 -0
  34. data/examples/ruby-on-rails-api/bin/bundle +3 -0
  35. data/examples/ruby-on-rails-api/bin/rails +4 -0
  36. data/examples/ruby-on-rails-api/bin/rake +4 -0
  37. data/examples/ruby-on-rails-api/bin/setup +29 -0
  38. data/examples/ruby-on-rails-api/config.ru +4 -0
  39. data/examples/ruby-on-rails-api/config/application.rb +23 -0
  40. data/examples/ruby-on-rails-api/config/boot.rb +4 -0
  41. data/examples/ruby-on-rails-api/config/database.yml +27 -0
  42. data/examples/ruby-on-rails-api/config/environment.rb +5 -0
  43. data/examples/ruby-on-rails-api/config/environments/development.rb +37 -0
  44. data/examples/ruby-on-rails-api/config/environments/production.rb +83 -0
  45. data/examples/ruby-on-rails-api/config/environments/test.rb +41 -0
  46. data/examples/ruby-on-rails-api/config/initializers/backtrace_silencers.rb +7 -0
  47. data/examples/ruby-on-rails-api/config/initializers/cookies_serializer.rb +3 -0
  48. data/examples/ruby-on-rails-api/config/initializers/dotenv.rb +4 -0
  49. data/examples/ruby-on-rails-api/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/examples/ruby-on-rails-api/config/initializers/inflections.rb +16 -0
  51. data/examples/ruby-on-rails-api/config/initializers/knock.rb +53 -0
  52. data/examples/ruby-on-rails-api/config/initializers/mime_types.rb +4 -0
  53. data/examples/ruby-on-rails-api/config/initializers/session_store.rb +3 -0
  54. data/examples/ruby-on-rails-api/config/initializers/wrap_parameters.rb +14 -0
  55. data/examples/ruby-on-rails-api/config/locales/en.yml +23 -0
  56. data/examples/ruby-on-rails-api/config/routes.rb +58 -0
  57. data/examples/ruby-on-rails-api/config/secrets.yml +28 -0
  58. data/examples/ruby-on-rails-api/db/schema.rb +15 -0
  59. data/examples/ruby-on-rails-api/db/seeds.rb +7 -0
  60. data/examples/ruby-on-rails-api/lib/assets/.keep +0 -0
  61. data/examples/ruby-on-rails-api/lib/tasks/.keep +0 -0
  62. data/examples/ruby-on-rails-api/log/.keep +0 -0
  63. data/examples/ruby-on-rails-api/public/404.html +67 -0
  64. data/examples/ruby-on-rails-api/public/422.html +67 -0
  65. data/examples/ruby-on-rails-api/public/500.html +66 -0
  66. data/examples/ruby-on-rails-api/public/favicon.ico +0 -0
  67. data/examples/ruby-on-rails-api/public/robots.txt +5 -0
  68. data/examples/ruby-on-rails-api/test/controllers/.keep +0 -0
  69. data/examples/ruby-on-rails-api/test/fixtures/.keep +0 -0
  70. data/examples/ruby-on-rails-api/test/helpers/.keep +0 -0
  71. data/examples/ruby-on-rails-api/test/integration/.keep +0 -0
  72. data/examples/ruby-on-rails-api/test/mailers/.keep +0 -0
  73. data/examples/ruby-on-rails-api/test/models/.keep +0 -0
  74. data/examples/ruby-on-rails-api/test/ping_controller_test.rb +8 -0
  75. data/examples/ruby-on-rails-api/test/secured_ping_controller_test.rb +26 -0
  76. data/examples/ruby-on-rails-api/test/test_helper.rb +16 -0
  77. data/lib/auth0/api/authentication_endpoints.rb +59 -30
  78. data/lib/auth0/api/v1/clients.rb +1 -1
  79. data/lib/auth0/api/v1/connections.rb +4 -3
  80. data/lib/auth0/api/v1/logs.rb +1 -1
  81. data/lib/auth0/api/v1/rules.rb +1 -1
  82. data/lib/auth0/api/v1/users.rb +5 -5
  83. data/lib/auth0/api/v2.rb +10 -0
  84. data/lib/auth0/api/v2/blacklists.rb +1 -1
  85. data/lib/auth0/api/v2/client_grants.rb +57 -0
  86. data/lib/auth0/api/v2/clients.rb +14 -14
  87. data/lib/auth0/api/v2/connections.rb +19 -20
  88. data/lib/auth0/api/v2/device_credentials.rb +76 -0
  89. data/lib/auth0/api/v2/emails.rb +5 -7
  90. data/lib/auth0/api/v2/jobs.rb +15 -12
  91. data/lib/auth0/api/v2/logs.rb +65 -0
  92. data/lib/auth0/api/v2/resource_servers.rb +61 -0
  93. data/lib/auth0/api/v2/rules.rb +21 -20
  94. data/lib/auth0/api/v2/stats.rb +2 -2
  95. data/lib/auth0/api/v2/tenants.rb +6 -4
  96. data/lib/auth0/api/v2/tickets.rb +13 -14
  97. data/lib/auth0/api/v2/user_blocks.rb +62 -0
  98. data/lib/auth0/api/v2/users.rb +63 -32
  99. data/lib/auth0/client.rb +0 -2
  100. data/lib/auth0/mixins.rb +4 -3
  101. data/lib/auth0/mixins/httpproxy.rb +55 -0
  102. data/lib/auth0/mixins/initializer.rb +27 -10
  103. data/lib/auth0/version.rb +1 -1
  104. data/spec/integration/lib/auth0/api/api_authentication_spec.rb +118 -0
  105. data/spec/integration/lib/auth0/api/v2/api_blacklist_spec.rb +1 -1
  106. data/spec/integration/lib/auth0/api/v2/api_client_grants_spec.rb +53 -0
  107. data/spec/integration/lib/auth0/api/v2/api_clients_spec.rb +5 -2
  108. data/spec/integration/lib/auth0/api/v2/api_connections_spec.rb +8 -5
  109. data/spec/integration/lib/auth0/api/v2/api_device_credentials_spec.rb +67 -0
  110. data/spec/integration/lib/auth0/api/v2/api_email_spec.rb +15 -8
  111. data/spec/integration/lib/auth0/api/v2/api_jobs_spec.rb +11 -9
  112. data/spec/integration/lib/auth0/api/v2/api_logs_spec.rb +69 -0
  113. data/spec/integration/lib/auth0/api/v2/api_resource_servers_spec.rb +47 -0
  114. data/spec/integration/lib/auth0/api/v2/api_rules_spec.rb +2 -1
  115. data/spec/integration/lib/auth0/api/v2/api_tickets_spec.rb +2 -2
  116. data/spec/integration/lib/auth0/api/v2/api_user_blocks_spec.rb +73 -0
  117. data/spec/integration/lib/auth0/api/v2/api_users_spec.rb +32 -5
  118. data/spec/integration/lib/auth0/auth0_client_spec.rb +14 -11
  119. data/spec/lib/auth0/api/authentication_endpoints_spec.rb +116 -56
  120. data/spec/lib/auth0/api/v1/connections_spec.rb +2 -4
  121. data/spec/lib/auth0/api/v1/rules_spec.rb +2 -1
  122. data/spec/lib/auth0/api/v1/users_spec.rb +17 -9
  123. data/spec/lib/auth0/api/v2/client_grants_spec.rb +44 -0
  124. data/spec/lib/auth0/api/v2/connections_spec.rb +2 -1
  125. data/spec/lib/auth0/api/v2/device_credentials_spec.rb +73 -0
  126. data/spec/lib/auth0/api/v2/jobs_spec.rb +3 -2
  127. data/spec/lib/auth0/api/v2/logs_spec.rb +48 -0
  128. data/spec/lib/auth0/api/v2/resource_servers_spec.rb +63 -0
  129. data/spec/lib/auth0/api/v2/rules_spec.rb +8 -4
  130. data/spec/lib/auth0/api/v2/tenants_spec.rb +2 -1
  131. data/spec/lib/auth0/api/v2/tickets_spec.rb +4 -7
  132. data/spec/lib/auth0/api/v2/user_blocks_spec.rb +52 -0
  133. data/spec/lib/auth0/api/v2/users_spec.rb +39 -6
  134. data/spec/lib/auth0/client_spec.rb +8 -5
  135. data/spec/lib/auth0/mixins/httpproxy_spec.rb +225 -0
  136. data/spec/lib/auth0/mixins/initializer_spec.rb +1 -1
  137. data/spec/spec_helper_full.rb +12 -3
  138. data/spec/spec_helper_unit.rb +2 -2
  139. data/spec/support/credentials.rb +6 -4
  140. data/spec/support/dummy_class.rb +2 -1
  141. data/spec/support/dummy_class_for_proxy.rb +2 -2
  142. data/spec/support/dummy_class_for_restclient.rb +2 -0
  143. metadata +117 -9
  144. data/lib/auth0/mixins/httparty_proxy.rb +0 -38
  145. data/spec/lib/auth0/mixins/httparty_proxy_spec.rb +0 -148
@@ -0,0 +1,18 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore all logfiles and tempfiles.
15
+ /log/*.log
16
+ /tmp
17
+
18
+ .env
@@ -0,0 +1,48 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
4
+ gem 'rails', '4.2.5.1'
5
+ # Use sqlite3 as the database for Active Record
6
+ gem 'sqlite3', groups: [:development, :test]
7
+
8
+ gem 'pg'
9
+ # Use SCSS for stylesheets
10
+ gem 'sass-rails', '~> 5.0.4'
11
+ # Use Uglifier as compressor for JavaScript assets
12
+ gem 'uglifier', '>= 2.7.2'
13
+ # Use CoffeeScript for .js.coffee assets and views
14
+ gem 'coffee-rails', '~> 4.1.1'
15
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
16
+ # gem 'therubyracer', platforms: :ruby
17
+
18
+ # Use jquery as the JavaScript library
19
+ gem 'jquery-rails'
20
+ # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
21
+ gem 'turbolinks'
22
+ # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
23
+ gem 'jbuilder', '~> 2.4.1'
24
+ # bundle exec rake doc:rails generates the API under doc/api.
25
+ gem 'sdoc', '~> 0.4.1', group: :doc
26
+ # knock dependency
27
+ gem 'knock', '~> 1.4.2'
28
+
29
+ # Dot env
30
+ gem 'dotenv-rails', groups: [:development, :test]
31
+
32
+ # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
33
+ gem 'spring', group: :development
34
+
35
+ gem 'pry', group: [:development, :test]
36
+
37
+ # Use ActiveModel has_secure_password
38
+ # gem 'bcrypt', '~> 3.1.7'
39
+
40
+ # Use unicorn as the app server
41
+ # gem 'unicorn'
42
+
43
+ # Use Capistrano for deployment
44
+ # gem 'capistrano-rails', group: :development
45
+
46
+ # Use debugger
47
+ # gem 'debugger', group: [:development, :test]
48
+ gem 'tzinfo-data'
@@ -0,0 +1,27 @@
1
+ #Auth0 + Ruby on Rails API Seed
2
+
3
+ This is the seed project you need to use if you're going to create a Ruby on Rails API. You'll mostly use this API either for a SPA or a Mobile app. If you just want to create a Regular Ruby on Rails WebApp, please check this [other seed project](https://github.com/auth0/omniauth-auth0)
4
+
5
+ This example is deployed at Heroku at http://auth0-rorapi-sample.herokuapp.com/ping
6
+
7
+ #Running the example
8
+
9
+ In order to run the example you need to have ruby installed.
10
+
11
+ You also need to set the ClientSecret and ClientId for your Auth0 app as enviroment variables with the following names respectively: AUTH0_CLIENT_SECRET and AUTH0_CLIENT_ID.
12
+
13
+ For that, if you just create a file named .env in the directory and set the values like the following, the app will just work:
14
+
15
+ ````bash
16
+ # .env file
17
+ AUTH0_CLIENT_SECRET=myCoolSecret
18
+ AUTH0_CLIENT_ID=myCoolClientId
19
+ ````
20
+
21
+ Once you've set those 2 enviroment variables, run `bundle install`, then run `rails s` and try calling [http://localhost:3000/ping](http://localhost:3000/ping)
22
+
23
+ You can then try to do a GET to [http://localhost:3000/secured/ping](http://localhost:3000/secured/ping) which will throw an error if you don't send the JWT in the header.
24
+
25
+ __Note:__ if you need to enable cross-origin resource sharing, check out the [rack-cors](https://github.com/cyu/rack-cors) gem.
26
+
27
+ __Note:__ if you are using Windows, add the `tzinfo-data` gem to the gemfile.
@@ -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
+ Rails.application.load_tasks
@@ -0,0 +1,16 @@
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 jquery
14
+ //= require jquery_ujs
15
+ //= require turbolinks
16
+ //= require_tree .
@@ -0,0 +1,15 @@
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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,8 @@
1
+ # Application Controller
2
+ class ApplicationController < ActionController::Base
3
+ include Knock::Authenticable
4
+
5
+ # Prevent CSRF attacks by raising an exception.
6
+ # For APIs, you may want to use :null_session instead.
7
+ protect_from_forgery with: :null_session
8
+ end
@@ -0,0 +1,6 @@
1
+ # Ping Controller
2
+ class PingController < ApplicationController
3
+ def ping
4
+ render text: "All good. You don't need to be authenticated to call this"
5
+ end
6
+ end
@@ -0,0 +1,11 @@
1
+ # Secured ping Controller
2
+ class SecuredPingController < ApplicationController
3
+ before_action :authenticate
4
+
5
+ def ping
6
+ render json: {
7
+ message: "All good. You only get this message if you're authenticated.",
8
+ user: @current_user
9
+ }
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ # Application Helper
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Auth0RorapiSample</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
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.exe
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.exe
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.exe
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby.exe
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts '== Installing dependencies =='
12
+ system 'gem install bundler --conservative'
13
+ system 'bundle check || bundle install'
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system 'bin/rake db:setup'
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system 'rm -f log/*'
25
+ system 'rm -rf tmp/cache'
26
+
27
+ puts "\n== Restarting application server =="
28
+ system 'touch tmp/restart.txt'
29
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(*Rails.groups)
8
+
9
+ module Auth0RorapiSample
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
+ # config.time_zone = 'Central Time (US & Canada)'
18
+
19
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
+ # config.i18n.default_locale = :de
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,27 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ adapter: postgresql
25
+ database: my_database_production
26
+ pool: 5
27
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,37 @@
1
+ Rails.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
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Adds additional error checking when serving assets at runtime.
31
+ # Checks for improperly declared sprockets dependencies.
32
+ # Raises helpful error messages.
33
+ config.assets.raise_runtime_errors = true
34
+
35
+ # Raises error for missing translations
36
+ # config.action_view.raise_on_missing_translations = true
37
+ end
@@ -0,0 +1,83 @@
1
+ Rails.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 threaded 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_files = 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 cannot 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
+ # Do not dump schema after migrations.
82
+ config.active_record.dump_schema_after_migration = false
83
+ end
@@ -0,0 +1,41 @@
1
+ Rails.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_files = 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
+ # Raises error for missing translations
38
+ # config.action_view.raise_on_missing_translations = true
39
+
40
+ config.active_support.test_order = :sorted
41
+ end