lib/dao.rb in dao-2.0.0 vs lib/dao.rb in dao-2.1.0
- old
+ new
@@ -4,37 +4,27 @@
#require 'fileutils'
#require 'pathname'
#require 'yaml'
#require 'yaml/store'
-# gems
-#
- begin
- require 'rubygems'
- rescue LoadError
- nil
- end
-
- if defined?(gem)
- gem('map', '~> 2.2.2')
- gem('tagz', '~> 8.0')
- gem('yajl-ruby', '~> 0.7.9')
- end
-
- require 'map'
- require 'tagz'
- require 'yajl'
-
# dao libs
#
module Dao
- Version = '2.0.0' unless defined?(Version)
+ Version = '2.1.0' unless defined?(Version)
def version
Dao::Version
end
+ def dependencies
+ {
+ 'map' => ['map', '~> 2.6.1'],
+ 'tagz' => ['tagz', '~> 8.2.0'],
+ 'yajl' => ['yajl-ruby', '~> 0.7.9']
+ }
+ end
+
def libdir(*args, &block)
@libdir ||= File.expand_path(__FILE__).sub(/\.rb$/,'')
args.empty? ? @libdir : File.join(@libdir, *args)
ensure
if block
@@ -53,12 +43,28 @@
end
extend(Dao)
end
+# gems
+#
+ begin
+ require 'rubygems'
+ rescue LoadError
+ nil
+ end
+
+ if defined?(gem)
+ Dao.dependencies.each do |lib, dependency|
+ gem(*dependency)
+ require(lib)
+ end
+ end
+
Dao.load %w[
blankslate.rb
+ instance_exec.rb
exceptions.rb
support.rb
slug.rb
stdext.rb
@@ -70,11 +76,11 @@
errors.rb
validations.rb
mode.rb
path.rb
- endpoint.rb
+ interface.rb
api.rb
rails.rb
active_record.rb
@@ -83,6 +89,13 @@
Dao.autoload(:Db, Dao.libdir('db.rb'))
unless defined?(D)
D = Dao
+ end
+
+ if defined?(Rails.env)
+ unless Rails.env.production?
+ unloadable(Dao)
+ unloadable(D)
+ end
end