On Aug 12, 1:55 pm, Fearless Fool <[email protected]> wrote: > Short form: What's the best way to customize my environment so "rails > new ..." uses a custom template rather than the default?
Sounds like you want rails' app templates ( there's a screencast at http://railscasts.com/episodes/148-app-templates-in-rails-2-3 ) Fred > > Long form: Every time I create a new Rails project, the first thing I do > is edit config/database.yml so the lines that previously read: > > development: > adapter: mysql > encoding: utf8 > reconnect: false > database: myapp_development > pool: 5 > username: root > password: > socket: /tmp/mysql.sock > > instead read: > > development: > adapter: mysql > encoding: utf8 > reconnect: false > database: myapp_development > pool: 5 > username: <%= ENV['MYSQL_USERID'] || "root" %> > password: <%= ENV['MYSQL_PASSWORD'] || "" %> > socket: <%= ENV['MYSQL_SOCKET'] || "/tmp/mysql.sock" %> > > ... that is, it picks up the values for username, password and socket > from environment variables I've set. > > I *could* edit $RAILS/generators/...mysql.yml directly, but there are > two problems: first, it's a bad idea to modify core files, and second, > it pre-expands the .yml code so my username and password are exposed in > the resulting file. Not what I want... > > Another approach would be to write a rake task to post-facto modify the > file, but that seems a bit clunky. > > WWDHD? (What would David Heinemeier do?) > > - ff > -- > Posted viahttp://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

