A practical example of automatically generating a config file
Now that you have some knowledge, we would like to show you how Rake can be used in practice. Every Rails developer knows that the first step they have to take when they have a new project is to create the config/database.yml
file. It's a rather boring process and includes a lot of manual processes. If there is a config/database.yml.template
file, you are lucky and you have to just copy it to config/database.yml
. However, if this template file is not in the project, you will have to copy it from another project or find it on the Internet, in the documentation, or somewhere else. The next step consists of changing the configuration itself. As usual, it includes changing the username, password, adapter, and database. Also, you have to change these variables for each environment. It's a boring process, isn't it? So, we decided that if we create a task to automate this process, it will be useful. We hope your Rake arsenal is complete...