Merge pull request #72 from lucasrenan/master

Adding a config generator
This commit is contained in:
Sam Lown 2011-06-24 15:59:41 -07:00
commit ca1d1cd51d
3 changed files with 43 additions and 0 deletions

View file

@ -70,6 +70,10 @@ The example config above for example would use a database called "project_test".
## Generators ## Generators
### Configuration
$ rails generate couchrest_model:config
### Model ### Model
$ rails generate model person --orm=couchrest_model $ rails generate model person --orm=couchrest_model

View file

@ -0,0 +1,18 @@
require 'rails/generators/couchrest_model'
module CouchrestModel
module Generators
class ConfigGenerator < Rails::Generators::Base
source_root File.expand_path('../templates', __FILE__)
def app_name
Rails::Application.subclasses.first.parent.to_s.underscore
end
def copy_configuration_file
template 'couchdb.yml', File.join('config', "couchdb.yml")
end
end
end
end

View file

@ -0,0 +1,21 @@
development: &development
protocol: 'http'
host: localhost
port: 5984
prefix: <%= app_name %>
suffix: development
username:
password:
test:
<<: *development
suffix: test
production:
protocol: 'https'
host: localhost
port: 5984
prefix: <%= app_name %>
suffix: production
username: root
password: 123