diff options
author | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-11 07:44:27 -0300 |
---|---|---|
committer | Willian Gustavo Veiga <beberveiga@gmail.com> | 2018-10-11 07:44:27 -0300 |
commit | 99bd626885b72acd44861727918ee107a649e2b4 (patch) | |
tree | 6d59fcdb226a65d9eb63f8bad2b2df7b09b92a60 /railties/lib | |
parent | 4b60e34f58c0dabe18a793038fc7775d044016f6 (diff) | |
parent | 6a278c6e9a05b0d901e482458cfc2e3df587d522 (diff) | |
download | rails-99bd626885b72acd44861727918ee107a649e2b4.tar.gz rails-99bd626885b72acd44861727918ee107a649e2b4.tar.bz2 rails-99bd626885b72acd44861727918ee107a649e2b4.zip |
Merge branch 'master' into feature/reselect-method
Diffstat (limited to 'railties/lib')
10 files changed, 22 insertions, 21 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 901934826b..6a13a84108 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -403,12 +403,6 @@ module Rails define_method(:railtie_helpers_paths) { railtie.helpers_paths } end - unless mod.respond_to?(:railtie_include_helpers) - define_method(:railtie_include_helpers) { |klass, include_path_helpers| - railtie.routes.include_helpers(klass, include_path_helpers) - } - end - unless mod.respond_to?(:railtie_routes_url_helpers) define_method(:railtie_routes_url_helpers) { |include_path_helpers = true| railtie.routes.url_helpers(include_path_helpers) } end @@ -479,13 +473,9 @@ module Rails # files inside eager_load paths. def eager_load! config.eager_load_paths.each do |load_path| - if File.file?(load_path) - require_dependency load_path - else - matcher = /\A#{Regexp.escape(load_path.to_s)}\/(.*)\.rb\Z/ - Dir.glob("#{load_path}/**/*.rb").sort.each do |file| - require_dependency file.sub(matcher, '\1') - end + matcher = /\A#{Regexp.escape(load_path.to_s)}\/(.*)\.rb\Z/ + Dir.glob("#{load_path}/**/*.rb").sort.each do |file| + require_dependency file.sub(matcher, '\1') end end end diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb index 7595272c03..6bf0406b21 100644 --- a/railties/lib/rails/engine/configuration.rb +++ b/railties/lib/rails/engine/configuration.rb @@ -38,7 +38,6 @@ module Rails @paths ||= begin paths = Rails::Paths::Root.new(@root) - paths.add "config/routes.rb", eager_load: true paths.add "app", eager_load: true, glob: "{*,*/concerns}" paths.add "app/assets", glob: "*" paths.add "app/controllers", eager_load: true @@ -56,6 +55,7 @@ module Rails paths.add "config/environments", glob: "#{Rails.env}.rb" paths.add "config/initializers", glob: "**/*.rb" paths.add "config/locales", glob: "*.{rb,yml}" + paths.add "config/routes.rb" paths.add "db" paths.add "db/migrate" diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 410e53b4c0..2e4797e5bb 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -399,6 +399,10 @@ module Rails !options[:skip_spring] && !options.dev? && Process.respond_to?(:fork) && !RUBY_PLATFORM.include?("cygwin") end + def webpack_install? + !(options[:skip_javascript] || options[:skip_webpack_install]) + end + def depends_on_system_test? !(options[:skip_system_test] || options[:skip_test] || options[:api]) end @@ -420,7 +424,7 @@ module Rails end def run_webpack - unless options[:skip_javascript] + if webpack_install? rails_command "webpacker:install" rails_command "webpacker:install:#{options[:webpack]}" if options[:webpack] && options[:webpack] != "webpack" end diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index cefaffcb20..b118ea989b 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -261,6 +261,9 @@ module Rails class_option :webpack, type: :string, default: nil, desc: "Preconfigure Webpack with a particular framework (options: #{WEBPACKS.join('/')})" + class_option :skip_webpack_install, type: :boolean, default: false, + desc: "Don't run Webpack install" + def initialize(*args) super diff --git a/railties/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb.tt b/railties/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb.tt index a009ace51c..d394c3d106 100644 --- a/railties/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb.tt @@ -1,2 +1,7 @@ class ApplicationJob < ActiveJob::Base + # Automatically retry jobs that encountered a deadlock + # retry_on ActiveRecord::Deadlocked + + # Most jobs are safe to ignore if the underlying records are no longer available + # discard_on ActiveJob::DeserializationError end diff --git a/railties/lib/rails/generators/rails/app/templates/bin/setup.tt b/railties/lib/rails/generators/rails/app/templates/bin/setup.tt index 233b5a1d95..955a424878 100644 --- a/railties/lib/rails/generators/rails/app/templates/bin/setup.tt +++ b/railties/lib/rails/generators/rails/app/templates/bin/setup.tt @@ -1,5 +1,4 @@ require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -8,7 +7,7 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do +FileUtils.chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file. diff --git a/railties/lib/rails/generators/rails/app/templates/bin/update.tt b/railties/lib/rails/generators/rails/app/templates/bin/update.tt index 99c2430bc6..ed17959e1d 100644 --- a/railties/lib/rails/generators/rails/app/templates/bin/update.tt +++ b/railties/lib/rails/generators/rails/app/templates/bin/update.tt @@ -1,5 +1,4 @@ require 'fileutils' -include FileUtils # path to your application root. APP_ROOT = File.expand_path('..', __dir__) @@ -8,7 +7,7 @@ def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") end -chdir APP_ROOT do +FileUtils.chdir APP_ROOT do # This script is a way to update your development environment automatically. # Add necessary update steps to this file. diff --git a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb index 9ec0ccbe7a..a018a98c53 100644 --- a/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +++ b/railties/lib/rails/generators/rails/plugin/plugin_generator.rb @@ -98,6 +98,7 @@ task default: :test opts[:skip_listen] = true opts[:skip_git] = true opts[:skip_turbolinks] = true + opts[:skip_webpack_install] = true opts[:dummy_app] = true invoke Rails::Generators::AppGenerator, diff --git a/railties/lib/rails/generators/testing/behaviour.rb b/railties/lib/rails/generators/testing/behaviour.rb index 238ffdd677..ec29ad12ba 100644 --- a/railties/lib/rails/generators/testing/behaviour.rb +++ b/railties/lib/rails/generators/testing/behaviour.rb @@ -68,7 +68,7 @@ module Rails capture(:stdout) do args += ["--skip-bundle"] unless args.include? "--dev" args |= ["--skip-bootsnap"] unless args.include? "--no-skip-bootsnap" - args |= ["--skip-javascript"] unless args.include? "--no-skip-javascript" + args |= ["--skip-webpack-install"] unless args.include? "--no-skip-webpack-install" generator_class.start(args, config.reverse_merge(destination_root: destination_root)) end diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb index 88dd932370..a67b90e285 100644 --- a/railties/lib/rails/railtie.rb +++ b/railties/lib/rails/railtie.rb @@ -224,7 +224,7 @@ module Rails end def railtie_namespace #:nodoc: - @railtie_namespace ||= self.class.parents.detect { |n| n.respond_to?(:railtie_namespace) } + @railtie_namespace ||= self.class.module_parents.detect { |n| n.respond_to?(:railtie_namespace) } end protected |