Sha256: 6e5ab850569628b7a60eab8f0f7a54749c2c6e851a4420cca60e9ee7715c25d6
Contents?: true
Size: 856 Bytes
Versions: 79
Compression:
Stored size: 856 Bytes
Contents
module TaskExtension def file(name, *args, &block) task_once(name, block) do super(name, *args) do |ta| block&.call(ta).tap do unless File.exist?(ta.name) then raise("file #{ta.name} is missing after task executed") end end end end end def task(name, *args, &block) task_once(name, block) { super } end private(def task_once(name, block) name = name.keys.first if name.is_a?(Hash) if block and (Rake::Task.task_defined?(name) and (Rake::Task[name].instance_variable_get("@task_block_location") == block.source_location)) then Rake::Task[name] else if block then yield.tap do Rake::Task[name].instance_variable_set("@task_block_location", block.source_location) end else yield end end end) end
Version data entries
79 entries across 79 versions & 1 rubygems