diff --git a/Gemfile b/Gemfile index 82f0f78..0ecfabb 100644 --- a/Gemfile +++ b/Gemfile @@ -9,8 +9,6 @@ gem 'rake', '~> 13.0' gem 'rspec', '~> 3.0' -gem 'rubocop', '~> 1.21' +gem 'rexml', '~> 3.2' -gem "rexml", "~> 3.2" - -gem "inifile", "~> 3.0" +gem 'inifile', '~> 3.0' diff --git a/Gemfile.lock b/Gemfile.lock index f0ce4fb..6ec28df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,27 +2,14 @@ PATH remote: . specs: configman (1.0.0) - deep_dup inifile GEM remote: https://rubygems.org/ specs: - ast (2.4.2) - base64 (0.1.1) - deep_dup (0.0.3) diff-lcs (1.5.0) inifile (3.0.0) - json (2.6.3) - language_server-protocol (3.17.0.3) - parallel (1.23.0) - parser (3.2.2.4) - ast (~> 2.4.1) - racc - racc (1.7.1) - rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.8.2) rexml (3.2.6) rspec (3.12.0) rspec-core (~> 3.12.0) @@ -37,22 +24,6 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (1.57.1) - base64 (~> 0.1.1) - json (~> 2.3) - language_server-protocol (>= 3.17.0) - parallel (~> 1.10) - parser (>= 3.2.2.4) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) - parser (>= 3.2.1.0) - ruby-progressbar (1.13.0) - unicode-display_width (2.5.0) PLATFORMS x86_64-linux @@ -63,7 +34,6 @@ DEPENDENCIES rake (~> 13.0) rexml (~> 3.2) rspec (~> 3.0) - rubocop (~> 1.21) BUNDLED WITH 2.4.20 diff --git a/README.md b/README.md index b1c7f8e..7236b64 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,71 @@ -# ConfigMan +# ConfigMan Gem -A Ruby Gem for automating your Config handling \ No newline at end of file +ConfigMan is a Ruby gem designed to simplify the configuration management of your Ruby applications. It provides a modular approach, allowing you to easily manage different aspects of your application's configuration such as API, Cache, Database, Email, and more. You can even extend its functionality by registering your own custom modules. + +## Table of Contents + +- [Installation](#installation) +- [Usage](#usage) + - [Built-in Modules](#built-in-modules) + - [Custom Modules](#custom-modules) +- [Wiki](#wiki) +- [Contributing](#contributing) +- [License](#license) + +## Installation + +To install the ConfigMan gem, run the following command: + +```bash +gem install configman +``` + +Or add it to your Gemfile: + +```bash +gem 'configman' +``` + +Then run `bundle install`. + +## Usage + +### Built-in Modules + +ConfigMan comes with a variety of built-in modules to manage different aspects of your configuration. Here's a quick example: + +```ruby +require 'configman' + +default_modules = ['API', 'Cache', 'Database', 'Email', 'FileStorage', 'Localization', 'Logging', 'YAML'] +ConfigMan.load_modules(default_modules) +ConfigMan.setup(default_modules) +ConfigMan.load +``` + +### Custom Modules + +You can also register your own custom modules to extend the functionality of ConfigMan. Here's how: + +```ruby +require 'configman' +# Register the custom module +ConfigMan.register_module('/path/to/your/custom_module.rb') + +# Then proceed with the rest of the setup as usual +default_modules = ['API', 'Cache', 'Database', 'YAML'] +ConfigMan.load_modules(default_modules) +ConfigMan.setup(default_modules) +``` + +## Wiki + +For more detailed information and advanced usage, please refer to our [Wiki](#Wiki)). + +## Contributing + +Contributions are welcome! Fork the repository to your account on our Git server, make your changes, and submit a PR! We will review, and if we don't find any issues, we will merge the PR! + +## License + +This project is licensed under the PixelRidge-BEGPULSE License. See the [LICENSE](#LICENSE) file for details. diff --git a/lib/configman.rb b/lib/configman.rb index c4ba1c9..ce9b7e1 100644 --- a/lib/configman.rb +++ b/lib/configman.rb @@ -6,7 +6,7 @@ require_relative 'configman/parsers/ini' require_relative 'configman/parsers/xml' require_relative 'configman/parsers/yaml' -module ConfigMan +module ConfigMan # rubocop:disable Metrics/ModuleLength, Style/Documentation class Error < StandardError; end @config_values = {} @@ -41,7 +41,9 @@ module ConfigMan raise ArgumentError, "Custom module must implement a 'populate_defaults' method" end + @custom_modules ||= [] @custom_modules << mod_class + puts "Custom modules: #{@custom_modules.inspect}" # Debug line end def self.used_modules