0.0
No commit activity in last 3 years
No release in over 3 years
Check non-reloadable files changes on Rails apps
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

CheckFiles

Travis-CI Code Climate Test Coverage Gem Gem

Ever forgot to restart the development web server when you change things like Gemfile or config/environments/development.rb? You're not alone. There are a lot of cases to keep in mind:

  • You upgrade and/or remove/add gems to Gemfile.
  • You change environment values (e.g. config/environments/development.rb).
  • You change initializer values.
  • You add/remove directories to/from app.
  • You add/remove files to/from config/locales.
  • You change configuration files living at config/*.yml .

With this gem you don't have to think about it. Every time you change files that require a restart, an exception will be raised and you'll know what you have to do.

Installation

Add this line to your application's Gemfile:

gem "check_files", group: :development

And then execute:

$ bundle

Or install it yourself as:

$ gem install check_files

Usage

You don't have to configure anything but there are some configurable values if you want. The following values are the defaults:

# The list of files/directories that must be checked.
# Patterns ended with /* will just check the entries list (not the content).
config.check_files.paths = [
  "Gemfile.lock",
  "config/initializers/**/*.rb",
  "config/{application,boot,config,environment}.rb",
  "config/*.yml",
  "config/environments/**/*.rb",
  "app/*",
  "config/locales/**/*"
]

# The notifier that will be used. By default it raises an exception on Rails < 5 or restarts the web server (Rails 5+).
# You can use CheckFiles::Notifiers::Exception, CheckFiles::Notifiers::Logging or CheckFiles::Notifiers::Restart (Rails 5+).
config.check_files.notifier = CheckFiles::Notifiers::Exception

To overwrite any of these values, just create the initializer config/initializers/check_files.rb like the following:

Rails.configuration.check_files.notifier = CheckFiles::Notifiers::Logging

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fnando/check_files. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.