Config Toolkit

Solution that will make sourcing information from (parsing) configuration files robust and easy
Download

Config Toolkit Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT License
  • Price:
  • FREE
  • Publisher Name:
  • Designing Patterns
  • Publisher web site:
  • http://rubyforge.org/projects/jobmanager/
  • Operating Systems:
  • Mac OS X
  • File Size:
  • 64 KB

Config Toolkit Tags


Config Toolkit Description

Solution that will make sourcing information from (parsing) configuration files robust and easy Are you tired of writing custom code to represent and parse every new configuration file utilized in your applications?The Config Toolkit generates configuration classes and can populate them robustly by parsing different formats of configuration files.configtoolkit is the one that:· Allows programmers to specify the type of data that should be loaded from a configuration file. The toolkit automatically will validate the file's data against this specification when loading the file, ensuring that the specification always is obeyed and saving the programmer the tedious chore of writing validation code.· Automagically generates parameter accessor methods (getters, setters, and predicates to test for presence), an equality operator, and a +to_s+ method from the configuration's specification.· Allows programmers to create configuration files, easily and programatically.· Provides a class that can load (parse) Ruby configuration files (allowing the full power of Ruby to be used within configuration files).· Provides classes that can load from (parse) and dump to YAML and key-value configuration files.· Provides classes that can load from and dump to Hashes.· Provides a class that allows the contents of one configuration source to override the contents of another (this works with configuration files of any format or Hashes).· Is very extensible, allowing the engine to be used with custom format configuration files and with custom data validation rules. Here are some key features of "Config Toolkit": · The ConfigToolkit allows programmers to define a new configuration class by specifying the parameters that are included in the configuration. A parameter specification consists of the class of the parameter's values, whether or not the paramater is required, and a default value if the parameter is not required. · Getter, setter, and predicate methods automatically are generated for a new configuration class for each specified parameter to get the parameter's value, set the parameter's value, and test whether the parameter has a value. · A method to clear a parameter's value automatically is generated for optional parameters. · A block can be passed to the new method of a configuration class in order to Initialize the instance (see ConfigToolkit::BaseConfig.new). · rdoc can detect and generate documentation for each parameter in a configuration class (see FAQ.txt for how to enable this). · An equality operator exists for each configuration class that determines equality based on whether all parameter values are equal. · A to_s method that produces very pretty output exists for each configuration class (ConfigToolkit::BaseConfig#to_s, leveraging the ConfigToolkit::PrettyPrintWriter) · Programmers can specify custom validation blocks for each parameter, in order to enforce specifications not directly supported by the engine. · Programmers can define a method in a configuration class that will be called in order to enforce relationships between the values of different parameters (ConfigToolkit::BaseConfig#validate_all_values) · Programmers can create custom reader and writer classes in order to load from and dump to (respectively) configuration file formats not directly supported by the ConfigToolkit. · Configuration classes can be nested to any depth within each other. · Configuration classes have first class support for Array configuration parameters. Constraints can be specified for a given Array parameter that will ensure that all elements are of a specified class and that there are a specified number of elements present (see ConfigToolkit::ConstrainedArray) · The ConfigToolkit supports multiple configurations stored in a single file; it is able to distinguish that different configurations within a file belong to different configuration objects. For example, "production" and "test" configuration information can live within the same configuration file and can be loaded into separate configuration instances (by specifying a different "containing object name" for each ConfigToolkit::BaseConfig#load call) · A reader class to read (parse) Ruby configuration files (ConfigToolkit::RubyReader) · A reader class to read (parse) YAML configuration files (ConfigToolkit::YAMLReader) · A writer class to dump YAML configuration files (ConfigToolkit::YAMLWriter) · A reader class to load configuration directly from a Hash (ConfigToolkit::HashReader) · A writer class do dump configuration directly to a Hash (ConfigToolkit::HashWriter) · A reader class to read (parse) key-value configuration files (ConfigToolkit::KeyValueReader) · A writer class to dump key-value configuration files (ConfigToolkit::KeyValueWriter) · The ConfigToolkit::KeyValueReader and ConfigToolkit::KeyValueWriter classes can be configured to work with many different formats of key-value configuration files (via ConfigToolkit::KeyValueConfig). · A reader class to source one configuration from multiple configuration files, allowing one configuration file to override another (ConfigToolkit::OverrideReader) · The ConfigToolkit includes a full unit testing suite. · The ConfigToolkit code has detailed comments. · The ConfigToolkit code has many example programs (in the examples subdirectory). · The ConfigToolkit package includes extensive documentation, including FAQ.txt and documentation for the support file formats. What's New in This Release: · The ConfigToolkit will print out a warning when it encounters an · unknown parameter when loading a configuration file · (ConfigToolkit::BaseConfig#load and ConfigToolkit::BaseConfig#load_group). · This will make it easier to catch errors in configuration files. Previously, · such unknown parameters were ignored silently (thanks for the idea, Inaki). · The ConfigToolkit now *itself* can be configured. · ConfigToolkit::ConfigToolkitConfig configurations can be specified for a · ConfigToolkit::BaseConfig child class or for an instance of a · ConfigToolkit::BaseConfig child class. The · ConfigToolkit::ConfigToolkitConfig allows customization of the loading · and dumping processes. Right now, it supports modifying the ConfigToolkit's · behavior upon encountering an unknown configuration parameter: the · ConfigToolkit can ignore the parameter (the behavior in prior versions), · warn about the parameter (the new default behavior), or raise a · ConfigToolkit::Error about the parameter. See README.txt for · more details.


Config Toolkit Related Software