lib/dao.rb in dao-3.3.0 vs lib/dao.rb in dao-4.2.1

- old
+ new

@@ -1,28 +1,28 @@ # built-ins # require 'enumerator' require 'set' - #require 'fileutils' - #require 'pathname' - #require 'yaml' - #require 'yaml/store' # dao libs # module Dao - Version = '3.3.0' unless defined?(Version) + Version = '4.2.1' unless defined?(Version) def version Dao::Version end def dependencies { - 'map' => ['map' , '~> 4.2.0'], - 'tagz' => ['tagz' , '~> 9.0.0'], - 'yajl' => ['yajl-ruby' , '~> 0.8.1'] + 'rails' => [ 'rails' , '~> 3.0' ], + 'map' => [ 'map' , '~> 4.4' ], + 'fattr' => [ 'fattr' , '~> 2.2' ], + 'tagz' => [ 'tagz' , '~> 9.0' ], + 'yajl' => [ 'yajl-ruby' , '~> 0.8' ], + 'unidecode' => [ 'unidecode' , '~> 1.0' ], + 'uuidtools' => [ 'uuidtools' , '~> 2.1' ] } end def libdir(*args, &block) @libdir ||= File.expand_path(__FILE__).sub(/\.rb$/,'') @@ -59,40 +59,71 @@ gem(*dependency) require(lib) end end + #active_record + #action_mailer + #rails/test_unit + %w[ + action_controller + active_resource + active_support + ].each do |framework| + begin + require "#{ framework }/railtie" + rescue LoadError + end + end +#require 'rails/all' + + require 'yajl/json_gem' Dao.load %w[ blankslate.rb instance_exec.rb + extractor.rb exceptions.rb support.rb slug.rb stdext.rb + name.rb status.rb errors.rb form.rb validations.rb data.rb result.rb params.rb + current.rb + mode.rb route.rb path.rb - interface.rb + endpoint.rb api.rb + db.rb rails.rb active_record.rb mongo_mapper.rb + + conducer.rb + image_cache.rb ] - Dao.autoload(:Db, Dao.libdir('db.rb')) - - unless defined?(D) - D = Dao +# protect against rails' too clever reloading +# +=begin + if defined?(Rails) + unless defined?(unloadable) + require 'active_support' + require 'active_support/dependencies' + end + unloadable(Dao) end + BEGIN{ Object.send(:remove_const, :Dao) if defined?(Dao) } +=end