Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do some general cleanup and bump the version of ruby tested against. #1

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
ruby:
- '3.1.2'
- '3.3.1'

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

source "https://rubygems.org"

# Specify your gem's dependencies in Boa.gemspec
gemspec

group :development do
Expand Down
39 changes: 21 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,37 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
json (2.6.3)
minitest (5.16.3)
parallel (1.22.1)
parser (3.1.3.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
minitest (5.22.3)
parallel (1.24.0)
parser (3.3.1.0)
ast (~> 2.4.1)
racc
racc (1.7.3)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.6.1)
rexml (3.2.5)
rubocop (1.41.1)
rake (13.2.1)
regexp_parser (2.9.1)
rexml (3.2.6)
rubocop (1.63.5)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.2.1)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.23.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.24.0)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
unicode-display_width (2.3.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
ruby-progressbar (1.13.0)
unicode-display_width (2.5.0)

PLATFORMS
arm64-darwin-21
arm64-darwin-22
ruby
x86_64-linux

DEPENDENCIES
boa-config!
Expand All @@ -49,4 +52,4 @@ DEPENDENCIES
rubocop (~> 1.21)

BUNDLED WITH
2.3.26
2.5.9
44 changes: 39 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Natively boa supports:

Boa also supports these configuration types via plugins:

- TOML
- (TOML)[https://github.com/gscho/boa-toml]

## Installation

Expand All @@ -27,7 +27,7 @@ If bundler is not being used to manage dependencies, install the gem by executin

## Usage

Much like the Golang implementation, boa is meant to be used like a singleton class. By default, the boa singleton class is accessible via a global variable named `$boa`.
Much like the Golang implementation, boa is meant to be used as a singleton class. By default, the boa singleton class is accessible via a global variable named `$boa`.

### Setting Defaults

Expand Down Expand Up @@ -85,25 +85,59 @@ port: 4567
host: localhost
YAML
$boa.read_config(config)
$boa.automatic_env
$boa.get("host") # => "localhost"
$boa.get("port") # => 9292
```

### Writing Config Files

Write out a config file `./write_config.yaml`:

```ruby
config = <<-YAML
foo: "bar"
YAML
$boa.set_config_type("yaml")
$boa.read_config(config)
$boa.set_config_name("write_config")
$boa.write_config
```

Writing a config file to another directory:

```ruby
config = <<-YAML
foo: "bar"
YAML
$boa.set_config_type("yaml")
$boa.read_config(config)
$boa.set_config_name("write_config")
$boa.add_config_path("/my/other/directory")
$boa.write_config
```

### Adding Plugins

To add a plugin, update your `Gemfile` or `gemspec` to add the new dependency and then `bundle install`

### Writing Plugins

There is an example plugin called `foo` in the `test/fixtures` directory.

At a high level:

- The plugin must have a dependency on `boa`
- The plugin must have a file `lib/boa/plugin/boa_<type>.rb`
- The plugin must implement `serialize` and `deserialze` functions

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/Boa. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/Boa/blob/main/CODE_OF_CONDUCT.md).
Bug reports and pull requests are welcome on GitHub at https://github.com/gscho/boa. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/gscho/boa/blob/main/CODE_OF_CONDUCT.md).

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the Boa project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/Boa/blob/main/CODE_OF_CONDUCT.md).
Everyone interacting in the Boa project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/gscho/boa/blob/main/CODE_OF_CONDUCT.md).
2 changes: 1 addition & 1 deletion lib/boa/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def write_config_as(path)
@type ||= File.extname(@name).delete_prefix(".")
if @type.empty?
raise BoaConfigError,
"Must provide an extension in the config name or explicitly set the config type"
"Must provide a file extension in the config name or explicitly set the config type"
end

file = "#{File.basename(@name, ".#{@type}")}.#{@type}"
Expand Down
2 changes: 2 additions & 0 deletions lib/boa/plugin/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ module Boa
module Plugin
class Base
def deserialize(data); end

def serialize(config); end
end
end
end
Loading