Method: Rake::LatherTask#initialize
- Defined in:
- lib/rake/lathertask.rb
#initialize(*globs) {|_self| ... } ⇒ LatherTask
Returns a new instance of LatherTask.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rake/lathertask.rb', line 30 def initialize *globs, &block = Hash === globs.last ? globs.pop : {} @globs = globs @target = .delete(:target) || :test @changed = case @target when Rake::TestTask then handle_rake_test_task else lambda {} end yield self if block_given? @target = Rake::Task[@target] desc "Rinse and repeat" task :lather do watcher = Lather::Watcher.new @globs, do |changed| begin @changed[changed] @target.invoke rescue StandardError => e raise e unless e.to_s =~ /^Command failed/ ensure reenable @target end end watcher.go! end end |