Class: Origen::Application::RakeLoader

Inherits:
Object
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/origen/application.rb

Overview

A simple class to load all rake tasks available to an application, a class is used here to avoid collision with the Rake namespace method

Instance Method Summary collapse

Instance Method Details

#load_tasksObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/origen/application.rb', line 108

def load_tasks
  $VERBOSE = nil # Don't care about world writable dir warnings and the like
  require 'colored'

  # Load all Origen tasks first
  Dir.glob("#{Origen.top}/lib/tasks/*.rake").sort.each do |file|
    load file
  end
  # Now the application's own tasks
  if Origen.app.origen_core?
    Dir.glob("#{Origen.root}/lib/tasks/private/*.rake").sort.each do |file|
      load file
    end
  else
    # New application dir structure support
    Dir.glob("#{Origen.root}/app/lib/tasks/*.rake").sort.each do |file|
      load file
    end

    Dir.glob("#{Origen.root}/lib/tasks/*.rake").sort.each do |file|
      load file
    end
  end
  # Finally those that the plugin's have given us
  ([Origen.app] + Origen.app.plugins).each do |plugin|
    namespace plugin.name do
      # New application dir structure support
      Dir.glob("#{plugin.root}/app/lib/tasks/shared/*.rake").sort.each do |file|
        load file
      end

      Dir.glob("#{plugin.root}/lib/tasks/shared/*.rake").sort.each do |file|
        load file
      end
    end
  end
end