To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!
More about adding a collaboratorCreating configuration files
Run the rake task config
to create configuration files. These are created
by populating configuration values from the environment into template
configuration files.
Templates are identified by a final .dice
extension in their filename. They
can be anywhere in the current working directory or below it. The .dice
extension is stripped off to create the final configuration filename, which
is created beside the template in the same directory.
Templates are processed as ERB source files. Configuration values from the
environment are made available through the configured
object. If a
referenced environment variable is undefined nil
is returned, allowing you
to provide defaults directly in the template.
- Scenarios
-
- Populating a YAML configuration file from an ERB template
- Providing default configuration values
- Recursive descent of directories
- Populating a YAML configuration file from an ERB template
-
- Given
-
a file named "database.yml.dice" with:
development: database: development username: <%= configured.database_username %> password: <%= configured.database_password %>
- When
-
I run
rake DATABASE_USERNAME=alice DATABASE_PASSWORD=xyzzy config
- Then
-
the file "database.yml" should contain:
development: database: development username: alice password: xyzzy
- Providing default configuration values
-
- Given
-
a file named "database.yml.dice" with:
development: database: development username: <%= configured.database_username || 'root' %> password: <%= configured.database_password %>
- When
-
I run
rake config
- Then
-
the file "database.yml" should contain:
development: database: development username: root password:
- Recursive descent of directories
-
- Given
- an empty file named "file.dice"
- When
-
I run
rake config
- Then
- a file named "file" should exist
Examples: file config.ru config/database.yml config/initializers/secret_token.rb
Last published almost 7 years ago by Andrew Smith.