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.


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

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


26
27
28
29
30
# File 'lib/vex/boot.rb', line 26

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

.versionObject


4
5
6
# File 'lib/vex/boot.rb', line 4

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