https://github.com/shilesh/app_config
I have created a simple plugin which could be helpful in your rails projects. It is available at https://github.com/shilesh/app_config . This plugin, once installed , loads constants from a config file, while the application gets initialized (server start/restart, rails console etc ...).
There will be situations when application specific constants are required in our application. Which we could configure as needed.
I have tested it against rails 3.0.x and 2.3.8 .
I have created a simple plugin which could be helpful in your rails projects. It is available at https://github.com/shilesh/app_config . This plugin, once installed , loads constants from a config file, while the application gets initialized (server start/restart, rails console etc ...).
There will be situations when application specific constants are required in our application. Which we could configure as needed.
Summary:=======
This plugin helps to load values from a config file(yml) file based on theenvironment, with out writing extra code. ie: if you have a config file as 'app_config.yml' and has values in it as title: 'Caption'.The plugin helps you to call as "AppConfig::TITLE". If your config file name is 'ror_values.yml' then the values can be accessed as RorValue::TITLE". In short:: . I have tested against ruby 1.9 and rails 3.0
How to use:==========
- Install the plugin.
- This will create a folder 'app_config' inside 'config' folder of your rails application.
- A mock config file, named 'app_config.yml', will be created with sample data.
- User can edit the file with proper values.
- The file name can be renamed
- Based on the file name the namescope will be created to access the values(
:: ). - Restart the server if you change the file name.
- You can expect helpful error messages being raised on invalid access.
- When you un-install the files in config/app_config/* will be retained,
- expecting that it would contain useful data. You can manually delete it if needed.
I have tested it against rails 3.0.x and 2.3.8 .
No comments:
Post a Comment