summoner-engine 0.1.2 → 0.1.4
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 +4 -4
- data/app/models/summoner/feature.rb +4 -1
- data/app/views/summoner/features/index.html.erb +55 -45
- data/lib/summoner/fetcher.rb +6 -2
- data/lib/summoner/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 38d74afa6114ee6d7167251b41dcfe09e24efdb0899eb372d8d597d8ff52a594
|
|
4
|
+
data.tar.gz: 408ac80ed9d8c78e008592e0212c0eae7ca822f2836f85f782e85e732d5b06d4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70237b1005bb56ee026ba3d0ca08b251bdd17176c6c6f0ef5da1c507c09ee912c1c3bf7af3a616859207c97b0e81e80fc9d623a8e972d4b371d8615b5bce71d4
|
|
7
|
+
data.tar.gz: b62d937f4621db6679ff6b6e7e27e0701dc723dd191b2f8b144ffff8f64a5cf4e1e81df74f540eeb44f86adfcbba602cdf98f88f92935494fd1e3dc05941a8dd
|
|
@@ -55,7 +55,10 @@ module Summoner
|
|
|
55
55
|
|
|
56
56
|
base_key = "#{Summoner.configuration.cache_namespace}:#{key}"
|
|
57
57
|
|
|
58
|
-
Rails.cache.
|
|
58
|
+
Rails.cache.delete(base_key)
|
|
59
|
+
|
|
60
|
+
version_key = "#{base_key}:version"
|
|
61
|
+
Rails.cache.write(version_key, Time.current.to_f)
|
|
59
62
|
end
|
|
60
63
|
end
|
|
61
64
|
end
|
|
@@ -3,52 +3,62 @@
|
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<div class="card">
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
<th>Namespace</th>
|
|
10
|
-
<th>Key</th>
|
|
11
|
-
<th>Description</th>
|
|
12
|
-
<th>Type</th>
|
|
13
|
-
<th>Default</th>
|
|
14
|
-
<th>Status</th>
|
|
15
|
-
<th>Actions</th>
|
|
16
|
-
</tr>
|
|
17
|
-
</thead>
|
|
18
|
-
<tbody>
|
|
19
|
-
<% @features.each do |feature| %>
|
|
6
|
+
<div style="overflow-x: auto; width: 100%;">
|
|
7
|
+
<table style="width: 100%; min-width: 800px;">
|
|
8
|
+
<thead>
|
|
20
9
|
<tr>
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<span title="Matches by: <%= feature.match_attribute %>" style="font-size: 0.7rem; color: var(--text-muted); background: var(--bg-main); padding: 0.15rem 0.4rem; border-radius: 4px; border: 1px solid var(--border-color); white-space: nowrap;">
|
|
29
|
-
<span style="opacity: 0.6;">match:</span> <%= feature.match_attribute %>
|
|
30
|
-
</span>
|
|
31
|
-
<% end %>
|
|
32
|
-
</div>
|
|
33
|
-
</td>
|
|
34
|
-
<td><code><%= feature.default_value.is_a?(String) ? feature.default_value : (JSON.generate(feature.default_value) rescue "null") %></code></td> <td>
|
|
35
|
-
<span class="badge <%= feature.active ? 'active' : 'inactive' %>">
|
|
36
|
-
<%= feature.active ? 'Active' : 'Inactive (Removed)' %>
|
|
37
|
-
</span>
|
|
38
|
-
</td>
|
|
39
|
-
<td>
|
|
40
|
-
<%= link_to "Details", feature_path(feature), class: "btn btn-outline btn-sm", style: "font-size: 0.75rem; text-decoration: none;" %>
|
|
41
|
-
</td>
|
|
10
|
+
<th>Namespace</th>
|
|
11
|
+
<th>Key</th>
|
|
12
|
+
<th>Description</th>
|
|
13
|
+
<th>Type</th>
|
|
14
|
+
<th>Default</th>
|
|
15
|
+
<th>Status</th>
|
|
16
|
+
<th>Actions</th>
|
|
42
17
|
</tr>
|
|
43
|
-
|
|
18
|
+
</thead>
|
|
19
|
+
<tbody>
|
|
20
|
+
<% @features.each do |feature| %>
|
|
21
|
+
<tr>
|
|
22
|
+
<td><strong><%= feature.namespace %></strong></td>
|
|
23
|
+
<td><%= feature.name %></td>
|
|
24
|
+
<td title="<%= feature.description %>"><%= feature.description.present? ? truncate(feature.description, length: 55) : "-" %></td>
|
|
25
|
+
<td>
|
|
26
|
+
<div class="d-flex align-items-center flex-wrap gap-2">
|
|
27
|
+
<code><%= feature.value_type %></code>
|
|
28
|
+
<% if feature.match_attribute.present? %>
|
|
29
|
+
<span title="Matches by: <%= feature.match_attribute %>" style="font-size: 0.7rem; color: var(--text-muted); background: var(--bg-main); padding: 0.15rem 0.4rem; border-radius: 4px; border: 1px solid var(--border-color); white-space: nowrap;">
|
|
30
|
+
<span style="opacity: 0.6;">match:</span> <%= feature.match_attribute %>
|
|
31
|
+
</span>
|
|
32
|
+
<% end %>
|
|
33
|
+
</div>
|
|
34
|
+
</td>
|
|
35
|
+
|
|
36
|
+
<% default_str = feature.default_value.is_a?(String) ? feature.default_value : (JSON.generate(feature.default_value) rescue "null") %>
|
|
37
|
+
<td style="max-width: 250px;">
|
|
38
|
+
<code style="display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" title="<%= default_str %>">
|
|
39
|
+
<%= truncate(default_str, length: 60) %>
|
|
40
|
+
</code>
|
|
41
|
+
</td>
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
<td>
|
|
44
|
+
<span class="badge <%= feature.active ? 'active' : 'inactive' %>">
|
|
45
|
+
<%= feature.active ? 'Active' : 'Inactive (Removed)' %>
|
|
46
|
+
</span>
|
|
47
|
+
</td>
|
|
48
|
+
<td>
|
|
49
|
+
<%= link_to "Details", feature_path(feature), class: "btn btn-outline btn-sm", style: "font-size: 0.75rem; text-decoration: none; white-space: nowrap;" %>
|
|
50
|
+
</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<% end %>
|
|
53
|
+
|
|
54
|
+
<% if @features.empty? %>
|
|
55
|
+
<tr>
|
|
56
|
+
<td colspan="7" class="text-center text-muted" style="padding: 3rem;">
|
|
57
|
+
No features found. Make sure you have run the YAML sync.
|
|
58
|
+
</td>
|
|
59
|
+
</tr>
|
|
60
|
+
<% end %>
|
|
61
|
+
</tbody>
|
|
62
|
+
</table>
|
|
63
|
+
</div>
|
|
54
64
|
</div>
|
data/lib/summoner/fetcher.rb
CHANGED
|
@@ -5,10 +5,14 @@ module Summoner
|
|
|
5
5
|
|
|
6
6
|
return fetch_from_db(feature_key, entity) unless config.cache_enabled
|
|
7
7
|
|
|
8
|
+
base_key = "#{config.cache_namespace}:#{feature_key}"
|
|
9
|
+
version_key = "#{base_key}:version"
|
|
10
|
+
current_version = Rails.cache.fetch(version_key) { 1 }
|
|
11
|
+
|
|
8
12
|
cache_key = if entity
|
|
9
|
-
"#{
|
|
13
|
+
"#{base_key}:v#{current_version}:#{entity.class.name.underscore}:#{entity.id}"
|
|
10
14
|
else
|
|
11
|
-
"#{
|
|
15
|
+
"#{base_key}:v#{current_version}"
|
|
12
16
|
end
|
|
13
17
|
|
|
14
18
|
Rails.cache.fetch(cache_key, expires_in: config.cache_expires_in) do
|
data/lib/summoner/version.rb
CHANGED