lib/tryouts.rb in tryouts-0.8.0 vs lib/tryouts.rb in tryouts-0.8.1
- old
+ new
@@ -2,12 +2,15 @@
require 'time'
require 'sysinfo'
require 'digest/sha1'
require 'ostruct'
require 'yaml'
-require 'rye'
+## NOTE: Don't require rye here so
+## we can still run tryouts on the
+## development version.
+
begin; require 'json'; rescue LoadError; end # json may not be installed
GYMNASIUM_HOME = File.join(Dir.pwd, '{tryouts,try}') ## also check try (for rye)
GYMNASIUM_GLOB = File.join(GYMNASIUM_HOME, '**', '*_tryouts.rb')
@@ -40,11 +43,11 @@
vdt = Tryouts::Drill.valid_dtypes
"Tryout '#{@tname}' has no drill type. Should be: #{vdt.join(', ')}"
end
end
- VERSION = "0.8.0"
+ VERSION = "0.8.1"
require 'tryouts/mixins'
require 'tryouts/tryout'
require 'tryouts/drill'
require 'tryouts/stats'
@@ -118,12 +121,12 @@
def run; @tryouts.each_pair { |n,to| to.run }; end
# Add a shell command to Rye::Cmd and save the command name
# in @@commands so it can be used as the default for drills
def command(name=nil, path=nil)
- #raise "command testing is temporarily disabled"
return @command if name.nil?
+ require 'rye'
@command = name.to_sym
@dtype = :cli
Rye::Cmd.module_eval do
define_method(name) do |*args|
cmd(path || name, *args)
@@ -148,11 +151,11 @@
# library __FILE__, '..', 'lib'
#
def library(name=nil, *path)
return @library if name.nil?
@library, @dtype = name.to_sym, :api
- path = File.expand_path(File.join *path)
+ path = File.expand_path(File.join(*path))
$LOAD_PATH.unshift path unless path.nil?
begin
require @library.to_s
rescue LoadError => ex
newex = Tryouts::Exception.new(ex.message)
@@ -302,10 +305,9 @@
def self.run
@@instances.each_pair do |group, inst|
inst.tryouts.each_pair do |name,to|
to.run
to.report
- STDOUT.flush
end
end
end
# Called when a new class inherits from Tryouts. This creates a new instance