Sha256: 883da6f4c54e6c2847db996152e52a7d83ab9bf892b9169d4980a6841a266c5a

Contents?: true

Size: 1020 Bytes

Versions: 6

Compression:

Stored size: 1020 Bytes

Contents

require 'rails/generators/base'
require 'generators/mongoid'

module Mongoid
  module Generators
    class InstallGenerator < Base            

      # argument      :database,  :type => :string, :default => 'mongo_db_default', :desc => "Name of the Mongo database to use"            
      class_option  :host,      :type => :string, :default => 'localhost',        :desc => "Name of the Mongo host use"

      def create_files
        template "mongoid.rb",         "config/initializers/mongoid.rb" 
        template 'database.mongo.yml',  "config/database.mongo.yml"   

        puts "Please ensure Gemfile contains: gem '#{orm_gem_name}', '>=2.0.0.beta9'"
        say "For production enviroment DB configuration, set environment variables as indicated in config/database.mongo.yml"        
      end
      
      protected

      def database
        name
      end

      def orm_gem_name
        "mongoid"
      end 
              
      def host
        options[:host] || 'localhost'
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails3-generators-0.15.0 lib/generators/mongoid/install/install_generator.rb
rails3-generators-0.14.0 lib/generators/mongoid/install/install_generator.rb
rails3-generators-0.13.0 lib/generators/mongoid/install/install_generator.rb
rails3-generators-0.12.1 lib/generators/mongoid/install/install_generator.rb
rails3-generators-0.12.0 lib/generators/mongoid/install/install_generator.rb
rails3-generators-0.11.0 lib/generators/mongoid/install/install_generator.rb