Module: ArLoader

Defined in:
lib/ar_loader.rb

Class Method Summary collapse

Class Method Details

.gem_nameObject



17
18
19
# File 'lib/ar_loader.rb', line 17

def self.gem_name
  "ar_loader"
end

.gem_versionObject



12
13
14
15
# File 'lib/ar_loader.rb', line 12

def self.gem_version
  @gem_version ||= File.read( File.join( root_path, 'lib', 'VERSION') ).chomp
  @gem_version
end

.require_librariesObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ar_loader.rb', line 25

def self.require_libraries

  loader_libs = %w{ lib  }

  # Base search paths - these will be searched recursively and any xxx.rake files autoimported
  loader_paths = []

  loader_libs.each {|l| loader_paths << File.join(root_path(), l) }

  # Define require search paths, any dir in here will be added to LOAD_PATH

  loader_paths.each do |base|
    $:.unshift base  if File.directory?(base)
    Dir[File.join(base, '**', '**')].each do |p|
      if File.directory? p
        $:.unshift p
      end
    end
  end

  require__libs = %w{ loaders engine }

  require__libs.each do |base|
    Dir[File.join('lib', base, '*.rb')].each do |rb|
        unless File.directory? rb
          require rb
        end
    end
  end

end

.require_tasksObject



57
58
59
60
61
62
# File 'lib/ar_loader.rb', line 57

def self.require_tasks
  # Long parameter lists so ensure rake -T produces nice wide output
  ENV['RAKE_COLUMNS'] = '180'
  base = File.join(root_path, 'tasks', '**')
  Dir["#{base}/*.rake"].sort.each { |ext| load ext }
end

.root_pathObject



21
22
23
# File 'lib/ar_loader.rb', line 21

def self.root_path
  File.expand_path("#{File.dirname(__FILE__)}/..")
end