Sha256: 8529e340dd80bf9eeb3ebdddd5fe6371f72b8e49d495f4f789a531b4165e81ea

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

module Vex
  ROOT=File.expand_path "#{File.dirname(__FILE__)}/../vex"
  
  def self.version
    @version ||= File.read("#{ROOT}/../../VERSION")
  end

  #
  # 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.
  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

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

Vex.load_directory "../../config"
Vex.load_directory "boot"

module Vex::Etest
  def test_version
    assert_not_nil(Vex.version)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vex-0.2.8 lib/vex/boot.rb
vex-0.2.7 lib/vex/boot.rb
vex-0.2.6 lib/vex/boot.rb
vex-0.2.5 lib/vex/boot.rb
vex-0.2.2 lib/vex/boot.rb
vex-0.2.1 lib/vex/boot.rb
vex-0.2 lib/vex/boot.rb