0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
local configuration for ruby (web) apps
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 0.9.0
>= 0

Runtime

>= 0
>= 0
 Project Readme

[]: {{{1

File        : README.md
Maintainer  : Felix C. Stegerman <flx@obfusk.net>
Date        : 2014-11-23

Copyright   : Copyright (C) 2014  Felix C. Stegerman
Version     : v0.3.3

[]: }}}1

Gem Version Build Status

Description

[]: {{{1

[rb-]localconfig - local configuration for ruby (web) apps

localconfig makes it easy to load (additional) configuration files from ~/.apps/<name>, where name is determined by the current directory. You can easily require ruby files and load json and yaml files from this directory.

Additionally, it allows rails applications to easily define admin:exists and admin:create rake tasks to make it easier to automate application setup.

Just about everything is configurable: see the docs.

For an example w/ rails, see https://github.com/obfusk/localconfig-rails-example.

[]: }}}1

Examples

[]: {{{1

Rails

# Gemfile
gem 'localconfig', require: 'localconfig/rails'
# config/localconfig.rb
LocalConfig['rails'].configure do |c|
  puts "env: #{c.env}, #{Rails.env}"

  c.require 'init.rb'

  c.load_json 'pg.json'
  puts c.pg.username

  c.load_yaml 'foo/bar/baz.json'
  puts c.foo.bar.baz.some_value

  c.load_yaml 'git.yml'   # repo:, branch:
  c.git_repo 'more', c.git.repo, branch: c.git.branch
  c.load_dir 'more'       # more/foo.yml, more/bar.json
  puts "more: #{c.more.foo.key1} #{c.more.bar.key2}"

  c.on_admin_exists do |username|
    # ...
  end
  c.on_admin_create do |username, password, email|
    # ...
  end
end

Standalone

require 'localconfig'   # loads config/localconfig.rb

or:

require 'localconfig/config'
LocalConfig['foo'].configure do |c|
  # ...
end

Rake

require 'localconfig'
ManifestDL::Rake.define_tasks

[]: }}}1

Specs & Docs

rake spec
rake coverage
rake docs

TODO

  • more specs/docs?
  • ...

License

LGPLv3+ [1].

References

[1] GNU Lesser General Public License, version 3 --- http://www.gnu.org/licenses/lgpl-3.0.html

[]: ! ( vim: set tw=70 sw=2 sts=2 et fdm=marker : )