diff options
-rw-r--r-- | activesupport/CHANGELOG.md | 13 | ||||
-rw-r--r-- | guides/source/configuring.md | 2 | ||||
-rw-r--r-- | railties/CHANGELOG.md | 10 | ||||
-rw-r--r-- | railties/lib/rails/application/configuration.rb | 29 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt | 4 |
6 files changed, 31 insertions, 31 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index d946fc1bbd..88558cde1c 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -7,13 +7,18 @@ *Michael Grosser* -* Implements an evented file system monitor to asynchronously detect changes - in the application source code, routes, locales, etc. +* Implements an evented file watcher to asynchronously detect changes in the + application source code, routes, locales, etc. - To opt-in load the [listen](https://github.com/guard/listen) gem in `Gemfile`: + This watcher is disabled by default, applications my enable it in the configuration: + + # config/environments/development.rb + config.file_watcher = ActiveSupport::EventedFileUpdateChecker + + This feature depends on the [listen](https://github.com/guard/listen) gem: group :development do - gem 'listen', '~> 3.0.4' + gem 'listen', '~> 3.0.5' end *Puneet Agarwal* and *Xavier Noria* diff --git a/guides/source/configuring.md b/guides/source/configuring.md index a286a7c5d2..ba2fb4c1cf 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -98,7 +98,7 @@ application. Accepts a valid week day symbol (e.g. `:monday`). * `config.exceptions_app` sets the exceptions application invoked by the ShowException middleware when an exception happens. Defaults to `ActionDispatch::PublicExceptions.new(Rails.public_path)`. -* `config.file_watcher` the class used to detect file updates in the filesystem when `config.reload_classes_only_on_change` is true. Must conform to `ActiveSupport::FileUpdateChecker` API. +* `config.file_watcher` is the class used to detect file updates in the file system when `config.reload_classes_only_on_change` is true. Rails ships with `ActiveSupport::FileUpdateChecker`, the default, and `ActiveSupport::EventedFileUpdateChecker` (this one depends on the [listen](https://github.com/guard/listen) gem). Custom classes must conform to the `ActiveSupport::FileUpdateChecker` API. * `config.filter_parameters` used for filtering out the parameters that you don't want shown in the logs, such as passwords or credit card diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index e5ab31005e..b9d2db773a 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,8 @@ +* The generated config file for the development environment includes a new + config line, commented out, showing how to enable the evented file watcher. + + *Xavier Noria* + * `config.debug_exception_response_format` configures the format used in responses when errors occur in development mode. @@ -38,11 +43,6 @@ *Yuki Nishijima* -* Generated `Gemfile`s for new applications include a new dependency on - [listen](https://github.com/guard/listen) commented out. - - *Puneet Agarwal* and *Xavier Noria* - * Deprecate `serve_static_files` in favor of `public_file_server.enabled`. Unifies the static asset options under `public_file_server`. diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb index a5550df0de..65cff1561a 100644 --- a/railties/lib/rails/application/configuration.rb +++ b/railties/lib/rails/application/configuration.rb @@ -44,7 +44,7 @@ module Rails @railties_order = [:all] @relative_url_root = ENV["RAILS_RELATIVE_URL_ROOT"] @reload_classes_only_on_change = true - @file_watcher = file_update_checker + @file_watcher = ActiveSupport::FileUpdateChecker @exceptions_app = nil @autoflush_log = true @log_formatter = ActiveSupport::Logger::SimpleFormatter.new @@ -191,26 +191,21 @@ module Rails SourceAnnotationExtractor::Annotation end - private - def file_update_checker - ActiveSupport::FileUpdateChecker + class Custom #:nodoc: + def initialize + @configurations = Hash.new end - class Custom #:nodoc: - def initialize - @configurations = Hash.new - end - - def method_missing(method, *args) - if method =~ /=$/ - @configurations[$`.to_sym] = args.first - else - @configurations.fetch(method) { - @configurations[method] = ActiveSupport::OrderedOptions.new - } - end + def method_missing(method, *args) + if method =~ /=$/ + @configurations[$`.to_sym] = args.first + else + @configurations.fetch(method) { + @configurations[method] = ActiveSupport::OrderedOptions.new + } end end + end end end end diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index a0880d5166..975be07622 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -48,10 +48,6 @@ group :development do # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' <% end -%> - - # Loading the listen gem enables an evented file system monitor. Check - # https://github.com/guard/listen#listen-adapters if on Windows or *BSD. - # gem 'listen', '~> 3.0.5' end <% end -%> diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index 2778dd8247..65c6aeb694 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt @@ -55,4 +55,8 @@ Rails.application.configure do # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker end |