Module: ArLoader
- Defined in:
- lib/ar_loader.rb
Class Method Summary collapse
- .gem_name ⇒ Object
- .gem_version ⇒ Object
- .load_tasks ⇒ Object
- .require_libraries ⇒ Object
- .root_path ⇒ Object
Class Method Details
.gem_name ⇒ Object
37 38 39 |
# File 'lib/ar_loader.rb', line 37 def self.gem_name "ar_loader" end |
.gem_version ⇒ Object
32 33 34 35 |
# File 'lib/ar_loader.rb', line 32 def self.gem_version @gem_version ||= File.read( File.join( root_path, 'lib', 'VERSION') ).chomp @gem_version end |
.load_tasks ⇒ Object
78 79 80 81 82 83 |
# File 'lib/ar_loader.rb', line 78 def self.load_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 |
.require_libraries ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ar_loader.rb', line 46 def self.require_libraries loader_libs = %w{ lib } # Base search paths - these will be searched recursively 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{ ar_loader loaders helpers } require_libs.each do |base| Dir[File.join('lib', base, '*.rb')].each do |rb| unless File.directory? rb require rb end end end end |
.root_path ⇒ Object
41 42 43 |
# File 'lib/ar_loader.rb', line 41 def self.root_path File.("#{File.dirname(__FILE__)}/..") end |