module Packaging::Tasks

Public Class Methods

load_tasks(params = {}) click to toggle source

load webservice *.rake files, exclude/include list can be specified

# File lib/packaging/tasks.rb, line 25
def load_tasks(params = {})
  # a flag - load the tasks just once, multiple loading
  # leads to multiple invocation of the same task
  return if defined? @tasks_loaded
  params[:exclude] ||= []
  params[:include] ||= ["*.rake"]
  filelist = {}

  [:exclude,:include].each do |key|
    filelist[key] = params[key].map {|file| Dir["#{File.dirname(__FILE__)}/../tasks/#{file}"] }
    filelist[key].flatten!
  end

  # load an include file only if it not in the exclude list
  filelist[:include].each do |ext|
    load ext unless filelist[:exclude].include?(ext)
  end

  @tasks_loaded = true
end