Sha256: dc569fc73f9c6f1aca2a71737144fb628a74261b32e62dcb4e73b044dec05a98

Contents?: true

Size: 901 Bytes

Versions: 5

Compression:

Stored size: 901 Bytes

Contents

# encoding: utf-8

require 'rake/common/classes'
require 'rake/delphi/liblist'

module Rake
  module Delphi
    class LibsTask < Rake::Task
        attr_reader :libs

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

        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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rake-delphi-0.0.34 lib/rake/common/libstask.rb
rake-delphi-0.0.33 lib/rake/common/libstask.rb
rake-delphi-0.0.32 lib/rake/common/libstask.rb
rake-delphi-0.0.31 lib/rake/common/libstask.rb
rake-delphi-0.0.30 lib/rake/common/libstask.rb