module Rake
def add_rakelib(*files)
def add_rakelib(*files) application.options.rakelib ||= [] files.each do |file| application.options.rakelib << file end end
def application
def application @application ||= Rake::Application.new end
def application=(app)
def application=(app) @application = app end
def each_dir_parent(dir) # :nodoc:
Yield each file or directory component.
def each_dir_parent(dir) # :nodoc: old_length = nil while dir != '.' && dir.length != old_length yield(dir) old_length = dir.length dir = File.dirname(dir) end end
def glob(pattern, *args)
should be prefered to Dir[pattern] and Dir.glob[pattern] because
Get a sorted list of files matching the pattern. This method
def glob(pattern, *args) Dir.glob(pattern, *args).sort end
def load_rakefile(path)
def load_rakefile(path) load(path) end
def original_dir
def original_dir application.original_dir end
def run_tests(pattern='test/test*.rb', log_enabled=false)
def run_tests(pattern='test/test*.rb', log_enabled=false) Rake.glob(pattern).each { |fn| $stderr.puts fn if log_enabled begin require fn rescue Exception => ex $stderr.puts "Error in #{fn}: #{ex.message}" $stderr.puts ex.backtrace assert false end } end