ultra_settings 1.1.2 → 2.0.0
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/CHANGELOG.md +11 -0
- data/VERSION +1 -1
- data/app/index.html.erb +2 -2
- data/lib/ultra_settings/configuration.rb +3 -3
- data/lib/ultra_settings/railtie.rb +6 -3
- data/lib/ultra_settings.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ff5c5961b5070a9234049d2588bd59150e82d2cf87b46c0686067c6d72dd815
|
4
|
+
data.tar.gz: 8df668372d8f6c7dd4c72ad55a789c8bd854bf0bfa0509a5e4a1da69bc74e93e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7734298e87bd1fa4b7649ee5ddc64a0ef50f0e6e439bda7eb2042af055141ad5147ee07187ea53bbafbd5372430674a442f77e8c0277099cc8ff9ad7e1b20429
|
7
|
+
data.tar.gz: 565fc7f9071292490d41a634c1b0c89530cbc065f925d52c3dcc25d8e1009bf8fe45ed84aa809fe6ab150d20d79bd9f90f47524ee2a161dfc9d90fc60ae5fb65
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## 2.0.0
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- **Breaking Change:** Fix conflict with overridding the standard `include?` method on configuration classes. These methods are now defined as `UltraSettings.added?` and `UltraSettings::Configuration.include_field?`.
|
12
|
+
- **Breaking Change:** Include namespace in autoloaded configuration names for Rails applications to avoid conflicts on classes in different namespaces.
|
13
|
+
|
14
|
+
### Changed
|
15
|
+
|
16
|
+
- Use configuration class in in web UI dropdown menu.
|
17
|
+
|
7
18
|
## 1.1.2
|
8
19
|
|
9
20
|
### Added
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/app/index.html.erb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
<div class="ultra-settings-nav">
|
2
|
-
<form onsubmit="return false">
|
2
|
+
<form onsubmit="return false" style="margin-bottom: 0.5rem;">
|
3
3
|
<select class="<%= html_escape(select_class) %>" size="1" id="config-selector">
|
4
4
|
<% UltraSettings.__configuration_names__.sort.each do |name| %>
|
5
|
-
<option value="config-<%= html_escape(name) %>"><%= html_escape(name) %></option>
|
5
|
+
<option value="config-<%= html_escape(name) %>"><%= html_escape(UltraSettings.send(name).class.name) %></option>
|
6
6
|
<% end %>
|
7
7
|
</select>
|
8
8
|
</form>
|
@@ -86,12 +86,12 @@ module UltraSettings
|
|
86
86
|
#
|
87
87
|
# @param name [Symbol, String] The name of the field.
|
88
88
|
# @return [Boolean]
|
89
|
-
def
|
89
|
+
def include_field?(name)
|
90
90
|
name = name.to_s
|
91
91
|
return true if defined_fields.include?(name)
|
92
92
|
|
93
93
|
if superclass <= Configuration
|
94
|
-
superclass.
|
94
|
+
superclass.include_field?(name)
|
95
95
|
else
|
96
96
|
false
|
97
97
|
end
|
@@ -446,7 +446,7 @@ module UltraSettings
|
|
446
446
|
end
|
447
447
|
|
448
448
|
def include?(name)
|
449
|
-
self.class.
|
449
|
+
self.class.include_field?(name.to_s)
|
450
450
|
end
|
451
451
|
|
452
452
|
def override!(values, &block)
|
@@ -23,9 +23,12 @@ module UltraSettings
|
|
23
23
|
|
24
24
|
app_config_dir = Rails.root.join(directory)
|
25
25
|
app_config_dir.glob("**/*_configuration.rb").each do |file_path|
|
26
|
-
|
27
|
-
class_name =
|
28
|
-
UltraSettings.
|
26
|
+
relative_path = file_path.relative_path_from(app_config_dir).to_s
|
27
|
+
class_name = relative_path.chomp(".rb").classify
|
28
|
+
unless UltraSettings.added?(class_name)
|
29
|
+
config_name = class_name.delete_suffix("Configuration").underscore.tr("/", "_")
|
30
|
+
UltraSettings.add(config_name, class_name)
|
31
|
+
end
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
data/lib/ultra_settings.rb
CHANGED
@@ -46,7 +46,7 @@ module UltraSettings
|
|
46
46
|
def add(name, klass = nil)
|
47
47
|
name = name.to_s
|
48
48
|
unless name.match?(VALID_NAME__PATTERN)
|
49
|
-
raise
|
49
|
+
raise ArgumentError.new("Invalid configuration name: #{name.inspect}")
|
50
50
|
end
|
51
51
|
|
52
52
|
class_name = klass&.to_s
|
@@ -67,7 +67,7 @@ module UltraSettings
|
|
67
67
|
#
|
68
68
|
# @param class_name [Class, String] The name of the configuration class.
|
69
69
|
# @return [Boolean]
|
70
|
-
def
|
70
|
+
def added?(class_name)
|
71
71
|
@configurations.values.collect(&:to_s).include?(class_name.to_s)
|
72
72
|
end
|
73
73
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultra_settings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Durand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|