railties 4.2.11.3 → 5.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +262 -206
- data/MIT-LICENSE +20 -0
- data/README.rdoc +1 -1
- data/{bin → exe}/rails +0 -0
- data/lib/rails.rb +19 -1
- data/lib/rails/all.rb +10 -9
- data/lib/rails/api/task.rb +7 -14
- data/lib/rails/{app_rails_loader.rb → app_loader.rb} +4 -3
- data/lib/rails/application.rb +31 -41
- data/lib/rails/application/bootstrap.rb +1 -14
- data/lib/rails/application/configuration.rb +94 -95
- data/lib/rails/application/default_middleware_stack.rb +30 -16
- data/lib/rails/application/finisher.rb +11 -2
- data/lib/rails/application/routes_reloader.rb +1 -3
- data/lib/rails/application_controller.rb +1 -1
- data/lib/rails/cli.rb +2 -2
- data/lib/rails/code_statistics.rb +6 -8
- data/lib/rails/code_statistics_calculator.rb +8 -1
- data/lib/rails/command.rb +70 -0
- data/lib/rails/commands.rb +5 -3
- data/lib/rails/commands/commands_tasks.rb +25 -14
- data/lib/rails/commands/console.rb +7 -52
- data/lib/rails/commands/console_helper.rb +34 -0
- data/lib/rails/commands/dbconsole.rb +59 -78
- data/lib/rails/commands/dev_cache.rb +21 -0
- data/lib/rails/commands/plugin.rb +1 -1
- data/lib/rails/commands/rake_proxy.rb +34 -0
- data/lib/rails/commands/runner.rb +0 -1
- data/lib/rails/commands/server.rb +29 -36
- data/lib/rails/commands/test.rb +9 -0
- data/lib/rails/configuration.rb +21 -5
- data/lib/rails/console/app.rb +5 -0
- data/lib/rails/console/helpers.rb +1 -1
- data/lib/rails/engine.rb +68 -58
- data/lib/rails/engine/commands.rb +4 -2
- data/lib/rails/engine/configuration.rb +4 -10
- data/lib/rails/gem_version.rb +4 -4
- data/lib/rails/generators.rb +30 -7
- data/lib/rails/generators/.named_base.rb.swp +0 -0
- data/lib/rails/generators/actions.rb +19 -5
- data/lib/rails/generators/app_base.rb +65 -45
- data/lib/rails/generators/base.rb +6 -6
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +5 -8
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +9 -7
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +1 -1
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb +2 -2
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb +1 -1
- data/lib/rails/generators/generated_attribute.rb +5 -1
- data/lib/rails/generators/migration.rb +7 -7
- data/lib/rails/generators/named_base.rb +21 -5
- data/lib/rails/generators/rails/app/USAGE +0 -1
- data/lib/rails/generators/rails/app/app_generator.rb +75 -11
- data/lib/rails/generators/rails/app/templates/Gemfile +17 -13
- data/lib/rails/generators/rails/app/templates/{README.rdoc → README.md} +1 -5
- data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +7 -0
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/cable.coffee +11 -0
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +3 -3
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/channel.rb +5 -0
- data/lib/rails/generators/rails/app/templates/app/channels/application_cable/connection.rb +5 -0
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +3 -1
- data/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb +2 -0
- data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb +4 -0
- data/lib/rails/generators/rails/app/templates/app/models/application_record.rb +3 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +20 -17
- data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +13 -0
- data/lib/rails/generators/{erb/mailer/templates/layout.text.erb → rails/app/templates/app/views/layouts/mailer.text.erb.tt} +0 -0
- data/lib/rails/generators/rails/app/templates/bin/setup +17 -12
- data/lib/rails/generators/rails/app/templates/bin/update +28 -0
- data/lib/rails/generators/rails/app/templates/config.ru.tt +11 -0
- data/lib/rails/generators/rails/app/templates/config/application.rb +9 -14
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +2 -2
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +20 -3
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +18 -11
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +7 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/active_record_belongs_to_required_by_default.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb +6 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/callback_terminator.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb +1 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb +16 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/request_forgery_protection.rb +4 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/redis/cable.yml +9 -0
- data/lib/rails/generators/rails/app/templates/config/routes.rb +3 -53
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +3 -3
- data/lib/rails/generators/rails/app/templates/gitignore +7 -1
- data/lib/rails/generators/rails/controller/controller_generator.rb +6 -4
- data/lib/rails/generators/rails/migration/migration_generator.rb +1 -1
- data/lib/rails/generators/rails/model/USAGE +6 -1
- data/lib/rails/generators/rails/model/model_generator.rb +1 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +88 -35
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec +6 -9
- data/lib/rails/generators/rails/plugin/templates/Gemfile +3 -7
- data/lib/rails/generators/rails/plugin/templates/README.md +3 -0
- data/lib/rails/generators/rails/plugin/templates/Rakefile +2 -2
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +5 -0
- data/lib/rails/generators/rails/plugin/templates/app/helpers/%namespaced_name%/application_helper.rb.tt +5 -0
- data/lib/rails/generators/rails/plugin/templates/app/jobs/%namespaced_name%/application_job.rb.tt +5 -0
- data/lib/rails/generators/rails/plugin/templates/app/models/application_record.rb.tt +6 -0
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +14 -0
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/bin/test.tt +8 -0
- data/lib/rails/generators/rails/plugin/templates/config/routes.rb +1 -1
- data/lib/rails/generators/rails/plugin/templates/gitignore +2 -3
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb +5 -0
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb +7 -0
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb +1 -0
- data/lib/rails/generators/rails/plugin/templates/lib/tasks/{%name%_tasks.rake → %namespaced_name%_tasks.rake} +1 -1
- data/lib/rails/generators/rails/plugin/templates/rails/application.rb +3 -3
- data/lib/rails/generators/rails/plugin/templates/rails/dummy_manifest.js +11 -0
- data/lib/rails/generators/rails/plugin/templates/rails/engine_manifest.js +6 -0
- data/lib/rails/generators/rails/plugin/templates/rails/javascripts.js +1 -1
- data/lib/rails/generators/rails/plugin/templates/rails/routes.rb +1 -2
- data/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +3 -3
- data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb +7 -0
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +4 -2
- data/lib/rails/generators/rails/resource/resource_generator.rb +0 -1
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +0 -1
- data/lib/rails/generators/rails/scaffold/USAGE +1 -1
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -1
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +35 -7
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +4 -1
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb +61 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +1 -1
- data/lib/rails/generators/resource_helpers.rb +3 -3
- data/lib/rails/generators/test_unit/controller/templates/.functional_test.rb.swp +0 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +3 -5
- data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +8 -3
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +2 -2
- data/lib/rails/generators/test_unit/mailer/templates/preview.rb +4 -4
- data/lib/rails/generators/test_unit/model/model_generator.rb +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml +2 -0
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +5 -1
- data/lib/rails/generators/test_unit/scaffold/templates/.api_functional_test.rb.swp +0 -0
- data/lib/rails/generators/test_unit/scaffold/templates/.functional_test.rb.swp +0 -0
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb +44 -0
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +14 -14
- data/lib/rails/generators/testing/assertions.rb +0 -2
- data/lib/rails/generators/testing/behaviour.rb +4 -17
- data/lib/rails/info.rb +2 -2
- data/lib/rails/info_controller.rb +23 -2
- data/lib/rails/mailers_controller.rb +2 -2
- data/lib/rails/paths.rb +14 -6
- data/lib/rails/rack.rb +1 -3
- data/lib/rails/rack/debugger.rb +2 -23
- data/lib/rails/rack/logger.rb +4 -0
- data/lib/rails/ruby_version_check.rb +3 -3
- data/lib/rails/source_annotation_extractor.rb +1 -1
- data/lib/rails/tasks.rb +4 -1
- data/lib/rails/tasks/engine.rake +1 -1
- data/lib/rails/tasks/framework.rake +18 -16
- data/lib/rails/tasks/initializers.rake +6 -0
- data/lib/rails/tasks/restart.rake +5 -0
- data/lib/rails/tasks/statistics.rake +5 -6
- data/lib/rails/tasks/tmp.rake +4 -12
- data/lib/rails/templates/rails/mailers/email.html.erb +17 -3
- data/lib/rails/templates/rails/welcome/index.html.erb +10 -3
- data/lib/rails/test_help.rb +7 -8
- data/lib/rails/test_unit/minitest_plugin.rb +91 -0
- data/lib/rails/test_unit/reporter.rb +74 -0
- data/lib/rails/test_unit/test_requirer.rb +28 -0
- data/lib/rails/test_unit/testing.rake +18 -39
- metadata +80 -33
- data/lib/rails/deprecation.rb +0 -19
- data/lib/rails/generators/erb/mailer/templates/layout.html.erb +0 -5
- data/lib/rails/generators/rails/app/templates/config.ru +0 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/to_time_preserves_timezone.rb +0 -10
- data/lib/rails/generators/rails/plugin/templates/README.rdoc +0 -3
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%name%/application_controller.rb.tt +0 -5
- data/lib/rails/generators/rails/plugin/templates/app/helpers/%name%/application_helper.rb.tt +0 -4
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%name%/application.html.erb.tt +0 -14
- data/lib/rails/generators/rails/plugin/templates/lib/%name%.rb +0 -6
- data/lib/rails/generators/rails/plugin/templates/lib/%name%/engine.rb +0 -7
- data/lib/rails/generators/rails/plugin/templates/lib/%name%/version.rb +0 -3
- data/lib/rails/generators/rails/plugin/templates/test/%name%_test.rb +0 -7
- data/lib/rails/rack/log_tailer.rb +0 -38
- data/lib/rails/tasks/documentation.rake +0 -70
- data/lib/rails/test_unit/sub_test_task.rb +0 -126
File without changes
|
@@ -1,28 +1,33 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils
|
2
4
|
|
3
5
|
# path to your application root.
|
4
|
-
APP_ROOT = Pathname.new File.expand_path('../../',
|
6
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
5
7
|
|
6
|
-
|
8
|
+
def system!(*args)
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
10
|
+
end
|
11
|
+
|
12
|
+
chdir APP_ROOT do
|
7
13
|
# This script is a starting point to setup your application.
|
8
|
-
# Add necessary setup steps to this file
|
14
|
+
# Add necessary setup steps to this file.
|
9
15
|
|
10
|
-
puts
|
11
|
-
system
|
12
|
-
system
|
16
|
+
puts '== Installing dependencies =='
|
17
|
+
system! 'gem install bundler --conservative'
|
18
|
+
system('bundle check') or system!('bundle install')
|
13
19
|
|
14
20
|
# puts "\n== Copying sample files =="
|
15
|
-
# unless File.exist?(
|
16
|
-
#
|
21
|
+
# unless File.exist?('config/database.yml')
|
22
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
17
23
|
# end
|
18
24
|
|
19
25
|
puts "\n== Preparing database =="
|
20
|
-
system
|
26
|
+
system! 'bin/rails db:setup'
|
21
27
|
|
22
28
|
puts "\n== Removing old logs and tempfiles =="
|
23
|
-
system
|
24
|
-
system "rm -rf tmp/cache"
|
29
|
+
system! 'bin/rails log:clear tmp:clear'
|
25
30
|
|
26
31
|
puts "\n== Restarting application server =="
|
27
|
-
system
|
32
|
+
system! 'bin/rails restart'
|
28
33
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'fileutils'
|
3
|
+
include FileUtils
|
4
|
+
|
5
|
+
# path to your application root.
|
6
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
7
|
+
|
8
|
+
def system!(*args)
|
9
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
10
|
+
end
|
11
|
+
|
12
|
+
chdir APP_ROOT do
|
13
|
+
# This script is a way to update your development environment automatically.
|
14
|
+
# Add necessary update steps to this file.
|
15
|
+
|
16
|
+
puts '== Installing dependencies =='
|
17
|
+
system! 'gem install bundler --conservative'
|
18
|
+
system 'bundle check' or system! 'bundle install'
|
19
|
+
|
20
|
+
puts "\n== Updating database =="
|
21
|
+
system! 'bin/rails db:migrate'
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system! 'bin/rails log:clear tmp:clear'
|
25
|
+
|
26
|
+
puts "\n== Restarting application server =="
|
27
|
+
system! 'bin/rails restart'
|
28
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# This file is used by Rack-based servers to start the application.
|
2
|
+
|
3
|
+
require ::File.expand_path('../config/environment', __FILE__)
|
4
|
+
|
5
|
+
<%- unless options[:skip_action_cable] -%>
|
6
|
+
# Action Cable uses EventMachine which requires that all classes are loaded in advance
|
7
|
+
Rails.application.eager_load!
|
8
|
+
require 'action_cable/process/logging'
|
9
|
+
<%- end -%>
|
10
|
+
|
11
|
+
run Rails.application
|
@@ -9,10 +9,11 @@ require "active_model/railtie"
|
|
9
9
|
require "active_job/railtie"
|
10
10
|
<%= comment_if :skip_active_record %>require "active_record/railtie"
|
11
11
|
require "action_controller/railtie"
|
12
|
-
require "action_mailer/railtie"
|
12
|
+
<%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
|
13
13
|
require "action_view/railtie"
|
14
|
+
<%= comment_if :skip_action_cable %>require "action_cable/engine"
|
14
15
|
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
|
15
|
-
<%= comment_if :
|
16
|
+
<%= comment_if :skip_test %>require "rails/test_unit/railtie"
|
16
17
|
<% end -%>
|
17
18
|
|
18
19
|
# Require the gems listed in Gemfile, including any gems
|
@@ -24,18 +25,12 @@ module <%= app_const_base %>
|
|
24
25
|
# Settings in config/environments/* take precedence over those specified here.
|
25
26
|
# Application configuration should go into files in config/initializers
|
26
27
|
# -- all .rb files in that directory are automatically loaded.
|
28
|
+
<%- if options[:api] -%>
|
27
29
|
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
|
32
|
-
|
33
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
34
|
-
# config.i18n.default_locale = :de
|
35
|
-
<%- unless options.skip_active_record? -%>
|
36
|
-
|
37
|
-
# Do not swallow errors in after_commit/after_rollback callbacks.
|
38
|
-
config.active_record.raise_in_transactional_callbacks = true
|
39
|
-
<%- end -%>
|
30
|
+
# Only loads a smaller set of middleware suitable for API only apps.
|
31
|
+
# Middleware like session, flash, cookies can be added back manually.
|
32
|
+
# Skip views, helpers and assets when generating a new resource.
|
33
|
+
config.api_only = true
|
34
|
+
<%- end -%>
|
40
35
|
end
|
41
36
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# MySQL. Versions 5.0+ are recommended.
|
2
2
|
#
|
3
|
-
# Install the
|
3
|
+
# Install the MySQL driver
|
4
4
|
# gem install mysql2
|
5
5
|
#
|
6
6
|
# Ensure the MySQL gem is defined in your Gemfile
|
7
7
|
# gem 'mysql2'
|
8
8
|
#
|
9
9
|
# And be sure to use new-style password hashing:
|
10
|
-
# http://dev.mysql.com/doc/refman/5.
|
10
|
+
# http://dev.mysql.com/doc/refman/5.7/en/old-client.html
|
11
11
|
#
|
12
12
|
default: &default
|
13
13
|
adapter: mysql2
|
@@ -9,12 +9,25 @@ Rails.application.configure do
|
|
9
9
|
# Do not eager load code on boot.
|
10
10
|
config.eager_load = false
|
11
11
|
|
12
|
-
# Show full error reports
|
13
|
-
config.consider_all_requests_local
|
14
|
-
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
17
|
+
config.action_controller.perform_caching = true
|
18
|
+
config.cache_store = :memory_store
|
19
|
+
config.public_file_server.headers = {
|
20
|
+
'Cache-Control' => 'public, max-age=172800'
|
21
|
+
}
|
22
|
+
else
|
23
|
+
config.action_controller.perform_caching = false
|
24
|
+
config.cache_store = :null_store
|
25
|
+
end
|
26
|
+
<%- unless options.skip_action_mailer? -%>
|
15
27
|
|
16
28
|
# Don't care if the mailer can't send.
|
17
29
|
config.action_mailer.raise_delivery_errors = false
|
30
|
+
<%- end -%>
|
18
31
|
|
19
32
|
# Print deprecation notices to the Rails logger.
|
20
33
|
config.active_support.deprecation = :log
|
@@ -42,4 +55,8 @@ Rails.application.configure do
|
|
42
55
|
|
43
56
|
# Raises error for missing translations
|
44
57
|
# config.action_view.raise_on_missing_translations = true
|
58
|
+
|
59
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
60
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
61
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
45
62
|
end
|
@@ -14,15 +14,9 @@ Rails.application.configure do
|
|
14
14
|
config.consider_all_requests_local = false
|
15
15
|
config.action_controller.perform_caching = true
|
16
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
|
20
|
-
# NGINX, varnish or squid.
|
21
|
-
# config.action_dispatch.rack_cache = true
|
22
|
-
|
23
17
|
# Disable serving static files from the `/public` folder by default since
|
24
18
|
# Apache or NGINX already handles this.
|
25
|
-
config.
|
19
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
20
|
|
27
21
|
<%- unless options.skip_sprockets? -%>
|
28
22
|
# Compress JavaScripts and CSS.
|
@@ -39,10 +33,19 @@ Rails.application.configure do
|
|
39
33
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
40
34
|
<%- end -%>
|
41
35
|
|
36
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
37
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
38
|
+
|
42
39
|
# Specifies the header that your server uses for sending files.
|
43
40
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
44
41
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
45
42
|
|
43
|
+
<%- unless options[:skip_action_cable] -%>
|
44
|
+
# Action Cable endpoint configuration
|
45
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
46
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
47
|
+
<%- end -%>
|
48
|
+
|
46
49
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
47
50
|
# config.force_ssl = true
|
48
51
|
|
@@ -51,20 +54,24 @@ Rails.application.configure do
|
|
51
54
|
config.log_level = :debug
|
52
55
|
|
53
56
|
# Prepend all log lines with the following tags.
|
54
|
-
# config.log_tags = [ :subdomain, :
|
57
|
+
# config.log_tags = [ :subdomain, :request_id ]
|
55
58
|
|
56
59
|
# Use a different logger for distributed setups.
|
57
|
-
#
|
60
|
+
# require 'syslog/logger'
|
61
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
58
62
|
|
59
63
|
# Use a different cache store in production.
|
60
64
|
# config.cache_store = :mem_cache_store
|
61
65
|
|
62
|
-
#
|
63
|
-
# config.
|
66
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
67
|
+
# config.active_job.queue_adapter = :resque
|
68
|
+
# config.active_job.queue_name_prefix = "<%= app_name %>_#{Rails.env}"
|
69
|
+
<%- unless options.skip_action_mailer? -%>
|
64
70
|
|
65
71
|
# Ignore bad email addresses and do not raise email delivery errors.
|
66
72
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
67
73
|
# config.action_mailer.raise_delivery_errors = false
|
74
|
+
<%- end -%>
|
68
75
|
|
69
76
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
70
77
|
# the I18n.default_locale when a translation cannot be found).
|
@@ -12,9 +12,11 @@ Rails.application.configure do
|
|
12
12
|
# preloads Rails for running tests, you may have to set it to true.
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
|
-
# Configure
|
16
|
-
config.
|
17
|
-
config.
|
15
|
+
# Configure public file server for tests with Cache-Control for performance.
|
16
|
+
config.public_file_server.enabled = true
|
17
|
+
config.public_file_server.headers = {
|
18
|
+
'Cache-Control' => 'public, max-age=3600'
|
19
|
+
}
|
18
20
|
|
19
21
|
# Show full error reports and disable caching.
|
20
22
|
config.consider_all_requests_local = true
|
@@ -25,11 +27,13 @@ Rails.application.configure do
|
|
25
27
|
|
26
28
|
# Disable request forgery protection in test environment.
|
27
29
|
config.action_controller.allow_forgery_protection = false
|
30
|
+
<%- unless options.skip_action_mailer? -%>
|
28
31
|
|
29
32
|
# Tell Action Mailer not to deliver emails to the real world.
|
30
33
|
# The :test delivery method accumulates sent emails in the
|
31
34
|
# ActionMailer::Base.deliveries array.
|
32
35
|
config.action_mailer.delivery_method = :test
|
36
|
+
<%- end -%>
|
33
37
|
|
34
38
|
# Randomize the order test cases are executed.
|
35
39
|
config.active_support.test_order = :random
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Require `belongs_to` associations by default. This is a new Rails 5.0 default,
|
4
|
+
# so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading.
|
5
|
+
Rails.application.config.active_record.belongs_to_required_by_default = true
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Do not halt callback chains when a callback returns false. This is a new Rails 5.0 default,
|
4
|
+
# so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading.
|
5
|
+
ActiveSupport.halt_callback_chains_on_return_false = false
|
@@ -1,3 +1,4 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
+
# This is a new Rails 5.0 default, so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading.
|
3
4
|
Rails.application.config.action_dispatch.cookies_serializer = :json
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Avoid CORS issues when API is called from the frontend app.
|
4
|
+
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
|
5
|
+
|
6
|
+
# Read more: https://github.com/cyu/rack-cors
|
7
|
+
|
8
|
+
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
9
|
+
# allow do
|
10
|
+
# origins 'example.com'
|
11
|
+
#
|
12
|
+
# resource '*',
|
13
|
+
# headers: :any,
|
14
|
+
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
15
|
+
# end
|
16
|
+
# end
|
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
7
|
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json]
|
8
|
+
wrap_parameters format: [:json]
|
9
9
|
end
|
10
10
|
<%- unless options.skip_active_record? -%>
|
11
11
|
|
12
12
|
# To enable root element in JSON for ActiveRecord objects.
|
13
13
|
# ActiveSupport.on_load(:active_record) do
|
14
|
-
#
|
14
|
+
# self.include_root_in_json = true
|
15
15
|
# end
|
16
16
|
<%- end -%>
|
@@ -1,56 +1,6 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
#
|
3
|
-
# See how all your routes lay out with "rake routes".
|
2
|
+
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
|
4
3
|
|
5
|
-
#
|
6
|
-
#
|
7
|
-
|
8
|
-
# Example of regular route:
|
9
|
-
# get 'products/:id' => 'catalog#view'
|
10
|
-
|
11
|
-
# Example of named route that can be invoked with purchase_url(id: product.id)
|
12
|
-
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
13
|
-
|
14
|
-
# Example resource route (maps HTTP verbs to controller actions automatically):
|
15
|
-
# resources :products
|
16
|
-
|
17
|
-
# Example resource route with options:
|
18
|
-
# resources :products do
|
19
|
-
# member do
|
20
|
-
# get 'short'
|
21
|
-
# post 'toggle'
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# collection do
|
25
|
-
# get 'sold'
|
26
|
-
# end
|
27
|
-
# end
|
28
|
-
|
29
|
-
# Example resource route with sub-resources:
|
30
|
-
# resources :products do
|
31
|
-
# resources :comments, :sales
|
32
|
-
# resource :seller
|
33
|
-
# end
|
34
|
-
|
35
|
-
# Example resource route with more complex sub-resources:
|
36
|
-
# resources :products do
|
37
|
-
# resources :comments
|
38
|
-
# resources :sales do
|
39
|
-
# get 'recent', on: :collection
|
40
|
-
# end
|
41
|
-
# end
|
42
|
-
|
43
|
-
# Example resource route with concerns:
|
44
|
-
# concern :toggleable do
|
45
|
-
# post 'toggle'
|
46
|
-
# end
|
47
|
-
# resources :posts, concerns: :toggleable
|
48
|
-
# resources :photos, concerns: :toggleable
|
49
|
-
|
50
|
-
# Example resource route within a namespace:
|
51
|
-
# namespace :admin do
|
52
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
53
|
-
# # (app/controllers/admin/products_controller.rb)
|
54
|
-
# resources :products
|
55
|
-
# end
|
4
|
+
# Serve websocket cable requests in-process
|
5
|
+
# mount ActionCable.server => '/cable'
|
56
6
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the
|
2
|
+
# The data can then be loaded with the rails db:seed (or created alongside the db with db:setup).
|
3
3
|
#
|
4
4
|
# Examples:
|
5
5
|
#
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
7
|
+
# Character.create(name: 'Luke', movie: movies.first)
|