If you know on your projects that you always want to add
config/database.yml to .gitignore as part of creating the application, then
use an application
template<http://guides.rubyonrails.org/rails_application_templates.html>.
It offers a file
command<http://guides.rubyonrails.org/rails_application_templates.html#vendor-lib-file-initializer-filename-data-nil-block>that
generates a file with the contents in the given block. Something like
this ought to do the trick:

file '.gitignore', <<-IGNORE
config/database.yml
IGNORE

You could also use the run
command<http://guides.rubyonrails.org/rails_application_templates.html#run-command>to
make a copy of of config/database.yml as config/database.yml.example,
and use the git
command<http://guides.rubyonrails.org/rails_application_templates.html#git-command>to
stage that for the initial commit.

Application templates seem under-utilized, but that might be because I
don't often generate new applications or hear others talk about using
templates.

Craig

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to