Skip to content

Commit 8f16c1a

Browse files
josecolellaclaude
andauthored
chore: improve repository quality, metadata, and contributor experience (#242)
Signed-off-by: Jose Colella <jose.colella@gusto.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 56520ef commit 8f16c1a

13 files changed

Lines changed: 249 additions & 21 deletions

.github/workflows/main.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
ruby:
2020
- "4.0"
2121
- "3.4"
22+
- "head"
23+
continue-on-error: ${{ matrix.ruby == 'head' }}
2224
env:
2325
BUNDLE_GEMFILE: Gemfile
2426

@@ -45,16 +47,39 @@ jobs:
4547
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
4648
- uses: ruby/setup-ruby@v1
4749
with:
48-
ruby-version: "3.4.8"
50+
ruby-version: "3.4"
4951
- run: bundle install
5052
- name: Standard
5153
run: bundle exec rake standard
54+
cucumber:
55+
runs-on: ubuntu-latest
56+
name: Gherkin Conformance
57+
steps:
58+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
59+
with:
60+
submodules: true
61+
- uses: ruby/setup-ruby@v1
62+
with:
63+
ruby-version: "3.4"
64+
- run: bundle install
65+
- name: Cucumber
66+
run: bundle exec cucumber
67+
security:
68+
runs-on: ubuntu-latest
69+
name: Security Audit
70+
steps:
71+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
72+
- uses: ruby/setup-ruby@v1
73+
with:
74+
ruby-version: "3.4"
75+
- name: Bundle Audit
76+
run: bundle lock && gem install bundler-audit && bundle-audit check --update
5277
# check the status of other jobs, so we can have a single job dependency for branch protection
5378
# https://github.com/community/community/discussions/4324#discussioncomment-3477871
5479
status:
5580
name: CI Status
5681
runs-on: ubuntu-latest
57-
needs: [rspec, standard]
82+
needs: [rspec, standard, cucumber, security]
5883
if: always()
5984
steps:
6085
- name: Successful CI

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@
1010
# rspec failure tracking
1111
.rspec_status
1212

13+
Gemfile.lock
14+
1315
# IDEs
1416
.cursor/

.simplecov

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ require "simplecov-cobertura"
44

55
SimpleCov.start do
66
add_filter "/spec/"
7+
minimum_coverage 90
78
if ENV["CI"] == "true"
89
formatter SimpleCov::Formatter::CoberturaFormatter
910
else

.yardopts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--markup markdown
2+
--output-dir doc
3+
lib/**/*.rb
4+
- README.md
5+
- CHANGELOG.md

CONTRIBUTING.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ You can contribute to this project from a Windows, macOS or Linux machine.
77
On all platforms, the minimum requirements are:
88

99
* Git client and command line tools.
10-
* Ruby 3.0 or higher
10+
* Ruby 3.4 or higher
1111

1212
## Pull Request
1313

@@ -50,6 +50,20 @@ To run unit tests and other checks:
5050
bundle exec rake
5151
```
5252

53+
#### Spec conformance tests (Gherkin)
54+
55+
The project includes Gherkin-based conformance tests that verify compliance with the OpenFeature specification:
56+
57+
```bash
58+
bundle exec cucumber
59+
```
60+
61+
#### Linting
62+
63+
This project uses [Standard Ruby](https://github.com/standardrb/standard) for code style enforcement.
64+
Run `bundle exec standardrb` to check, or `bundle exec standardrb --fix` to auto-fix.
65+
Do not run `bundle exec rubocop` directly, as a stale RuboCop server may apply different rules.
66+
5367
### How to Receive Comments
5468

5569
* If the PR is not ready for review, please mark it as

Gemfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,19 @@ source "https://rubygems.org"
55
# Specify your gem's dependencies in openfeature-sdk.gemspec
66
gemspec
77

8-
gem "cucumber", "~> 10.0", group: :test
9-
gem "logger", group: :test
8+
group :development, :test do
9+
gem "debug"
10+
gem "markly"
11+
gem "rake", "~> 13.0"
12+
gem "rspec", "~> 3.12.0"
13+
gem "standard"
14+
gem "standard-performance"
15+
gem "simplecov", "~> 0.22.0"
16+
gem "simplecov-cobertura", "~> 3.0"
17+
gem "timecop", "~> 0.9.10"
18+
end
19+
20+
group :test do
21+
gem "cucumber", "~> 10.0"
22+
gem "logger"
23+
end

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222
</a>
2323

2424
<!-- x-release-please-end -->
25+
<a href="https://github.com/open-feature/ruby-sdk/actions/workflows/main.yml">
26+
<img alt="Build" src="https://img.shields.io/github/actions/workflow/status/open-feature/ruby-sdk/main.yml?style=for-the-badge" />
27+
</a>
28+
<a href="https://rubygems.org/gems/openfeature-sdk">
29+
<img alt="Gem Version" src="https://img.shields.io/gem/v/openfeature-sdk?style=for-the-badge&color=red" />
30+
</a>
31+
<a href="https://codecov.io/gh/open-feature/ruby-sdk">
32+
<img alt="Code Coverage" src="https://img.shields.io/codecov/c/github/open-feature/ruby-sdk?style=for-the-badge" />
33+
</a>
2534
<br/>
2635
<a href="https://bestpractices.coreinfrastructure.org/projects/9337">
2736
<img alt="CII Best Practices" src="https://bestpractices.coreinfrastructure.org/projects/9337/badge" />
@@ -41,6 +50,8 @@
4150
| Ruby 3.4.x | Windows, MacOS, Linux |
4251
| Ruby 4.0.x | Windows, MacOS, Linux |
4352

53+
This project supports all Ruby versions in active maintenance per the [Ruby maintenance schedule](https://www.ruby-lang.org/en/downloads/branches/).
54+
4455
### Install
4556

4657
Install the gem and add to the application's Gemfile by executing:
@@ -115,6 +126,16 @@ object = client.fetch_object_value(flag_key: 'object_value', default_value: { na
115126

116127
[Providers](https://openfeature.dev/docs/reference/concepts/provider) are an abstraction between a flag management system and the OpenFeature SDK.
117128
Look [here](https://openfeature.dev/ecosystem?instant_search%5BrefinementList%5D%5Btype%5D%5B0%5D=Provider&instant_search%5BrefinementList%5D%5Btechnology%5D%5B0%5D=Ruby) for a complete list of available providers.
129+
130+
#### Known Providers
131+
132+
| Provider | Package |
133+
|----------|---------|
134+
| flagd | [openfeature-flagd-provider](https://rubygems.org/gems/openfeature-flagd-provider) |
135+
| Flipt | [openfeature-flipt-provider](https://rubygems.org/gems/openfeature-flipt-provider) |
136+
| Flagsmith | [openfeature-flagsmith-provider](https://rubygems.org/gems/openfeature-flagsmith-provider) |
137+
| GO Feature Flag | [openfeature-go-feature-flag-provider](https://rubygems.org/gems/openfeature-go-feature-flag-provider) |
138+
118139
If the provider you're looking for hasn't been created yet, see the [develop a provider](#develop-a-provider) section to learn how to build it yourself.
119140

120141
Once you've added a provider as a dependency, it can be registered with OpenFeature like this:

Rakefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ RSpec::Core::RakeTask.new(:spec)
77

88
require "standard/rake"
99

10+
begin
11+
require "yard"
12+
YARD::Rake::YardocTask.new
13+
rescue LoadError
14+
# YARD not available
15+
end
16+
1017
desc "Run Cucumber Gherkin feature tests"
1118
task :cucumber do
1219
sh "bundle exec cucumber"

SECURITY.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
If you discover a security vulnerability, please report it responsibly.
6+
Do NOT open a public GitHub issue.
7+
8+
Please email security concerns to: cncf-openfeature-contributors@lists.cncf.io
9+
10+
We will acknowledge receipt within 48 hours and provide a timeline for a fix.

examples/basic_usage.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
require "open_feature/sdk"
4+
5+
# Configure OpenFeature with the in-memory provider for demonstration
6+
OpenFeature::SDK.configure do |config|
7+
config.set_provider(OpenFeature::SDK::Provider::InMemoryProvider.new(
8+
"v2_enabled" => true,
9+
"welcome_message" => "Hello, OpenFeature!",
10+
"item_limit" => 42,
11+
"theme" => {"color" => "blue", "mode" => "dark"}
12+
))
13+
end
14+
15+
# Create a client
16+
client = OpenFeature::SDK.build_client
17+
18+
# Evaluate different flag types
19+
puts client.fetch_boolean_value(flag_key: "v2_enabled", default_value: false)
20+
puts client.fetch_string_value(flag_key: "welcome_message", default_value: "default")
21+
puts client.fetch_number_value(flag_key: "item_limit", default_value: 10)
22+
puts client.fetch_object_value(flag_key: "theme", default_value: {})

0 commit comments

Comments
 (0)