Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b894b7b0ce
Fetching contributors…

Cannot retrieve contributors at this time

file 39 lines (34 sloc) 1.101 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
# common initialization between webapp and domain and library and tests

require 'digest/md5'
require 'json'
require 'erector'
Widget = Erector::Widget
require 'ap'
require 'peach'

here = File.expand_path File.dirname(__FILE__)
$root = here

%w{lib web}.each do |dir|
  # add ruby code directories to load path
  path = File.expand_path "#{here}/#{dir}"
  $:<<path
end

# todo: unit test name munging code
def require_in dir_name
# require all in/below $root/dir
files = Dir.chdir("#{$root}/#{dir_name}"){Dir.glob("**/*.rb")}
files.sort.map{|f| f.gsub(/\.rb$/, '')}.each do |feature|
# puts "requiring #{feature}"
require feature
end
# other code -- delete this?
# # alphabetize to correct for inconsistent filesystem load order
# # to be safe, all files should 'require' all their dependencies, which will
# # assure loading in correct (not alphabetical) order, but autoloading is
# # mighty convenient
# Dir.glob("#{dir}/*.rb").sort.each do |f|
# feature = f.gsub(/^#{dir}\//, '').gsub(/\.rb$/, '')
# require feature
# end
# end
#
end
Something went wrong with that request. Please try again.