Module: Vex

Defined in:
lib/vex/boot.rb

Defined Under Namespace

Modules: Etest

Constant Summary collapse

ROOT =
File.expand_path "#{File.dirname(__FILE__)}/../vex"

Class Method Summary collapse

Class Method Details

.load_directory(directory) ⇒ Object

load all modules from a specific directory. This loads first all files in or under that directory, sorted alphabetically. Hint: use files __init__.rb for stuff that must be loaded first.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vex/boot.rb', line 15

def self.load_directory(directory)
  # load plugins first
  plugin_dir = "#{ROOT}/#{directory}/plugins"
  Dir.glob("#{plugin_dir}/*").each do |file|
    load_plugin file if File.directory?(file)
  end
  
  (Dir.glob("#{ROOT}/#{directory}/**/*.rb") - [__FILE__]).sort.each do |file|
    next if file[0, plugin_dir.length] == plugin_dir
    load file
  end
end

.load_plugin(directory) ⇒ Object



28
29
30
31
32
# File 'lib/vex/boot.rb', line 28

def self.load_plugin(directory)
  $:.push(directory)
  init_rb = "#{directory}/init.rb"
  require(init_rb) if File.exists?(init_rb)
end

.versionObject



6
7
8
# File 'lib/vex/boot.rb', line 6

def self.version
  @version ||= File.read("#{ROOT}/../../VERSION").gsub(/\s+/, "")
end