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 +4 -4
- data/lib/redmine_plugin_kit/version.rb +1 -1
- data/lib/redmine_plugin_kit.rb +11 -0
- data/lib/tasks/redmine_plugin_kit.rake +2 -4
- data/redmine_plugin_kit-1.0.9.gem +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 742a6b7ef926f76e6c7615961748e673590423a410041567a15743692337e753
|
|
4
|
+
data.tar.gz: 2a63b5273c96b44f8c42f7f473a462acf2352979137331e61b3baca6fd835e1f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b339aad3aa4192aecc5b385678b656a93e1b3e820f0d7f20500f89c8bd35f81be1c2dd49c66e860721b75d4b856bd4058a7eced562941ee802df0738c48f967
|
|
7
|
+
data.tar.gz: 4d11d3f39bcc013d6addd4cbc03ada64a13f51b0be1e5ca446f693f4a6e88e0c7431a67415078ee88df07d49336395a7986e04778ef513061f9da5e96355357c
|
data/lib/redmine_plugin_kit.rb
CHANGED
|
@@ -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
|
-
|
|
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.
|
|
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
|