ultra_settings 1.1.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d1abe56c058f7f49b6779f96ff26d30d1ee3e5999bf87c968ad33e8facc6373
4
- data.tar.gz: 6874bafd6563bc37df15cfa4fb14119a8ad4ec4b82e70360701939942079c2a3
3
+ metadata.gz: 0ff5c5961b5070a9234049d2588bd59150e82d2cf87b46c0686067c6d72dd815
4
+ data.tar.gz: 8df668372d8f6c7dd4c72ad55a789c8bd854bf0bfa0509a5e4a1da69bc74e93e
5
5
  SHA512:
6
- metadata.gz: 0d06174f43873463ec1fa05d7289d4a32e404a9baaa582eac26c79182bfa530ebe9cf4852cf6835d09e4cf98a6b06a788c659d54b488198b0f2c5072e725b7a8
7
- data.tar.gz: 7426f9c5ff9bfd7153a3d4d916bc45f6f10821b891c821371800449eeec29e0bce3b2bf9693f85b8a6c780a2fb6044fd5bfd66f003ffd77ef005c21dada4a3b9
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.1.2
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 include?(name)
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.include?(name)
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.include?(name.to_s)
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
- config_name = file_path.basename("_configuration.rb")
27
- class_name = file_path.relative_path_from(app_config_dir).to_s.chomp(".rb").classify
28
- UltraSettings.add(config_name, class_name)
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
@@ -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 ArgementError.new("Invalid configuration name: #{name.inspect}")
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 include?(class_name)
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: 1.1.2
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-18 00:00:00.000000000 Z
11
+ date: 2024-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler