lib/caterpillar.rb in caterpillar-0.9.8 vs lib/caterpillar.rb in caterpillar-0.9.15

- old
+ new

@@ -1,26 +1,31 @@ #-- -# (c) Copyright 2008 Mikael Lammentausta +# (c) Copyright 2008,2009 Mikael Lammentausta # See the file LICENSES.txt included with the distribution for # software license details. #++ module Caterpillar - VERSION='0.9.8' + VERSION='0.9.15' end this_file = File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__ this_dir = File.dirname(File.expand_path(this_file)) -CATERPILLAR_LIBS=this_dir +CATERPILLAR_LIBS=this_dir unless defined?(CATERPILLAR_LIBS) require 'find' # include all ruby files Find.find(this_dir) do |file| if FileTest.directory?(file) if File.basename(file) == 'deprecated' Find.prune # Don't look any further into this directory. + + # load helpers only in Rails environment + elsif (!defined?(RAILS_ENV) and (File.basename(file) == 'helpers')) + Find.prune + else next end else # do not require this file twice