Sha256: cc821e524d32af08bef4fa80a2eb070b37616aa212b8ea123c5827dca95292a2
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
module Padrino module Generators module Components module Orms module MongomapperGen MONGO = (<<-MONGO).gsub(/^ {10}/, '') class MongoDBConnectionFailure < RuntimeError; end module MongoDbInitializer def self.registered(app) app.configure :development do MongoMapper.connection = Mongo::Connection.new('localhost') MongoMapper.database = 'your_dev_db_here' end app.configure :production do MongoMapper.connection = Mongo::Connection.new('localhost') MongoMapper.database = 'your_production_db_here' end app.configure :test do MongoMapper.connection = Mongo::Connection.new('localhost') MongoMapper.database = 'your_test_db_here' end end end MONGO CONCERNED = (<<-CONCERN).gsub(/^ {10}/, '') module MongoMapper module Document module ClassMethods # TODO find a cleaner way for it to know where to look for dependencies def concerned_with(*concerns) concerns.each { |concern| require_dependency "./app/models/\#{name.underscore}/\#{concern}" } end end end end CONCERN def setup_orm require_dependencies 'mongo_mapper' create_file("config/initializers/mongo_db.rb", MONGO) create_file("lib/ext/mongo_mapper.rb", CONCERNED) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
padrino-gen-0.1.1 | lib/generators/components/orms/mongomapper_gen.rb |
padrino-gen-0.1.0 | lib/generators/components/orms/mongomapper_gen.rb |