Module: Packaging::Tasks

Defined in:
lib/packaging/tasks.rb

Class Method Summary collapse

Class Method Details

.load_tasks(params = {}) ⇒ Object

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


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 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