Sha256: ceb5efc3097b170d22f3e607ec49c17172d6d5defba5274e8819b10c3cef7625

Contents?: true

Size: 877 Bytes

Versions: 2

Compression:

Stored size: 877 Bytes

Contents

$:.unshift File.dirname(__FILE__)

require 'mongo/gridfs'
require 'mongo_mapper'
require 'uuidtools'

# types
require 'mongomapper_ext/types/open_struct'
require 'mongomapper_ext/types/timestamp'

# storage
require 'mongomapper_ext/file'
require 'mongomapper_ext/storage'

# update
require 'mongomapper_ext/update'

# filter
require 'mongomapper_ext/filter'

# slug
require 'mongomapper_ext/slugizer'

# tags
require 'mongomapper_ext/tags'

module MongoMapperExt
  def self.init
    load_jsfiles(::File.dirname(__FILE__)+"/mongomapper_ext/js")
  end

  def self.load_jsfiles(path)
    Dir.glob(::File.join(path, "*.js")) do |js_path|
      code = ::File.read(js_path)
      name = ::File.basename(js_path, ".js")

      # HACK: looks like ruby driver doesn't support this
      MongoMapper.database.eval("db.system.js.save({_id: '#{name}', value: #{code}})")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongomapper_ext-0.1.4 lib/mongomapper_ext.rb
mongomapper_ext-0.1.3 lib/mongomapper_ext.rb