Module: TaskExtension

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/rakelib/task_extension.rb

Overview

Instance Method Summary collapse

Instance Method Details

#file(name, *args, &block) ⇒ Object

Extend rake’s file task to be defined only once and to check the expected file is indeed generated

The same as #task, but for #file. In addition this file task raises an error, if the file that is expected to be generated is not present after the block was executed.



9
10
11
12
13
14
15
16
17
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/rakelib/task_extension.rb', line 9

def file(name, *args, &block)
  task_once(name, block) do
    super(name, *args) do |ta|
      block.call(ta).tap do
        raise "file #{ta.name} is missing after task executed" unless File.exist?(ta.name)
      end
    end
  end
end

#task(name, *args, &block) ⇒ Object

Extend rake’s task definition to be defined only once, even if called several times

This allows to define common tasks next to specific tasks. It is expected that any variation of the task’s block is reflected in the task name or namespace. If the task name is identical, the task block is executed only once, even if the file task definition is executed twice.



24
25
26
27
28
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pg-1.4.5/rakelib/task_extension.rb', line 24

def task(name, *args, &block)
  task_once(name, block) do
    super
  end
end