setting_accessors 0.2.0 → 0.3.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/.gitignore +2 -2
- data/.travis.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/lib/setting_accessors/integration.rb +1 -10
- data/lib/setting_accessors/internal.rb +6 -2
- data/lib/setting_accessors/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/test_helper.rb +8 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ba51cce908ff75943938e86e01d1aed48b0ccf6
|
4
|
+
data.tar.gz: 7d164c7545cb6adfa0741b8dabf3b4a7bfae5a74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee4917d83045b732589124c938999204b8458859707119faa78d7c2aa3626d4f0949d1cf34afc4d994dda2f4740ceefe4679ff2aec004e7f0382bc2a1c6f1cf7
|
7
|
+
data.tar.gz: 3feb815f194119f2817314c3b6b01880083132eae3972dff75b9ae38c821ae1ee9a4bf105d5105294af7b84ad6c901508a0804f132e5562b0e7a46779bd0ac1f
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -36,20 +36,11 @@ module SettingAccessors::Integration
|
|
36
36
|
# setting and return +nil+ if none was specified previously.
|
37
37
|
#
|
38
38
|
def setting_accessor(setting_name, options = {})
|
39
|
-
#If the database table does not yet exist,
|
40
|
-
return unless self.table_exists?
|
41
|
-
|
42
39
|
fallback = options.delete(:fallback)
|
43
40
|
|
44
41
|
SettingAccessors::Internal.set_class_setting(self, setting_name, options)
|
45
42
|
|
46
|
-
setting_type = SettingAccessors::Internal.setting_value_type(setting_name, self
|
47
|
-
|
48
|
-
#Create a virtual column in the models column hash.
|
49
|
-
#This is currently not absolutely necessary, but will become important once
|
50
|
-
#Time etc. are supported. Otherwise, Rails won't be able to e.g. automatically
|
51
|
-
#create multi-param fields in forms.
|
52
|
-
self.columns_hash[setting_name.to_s] = OpenStruct.new(type: setting_type)
|
43
|
+
setting_type = SettingAccessors::Internal.setting_value_type(setting_name, self).to_sym
|
53
44
|
|
54
45
|
#Add the setting's name to the list of setting_accessors for this class
|
55
46
|
SettingAccessors::Internal.add_setting_accessor_name(self, setting_name)
|
@@ -76,8 +76,12 @@ module SettingAccessors
|
|
76
76
|
# - If it's a setting defined in a setting_accessor call, the information is taken from this call
|
77
77
|
# - Otherwise, an empty hash is returned
|
78
78
|
#
|
79
|
-
def self.setting_data(setting_name,
|
80
|
-
|
79
|
+
def self.setting_data(setting_name, assignable_class = nil)
|
80
|
+
# As a convenience function (and to keep the existing code working),
|
81
|
+
# it is possible to provide a class or an instance of said class
|
82
|
+
assignable_class &&= assignable_class.class unless assignable_class.is_a?(Class)
|
83
|
+
|
84
|
+
(assignable_class && self.get_class_setting(assignable_class, setting_name)) ||
|
81
85
|
self.global_config[setting_name.to_s] ||
|
82
86
|
{}
|
83
87
|
end
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/test_helper.rb
CHANGED
@@ -18,6 +18,14 @@ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
|
|
18
18
|
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
19
19
|
end
|
20
20
|
|
21
|
+
# configure shoulda matchers
|
22
|
+
Shoulda::Matchers.configure do |config|
|
23
|
+
config.integrate do |with|
|
24
|
+
with.test_framework :minitest
|
25
|
+
with.library :rails
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
21
29
|
# For generators
|
22
30
|
require "rails/generators/test_case"
|
23
31
|
require "generators/setting_accessors/install_generator"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: setting_accessors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Exner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- ".codeclimate.yml"
|
127
127
|
- ".gitignore"
|
128
128
|
- ".travis.yml"
|
129
|
+
- CHANGELOG.md
|
129
130
|
- Gemfile
|
130
131
|
- LICENSE.txt
|
131
132
|
- README.md
|
@@ -224,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
225
|
version: '0'
|
225
226
|
requirements: []
|
226
227
|
rubyforge_project:
|
227
|
-
rubygems_version: 2.6.
|
228
|
+
rubygems_version: 2.6.14
|
228
229
|
signing_key:
|
229
230
|
specification_version: 4
|
230
231
|
summary: A global key-value-store and virtual model columns
|