Class: PoliteFileTask

Inherits:
Rake::FileTask
  • Object
show all
Defined in:
lib/rakegen/polite_file.rb

Instance Method Summary collapse

Instance Method Details

#confirm?Boolean

Returns:

  • (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.

Returns:

  • (Boolean)


4
5
6
7
# File 'lib/rakegen/polite_file.rb', line 4

def needed?
  return true unless File.exist?(name)
  return confirm?
end