Rake::Tilde
Run rake tasks when files change. No changes necessary to your Rakefile,
just prepend your task name with ~ like: $ rake ~build
Installation
Add this line to your application's Gemfile:
gem 'rake-tilde'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rake-tilde
Usage
This gem monkeypatch's Rake to intercept any task that begins with ~. In that case that task is run whenever any files in the project change. This is a basic wrapper around the listen gem.
More interesting things can be done by specifying folders, ignores, etc for tasks:
task :woo do
puts "woo"
end
listen to: :woo, path: "/somewhere-else", opts: { ignore: /\.rb$/ } do |modified, added, removed|
puts "woooooo"
end
Then run it like this:
$ rake ~woo
Rails (or other fancy libraries)
Some libraries really care about the names of the tasks from the
original ARGV string during load. In that case, just prepend require
'rake/tilde'
to your Rakefile before anything else and it will rewrite
all the task names before any other library can see them.
Contributing
- Fork it ( https://github.com/myobie/rake-tilde/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request