Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding config generator

  • Loading branch information...
commit c3b7cc316d301227c203c1fe9573c58c8add674d 1 parent 3f7b1d3
@lucasrenan lucasrenan authored
View
4 README.md
@@ -70,6 +70,10 @@ The example config above for example would use a database called "project_test".
## Generators
+### Configuration
+
+ $ rails generate couchrest_model:config
+
### Model
$ rails generate model person --orm=couchrest_model
View
18 lib/rails/generators/couchrest_model/config/config_generator.rb
@@ -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
21 lib/rails/generators/couchrest_model/config/templates/couchdb.yml
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.