summoner-engine 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0c140e7b6dcffcd46213c17ea06f93723b115aae006686c64de4cda0e66d0824
4
- data.tar.gz: bf77ad299888e02d1e2e9712249776eb6ae6b17d01157f3b20be024350886306
3
+ metadata.gz: 407502febd6136a53675b91cc382f8a336d2d74e785775667627617c8803b973
4
+ data.tar.gz: 517887601f4b9083783e555bf8c095941c225e24a89cd8f465a4d10bb7914fec
5
5
  SHA512:
6
- metadata.gz: 85eba4331932b10f9bf10aaf3eeeb48f8e12083145c4f247ef8f4e92f475a3112d3da3837863146dac9e2ed24f01bbe4a9a813bbfcc1d99d2ab7178740d4fa2f
7
- data.tar.gz: 84e1a26a354c4e6cba7507d61b22a02567b960a8b934e992f362947c6b4cc372083d3ec3bbc51f83c900075397b1f0ff5f5e18e5b462ebf76fc72d945ea68351
6
+ metadata.gz: 8b58450070bd04adb92ba546b6eed4ac84c5c3710544ac300e3b3c81df78470e18de97131cbec9447c78e1bbf6564b946975edb5ffcf0a7afa88f479b6ecb830
7
+ data.tar.gz: 4c707a493fae11abc7d140f70227aa9e238669ab6f0dda6076b14040bb41ad47c1420f60775141f8356995608c065ac8876abb89d28373c64aaa343e03c56e50
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # Summoner
1
+ # Summoner Engine
2
2
  An advanced, flexible, and powerful Feature Toggle, Dynamic Configuration, and Attribute-Based Access Control (ABAC) engine for Ruby on Rails.
3
3
 
4
- Summoner goes way beyond simple booleans. It allows you to manage global or **Entity-specific** configurations (e.g., `User`, `Account`), perform gradual rollouts based on attributes (like `role` or `plan`), attach editable descriptions to each feature, and create surgical exceptions (_overrides_) directly through an elegant Web UI. All wrapped in a **lightning-fast Caching layer** to protect your database.
4
+ Summoner Engine goes way beyond simple booleans. It allows you to manage global or **Entity-specific** configurations (e.g., `User`, `Account`), perform gradual rollouts based on attributes (like `role` or `plan`), attach editable descriptions to each feature, and create surgical exceptions (_overrides_) directly through an elegant Web UI. All wrapped in a **lightning-fast Caching layer** to protect your database.
5
5
 
6
6
  ## Table of Contents
7
7
  - [Key Features](#key-features)
@@ -29,9 +29,11 @@ Summoner goes way beyond simple booleans. It allows you to manage global or **En
29
29
  Add this line to your application's `Gemfile`:
30
30
 
31
31
  ```ruby
32
- gem "summoner"
32
+ gem "summoner-engine"
33
33
  ```
34
34
 
35
+ The gem name is `summoner-engine`, but the internal Ruby namespace remains `Summoner`, so existing code and configuration can keep using `Summoner::Entity`, `Summoner::Sync`, and `Summoner.configure`.
36
+
35
37
  Install the gem and run the installation generator:
36
38
 
37
39
  ```bash
@@ -2,7 +2,7 @@
2
2
  <%= link_to "← Back to Feature", feature_path(@feature), class: "btn btn-outline btn-sm", style: "text-decoration: none;" %>
3
3
  </div>
4
4
 
5
- <div class="card" style="max-width: 600px;">
5
+ <div class="card mx-auto">
6
6
  <div class="card-header">
7
7
  <h2 class="mb-0">Edit Default Value</h2>
8
8
  </div>
@@ -24,7 +24,7 @@
24
24
  <%= form_with model: @feature, local: true do |f| %>
25
25
  <div class="form-group mb-4">
26
26
  <%= f.label :default_value, "New Default Value", class: "form-label" %>
27
- <%= f.text_field :default_value, value: @feature.default_value.is_a?(String) ? @feature.default_value : @feature.default_value.to_json, class: "form-control" %>
27
+ <%= f.text_field :default_value, value: @feature.default_value.is_a?(String) ? @feature.default_value : (JSON.generate(@feature.default_value) rescue ""), class: "form-control" %>
28
28
  </div>
29
29
 
30
30
  <div class="form-group mb-4">
@@ -31,8 +31,7 @@
31
31
  <% end %>
32
32
  </div>
33
33
  </td>
34
- <td><code><%= feature.default_value.to_json %></code></td>
35
- <td>
34
+ <td><code><%= feature.default_value.is_a?(String) ? feature.default_value : (JSON.generate(feature.default_value) rescue "null") %></code></td> <td>
36
35
  <span class="badge <%= feature.active ? 'active' : 'inactive' %>">
37
36
  <%= feature.active ? 'Active' : 'Inactive (Removed)' %>
38
37
  </span>
@@ -25,7 +25,7 @@
25
25
  <span>Matches Attribute:</span> <code><%= @feature.match_attribute %></code>
26
26
  <% end %>
27
27
 
28
- <span>Default Value:</span> <code><%= @feature.default_value.to_json %></code>
28
+ <span>Default Value:</span> <code><%= @feature.default_value.is_a?(String) ? @feature.default_value : (JSON.generate(@feature.default_value) rescue "null") %></code>
29
29
  <span>Status:</span>
30
30
  <div>
31
31
  <span class="badge <%= @feature.active ? 'active' : 'inactive' %>">
@@ -55,7 +55,7 @@
55
55
  <tr>
56
56
  <td><%= override.flaggable_type %></td>
57
57
  <td><%= override.flaggable_id %></td>
58
- <td><code><%= override.value.to_json %></code></td>
58
+ <td><code><%= override.value.is_a?(String) ? override.value : (JSON.generate(override.value) rescue "null") %></code></td>
59
59
  <td>
60
60
  <div class="d-flex gap-2 align-items-center">
61
61
  <%= button_to "Edit", edit_feature_override_path(@feature, override),
@@ -27,7 +27,7 @@
27
27
  <% if @feature.value_type == 'boolean' %>
28
28
  <%= f.select :value, [['True', 'true'], ['False', 'false']], { selected: @override.value.to_s }, class: "form-control" %>
29
29
  <% else %>
30
- <%= f.text_field :value, value: @override.value.is_a?(String) ? @override.value : @override.value.to_json, class: "form-control" %>
30
+ <%= f.text_field :value, value: @override.value.is_a?(String) ? @override.value : (JSON.generate(@override.value) rescue ""), class: "form-control" %>
31
31
  <% end %>
32
32
  </div>
33
33
 
@@ -1,3 +1,5 @@
1
+ require "summoner_engine"
2
+
1
3
  Summoner.configure do |config|
2
4
  # Enable or disable the use of Rails.cache for features (Default: true)
3
5
  # config.cache_enabled = true
@@ -1,3 +1,3 @@
1
1
  module Summoner
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/summoner.rb CHANGED
@@ -1,4 +1,10 @@
1
- Dir[File.join(__dir__, "summoner", "*.rb")].sort.each { |file| require file }
1
+ require_relative "summoner/configuration"
2
+
3
+ Dir[File.join(__dir__, "summoner", "*.rb")].sort.each do |file|
4
+ next if File.basename(file) == "engine.rb" && !defined?(Rails)
5
+
6
+ require file
7
+ end
2
8
 
3
9
  module Summoner
4
10
  def self.get(feature_key)
@@ -0,0 +1 @@
1
+ require_relative "summoner"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: summoner-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Rodrigues
@@ -80,6 +80,7 @@ files:
80
80
  - lib/summoner/loader.rb
81
81
  - lib/summoner/sync.rb
82
82
  - lib/summoner/version.rb
83
+ - lib/summoner_engine.rb
83
84
  - lib/tasks/summoner_tasks.rake
84
85
  homepage: https://github.com/feliperodrigs1/summoner
85
86
  licenses: