Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.0','3.1','3.2','3.3']
ruby-version: ['3.1','3.2','3.3','3.4']

steps:
- uses: actions/checkout@v4
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Run tests
run: bundle exec rake --trace
env:
PREFAB_INTEGRATION_TEST_API_KEY: ${{ secrets.PREFAB_INTEGRATION_TEST_API_KEY }}
PREFAB_INTEGRATION_TEST_ENCRYPTION_KEY: ${{ secrets.PREFAB_INTEGRATION_TEST_ENCRYPTION_KEY }}
REFORGE_INTEGRATION_TEST_API_KEY: ${{ secrets.REFORGE_INTEGRATION_TEST_API_KEY }}
PREFAB_INTEGRATION_TEST_ENCRYPTION_KEY: c87ba22d8662282abe8a0e4651327b579cb64a454ab0f4c170b45b15f049a221
NOT_A_NUMBER: "abcd"
IS_A_NUMBER: "1234"
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "test/prefab-cloud-integration-test-data"]
path = test/prefab-cloud-integration-test-data
url = git@github.com:prefab-cloud/prefab-cloud-integration-test-data
[submodule "test/shared-integration-test-data"]
path = test/shared-integration-test-data
url = git@github.com:ReforgeHQ/sdk-integration-test-data.git
65 changes: 5 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# prefab-cloud-ruby

Ruby Client for Prefab Feature Flags, Dynamic log levels, and Config as a Service: https://www.prefab.cloud
Ruby Client for Reforge Feature Flags, Dynamic log levels, and Config as a Service: https://launch.reforge.com

```ruby
client = Prefab::Client.new
client = Reforge::Client.new

context = {
user: {
Expand All @@ -24,7 +24,6 @@ See full documentation https://docs.prefab.cloud/docs/sdks/ruby
## Supports

- Feature Flags
- Dynamic log levels
- Live Config
- WebUI for tweaking config, log levels, and feature flags

Expand All @@ -34,78 +33,24 @@ Many ruby web servers fork. When the process is forked, the current realtime upd

```ruby
#config/application.rb
Prefab.init # reads PREFAB_API_KEY env var by default
Prefab.init # reads REFORGE_SDK_KEY env var by default
```

```ruby
#puma.rb
on_worker_boot do
Prefab.fork
Reforge.fork
end
```

```ruby
# unicorn.rb
after_fork do |server, worker|
Prefab.fork
Reforge.fork
end
```

## Logging & Debugging

To use dynamic logging, we recommend [semantic logger]. Add semantic_logger to your Gemfile and then we'll configure our app to use it.

### Plain ol' Ruby

```ruby
# Gemfile
gem "semantic_logger"
```

```ruby
require "semantic_logger"
require "prefab"

Prefab.init

SemanticLogger.sync!
SemanticLogger.default_level = :trace # Prefab will take over the filtering
SemanticLogger.add_appender(
io: $stdout,
formatter: :json,
filter: Prefab.log_filter,
)
```

### With Rails

```ruby
# Gemfile
gem "amazing_print"
gem "rails_semantic_logger"
```

```ruby
# config/application.rb
Prefab.init

# config/initializers/logging.rb
SemanticLogger.sync!
SemanticLogger.default_level = :trace # Prefab will take over the filtering
SemanticLogger.add_appender(
io: $stdout,
formatter: Rails.env.development? ? :color : :json,
filter: Prefab.log_filter,
)
```

```ruby
#puma.rb
on_worker_boot do
SemanticLogger.reopen
Prefab.fork
end
```

## Contributing to prefab-cloud-ruby

Expand Down
6 changes: 3 additions & 3 deletions dev/allocation_stats
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ spec.require_paths.each do |path|
end

spec.require_paths.each do |path|
require "./lib/prefab-cloud-ruby"
require "./lib/reforge-sdk"
end

require 'prefab-cloud-ruby'
require 'reforge-sdk'

$prefab = Prefab::Client.new(collect_logger_counts: false, collect_evaluation_summaries: false,
$prefab = Reforge::Client.new(collect_logger_counts: false, collect_evaluation_summaries: false,
context_upload_mode: :none)
$prefab.get('a.live.integer')

Expand Down
6 changes: 3 additions & 3 deletions dev/benchmark
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ spec.require_paths.each do |path|
end

spec.require_paths.each do |path|
require "./lib/prefab-cloud-ruby"
require "./lib/reforge-sdk"
end

require 'prefab-cloud-ruby'
require 'reforge-sdk'
require 'benchmark/ips'

prefab = Prefab::Client.new(collect_logger_counts: false, collect_evaluation_summaries: false,
prefab = Reforge::Client.new(collect_logger_counts: false, collect_evaluation_summaries: false,
context_upload_mode: :none)

prefab.get('prefab.auth.allowed_origins')
Expand Down
4 changes: 2 additions & 2 deletions dev/console
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
require 'irb'
require_relative "./script_setup"

if !ENV['PREFAB_LOG_CLIENT_BOOTSTRAP_LOG_LEVEL']
puts "run with PREFAB_LOG_CLIENT_BOOTSTRAP_LOG_LEVEL=debug (or trace) for more output"
if !ENV['REFORGE_LOG_CLIENT_BOOTSTRAP_LOG_LEVEL']
puts "run with REFORGE_LOG_CLIENT_BOOTSTRAP_LOG_LEVEL=debug (or trace) for more output"
end

# Start an IRB session
Expand Down
2 changes: 1 addition & 1 deletion dev/script_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
end

spec.require_paths.each do |path|
require "./lib/prefab-cloud-ruby"
require "./lib/reforge-sdk"
end

SemanticLogger.add_appender(io: $stdout)
59 changes: 0 additions & 59 deletions lib/prefab-cloud-ruby.rb

This file was deleted.

13 changes: 0 additions & 13 deletions lib/prefab/errors/initialization_timeout_error.rb

This file was deleted.

13 changes: 0 additions & 13 deletions lib/prefab/errors/uninitialized_error.rb

This file was deleted.

69 changes: 0 additions & 69 deletions lib/prefab/log_path_aggregator.rb

This file was deleted.

Loading
Loading