Class: Rake::Delphi::LibsTask

Inherits:
Task
  • Object
show all
Defined in:
lib/rake/common/libstask.rb

Instance Attribute Summary collapse

Attributes inherited from Task

#logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Task

#execute_base, #initialize_base, #needed=, #needed?, #out, #reenable_chain, #shortname, #trace?

Constructor Details

#initialize(name, app) ⇒ LibsTask

Returns a new instance of LibsTask.



11
12
13
14
# File 'lib/rake/common/libstask.rb', line 11

def initialize(name, app)
    super
    @original_dir = ENV['RAKE_DIR'] || Rake.original_dir
end

Instance Attribute Details

#libsObject (readonly)

Returns the value of attribute libs.



9
10
11
# File 'lib/rake/common/libstask.rb', line 9

def libs
  @libs
end

Class Method Details

.define(name, app) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/rake/common/libstask.rb', line 16

def self.define(name, app)
    app.tasks.each do |t|
        # if there is a task with a name like a searched one
        return t if t.name.index(name)
    end
    # else - define a new task
    app.define_task(LibsTask, name)
end

Instance Method Details

#execute(args = nil) ⇒ Object



29
30
31
32
33
# File 'lib/rake/common/libstask.rb', line 29

def execute(args = nil)
    super
    mask = @original_dir + '/lib/**/**'
    @libs = LibList.new(mask)
end

#libs_relative(level) ⇒ Object



25
26
27
# File 'lib/rake/common/libstask.rb', line 25

def libs_relative(level)
    @libs.map { |d| d.gsub(@original_dir, '.' + '/..' * level)}
end