Closed edusantana closed 4 years ago
this is my way to provide this feature #45
I woukd also update the README with:
Guardfile
To make some useful code, you must define rake tasks with file dependencies. To make it easy to test, put this code inside your Rakefile:
Rakefile
files = Rake::FileList.new('*.md') desc "Create a book" task 'book' => files do sh "cat #{files.join(" ")} > book.txt" end
Now you are ready to use. Put this inside your Rakefile:
require "guard/rake/task" Guard::Rake::Task.new
Or, your may want to watch Rakefile as well:
Guard::Rake::Task.new do |t| t.watch_rakefile = true end
You may define your own ERB template:
Guard::Rake::Task.new('guard') do |t| t.template=File.read('Guardfile.erb') end
NOTE: You will have to provide you own Guardfile.erb for the above code to work.
Guardfile.erb
All these code will create a task that can be run with:
rake guard
Examples:
rake guard rake guard GUARDFILE=Guardfile2.rb # output to differente file
@rubyist please, have a look in this code and this pull request.
:+1: Would you want to update the README with your suggestions and I'll merge it in? Thanks!
See #47 instead.
this is my way to provide this feature #45
I woukd also update the README with:
Creating a rake task to generate a
Guardfile
To make some useful code, you must define rake tasks with file dependencies. To make it easy to test, put this code inside your
Rakefile
:Now you are ready to use. Put this inside your
Rakefile
:Or, your may want to watch
Rakefile
as well:You may define your own ERB template:
NOTE: You will have to provide you own
Guardfile.erb
for the above code to work.All these code will create a task that can be run with:
Examples: