bootloader takes care of many of the common tasks across your Ruby applications:
- Loading YAML configuration.
- Loading multiple source files at once.
- Setting up a syslogger.
- etc.
Add the following line to your Gemfile:
gem 'bootloader'
And then run:
bundle install
Say you have a project with the following structure:
my_project/
Gemfile
config/
my_project.yml
lib/
foo.rb
bar.rb
Here's the my_project.yml:
development:
database:
name: my_project_dev
hosts:
- db101
- db102
require 'bootloader'
Bootloader.load_configs # => Loads my_project.yml into MyProjectConfig
MyProjectConfig.database.name # => "my_project_dev"
MyProjectConfig.database.hosts # => ['db101', 'db102']
Bootloader.load_dir 'lib' # Loads all the files under lib
Bootloader.syslogger 'my_project' # => #<Logger>
bootloader is released under the MIT License.