fun_with_configurations : Your objects must be configurized!

Configuration and settings are the beating heart and dark, twisted soul of your operation.

Let’s do some example code:

“”“class Computer; end;

Computers.install_fwc_config do

servers do
  hopeful_host do
    ip "192.168.0.25"
    services :mysql, :memcached, :email, :backup
    uptime `uptime`.strip
    config_script "/var/configurations/hopeful.conf"
  end

  squishy_host do
    ip "192.168.0.27"
    services :postresql, :couchdb
    uptime `uptime`.strip
    config_script "/var/configurations/squishy.conf"
  end
end

workstations do
  betty do
    ip "192.168.0.14"
    os "Ubuntu Linux 13.04"
  end

  veronica do
    ip "192.168.0.15"
    os "Solaris 10"
  end
end

end

Computers.config.servers.hopeful_host.ip # “192.168.0.25” Computers.config.workstations.betty.ip # “192.168.0.14” Computers.config.try.servers.grumpy_host.ip.success? # false (doesn’t have that configuration setting) “”“

You can also load from a hash:

“”“@obj.install_fwc_config_from_hash({

servers: {
  hopeful_host: {
    ip: "192.168.0.25",
    services :mysql, :memcached, :email, :backup

    ...  (and so on)
  }
}

})

@obj.config.servers.hopeful_host.services # [:mysql, :memcached, :email, :backup] “”“

Or from a yaml string:

“”“@obj.install_fwc_config_from_yaml( YAML.load( File.read( ”~/data/configs/circumstantial.yml“ ) ) ) ”“”

The file should represent hashes of hashes. Anything not a hash will be treated as a leaf setting (arrays, etc.).

Contributing to fun_with_configurations

Boilerplate from Jeweler. Seems reasonable.
  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2013 Bryce Anderson. See LICENSE.txt for further details.