lib/rake/data/dsl.rb
# Make a rule that transforms the data from the source directory
# into the data directory
#
# example:
# data_rule ".csv", ".wikipedia.html", block
# will generate "processed/table.csv" from the file "source/table.wikipedia.html"
#
Make a rule that transforms the data from the source directory
into the data directory


Make a rule that transforms the data from the source directory into the data directory
def data_rule( dest_ext, source_ext, &block )
      renaming = lambda do |x|
        x.sub( /^processed/, 'source' ).sub( /#{dest_ext}$/, source_ext )
      end
      rule dest_ext => renaming do |dest|
        yield dest
      end
    end
def data_rule ( dest_ext , source_ext , & block ) renaming = lambda do | x | x . sub ( / ^processed / , 'source' ) . sub ( / #{ dest_ext } $ / , source_ext ) end rule dest_ext => renaming do | dest | yield dest end end
Make a rule that transforms the data from the source directory
into the data directory
Make a rule that transforms the data from the source directory into the data directory
dest_ext
source_ext
block