Skip to content

Latest commit

 

History

History
73 lines (52 loc) · 1.13 KB

File metadata and controls

73 lines (52 loc) · 1.13 KB

bootloader

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.

Installation

Add the following line to your Gemfile:

gem 'bootloader'

And then run:

bundle install

Example

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

Loading YAML configs

require 'bootloader'

Bootloader.load_configs # => Loads my_project.yml into MyProjectConfig
MyProjectConfig.database.name # => "my_project_dev"
MyProjectConfig.database.hosts # => ['db101', 'db102']

Loading multiple files at once

Bootloader.load_dir 'lib' # Loads all the files under lib

Setting up a Syslogger

Bootloader.syslogger 'my_project' # => #<Logger>

License

bootloader is released under the MIT License.