Class: PoliteFileTask
- Inherits:
-
Rake::FileTask
- Object
- Rake::FileTask
- PoliteFileTask
- Defined in:
- lib/rakegen/polite_file.rb
Instance Method Summary collapse
- #confirm? ⇒ Boolean
-
#needed? ⇒ Boolean
Is this file task needed? Yes if doesn’t exist or if the user agrees to clobber.
Instance Method Details
#confirm? ⇒ Boolean
9 10 11 |
# File 'lib/rakegen/polite_file.rb', line 9 def confirm? agree("Overwrite '#{name}' ?", false) end |
#needed? ⇒ Boolean
Is this file task needed? Yes if doesn’t exist or if the user agrees to clobber.
4 5 6 7 |
# File 'lib/rakegen/polite_file.rb', line 4 def needed? return true unless File.exist?(name) return confirm? end |