redmine_plugin_kit 1.0.9 → 1.0.10

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: 94857a34d940b2fccba2f613e3299cef59acc88c20c3279671831fd923c3e28e
4
- data.tar.gz: 4d6e9c22ea18b5050b9084fe60b577a4cb3da032801a13a0b16f6ec99664a443
3
+ metadata.gz: 742a6b7ef926f76e6c7615961748e673590423a410041567a15743692337e753
4
+ data.tar.gz: 2a63b5273c96b44f8c42f7f473a462acf2352979137331e61b3baca6fd835e1f
5
5
  SHA512:
6
- metadata.gz: 90fe0d769fa01295f8dea757cff3aa5f9dc48005c8ee4ea356b6cdece1da7e0330f11020359cee3f9cb53c587eaa95281c7b7d1493d4a95be8cad1e7dbe26ad9
7
- data.tar.gz: f3d7a85ab307ffe4425229878f41581e03a04a833e34f626e8336ae52005e6f2a04be166517d6fcdb6b32489ceda1d08ba2d58ebef77f3265547c71a9ebf605f
6
+ metadata.gz: 3b339aad3aa4192aecc5b385678b656a93e1b3e820f0d7f20500f89c8bd35f81be1c2dd49c66e860721b75d4b856bd4058a7eced562941ee802df0738c48f967
7
+ data.tar.gz: 4d11d3f39bcc013d6addd4cbc03ada64a13f51b0be1e5ca446f693f4a6e88e0c7431a67415078ee88df07d49336395a7986e04778ef513061f9da5e96355357c
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RedminePluginKit
4
- VERSION = '1.0.9'
4
+ VERSION = '1.0.10'
5
5
  end
@@ -26,6 +26,17 @@ module RedminePluginKit
26
26
  !true?(value)
27
27
  end
28
28
 
29
+ # Returns plugin settings with indifferent access and the given setting applied.
30
+ # Redmine stores plugin settings from the settings form this way, too. Without it,
31
+ # a string key from the command line would be added next to an existing symbol key,
32
+ # and plugins reading the symbol key would never see the new value.
33
+ def plugin_settings_with(settings, setting, value)
34
+ settings = {} unless settings.is_a? Hash
35
+ settings = settings.with_indifferent_access
36
+ settings[setting] = value
37
+ settings
38
+ end
39
+
29
40
  def textarea_cols(text, min: 8, max: 20)
30
41
  [[min, text.to_s.length / 50].max, max].min # rubocop: disable Style/ComparableClamp
31
42
  end
@@ -46,9 +46,7 @@ namespace :redmine_plugin_kit do
46
46
  Setting[setting.to_sym] = value
47
47
  else
48
48
  plugin_name = :"plugin_#{name}"
49
- plugin_settings = Setting[plugin_name]
50
- plugin_settings[setting] = value
51
- Setting[plugin_name] = plugin_settings
49
+ Setting[plugin_name] = RedminePluginKit.plugin_settings_with Setting[plugin_name], setting, value
52
50
  end
53
51
  end
54
52
 
@@ -76,7 +74,7 @@ namespace :redmine_plugin_kit do
76
74
  else
77
75
  plugin_name = :"plugin_#{name}"
78
76
  plugin_settings = Setting[plugin_name]
79
- puts plugin_settings[setting]
77
+ puts plugin_settings.with_indifferent_access[setting] if plugin_settings.is_a? Hash
80
78
  end
81
79
  end
82
80
 
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_plugin_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlphaNodes
@@ -55,6 +55,7 @@ files:
55
55
  - lib/redmine_plugin_kit/plugin_base.rb
56
56
  - lib/redmine_plugin_kit/version.rb
57
57
  - lib/tasks/redmine_plugin_kit.rake
58
+ - redmine_plugin_kit-1.0.9.gem
58
59
  homepage: https://github.com/alphanodes/redmine_plugin_kit
59
60
  licenses:
60
61
  - GPL-2.0