From 19d00a8802eab76b6b51aad4b4166132e0ce7512 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 10 Mar 2010 12:25:53 -0800 Subject: [PATCH] Config class now allows classes to dynamically register configuration keys. --- lib/vagrant/config.rb | 36 ++++++++++++++++------- test/vagrant/config_test.rb | 58 +++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 10 deletions(-) diff --git a/lib/vagrant/config.rb b/lib/vagrant/config.rb index 36942a5b1..baa3fcc9c 100644 --- a/lib/vagrant/config.rb +++ b/lib/vagrant/config.rb @@ -13,6 +13,10 @@ module Vagrant config_runners.clear end + def configures(key, klass) + @@config.class.configures(key, klass) + end + def config @@config ||= Config::Top.new end @@ -129,18 +133,30 @@ module Vagrant end class Top < Base - attr_reader :package - attr_reader :ssh - attr_reader :vm - attr_reader :chef - attr_reader :vagrant + @@configures = [] + + class <