Update bundle

Update README
Fix issue with custom modules
This commit is contained in:
VetheonGames 2023-10-27 16:42:18 -06:00
parent 19348e2aee
commit bcfaa2e887
4 changed files with 75 additions and 37 deletions

View File

@ -9,8 +9,6 @@ gem 'rake', '~> 13.0'
gem 'rspec', '~> 3.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"

View File

@ -2,27 +2,14 @@ PATH
remote: . remote: .
specs: specs:
configman (1.0.0) configman (1.0.0)
deep_dup
inifile inifile
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
ast (2.4.2)
base64 (0.1.1)
deep_dup (0.0.3)
diff-lcs (1.5.0) diff-lcs (1.5.0)
inifile (3.0.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) rake (13.0.6)
regexp_parser (2.8.2)
rexml (3.2.6) rexml (3.2.6)
rspec (3.12.0) rspec (3.12.0)
rspec-core (~> 3.12.0) rspec-core (~> 3.12.0)
@ -37,22 +24,6 @@ GEM
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0) rspec-support (~> 3.12.0)
rspec-support (3.12.1) 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 PLATFORMS
x86_64-linux x86_64-linux
@ -63,7 +34,6 @@ DEPENDENCIES
rake (~> 13.0) rake (~> 13.0)
rexml (~> 3.2) rexml (~> 3.2)
rspec (~> 3.0) rspec (~> 3.0)
rubocop (~> 1.21)
BUNDLED WITH BUNDLED WITH
2.4.20 2.4.20

View File

@ -1,3 +1,71 @@
# ConfigMan # ConfigMan Gem
A Ruby Gem for automating your Config handling 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.

View File

@ -6,7 +6,7 @@ require_relative 'configman/parsers/ini'
require_relative 'configman/parsers/xml' require_relative 'configman/parsers/xml'
require_relative 'configman/parsers/yaml' require_relative 'configman/parsers/yaml'
module ConfigMan module ConfigMan # rubocop:disable Metrics/ModuleLength, Style/Documentation
class Error < StandardError; end class Error < StandardError; end
@config_values = {} @config_values = {}
@ -41,7 +41,9 @@ module ConfigMan
raise ArgumentError, "Custom module must implement a 'populate_defaults' method" raise ArgumentError, "Custom module must implement a 'populate_defaults' method"
end end
@custom_modules ||= []
@custom_modules << mod_class @custom_modules << mod_class
puts "Custom modules: #{@custom_modules.inspect}" # Debug line
end end
def self.used_modules def self.used_modules