settingson 1.7.6 → 1.7.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -1
- data/.travis.yml +9 -3
- data/Appraisals +10 -2
- data/README.md +25 -6
- data/Rakefile +5 -2
- data/app/models/concerns/settingson/base.rb +12 -7
- data/gemfiles/4.2.gemfile +3 -3
- data/gemfiles/4.2.gemfile.lock +86 -92
- data/gemfiles/5.0.gemfile +3 -3
- data/gemfiles/5.0.gemfile.lock +96 -101
- data/gemfiles/5.1.gemfile +8 -0
- data/gemfiles/5.1.gemfile.lock +168 -0
- data/gemfiles/5.2.gemfile +8 -0
- data/gemfiles/5.2.gemfile.lock +168 -0
- data/lib/generators/settingson/settingson_generator.rb +4 -3
- data/lib/settingson/config.rb +1 -0
- data/lib/settingson/default.rb +11 -0
- data/lib/settingson/store.rb +32 -23
- data/lib/settingson/store/default.rb +25 -0
- data/lib/settingson/store/general.rb +3 -0
- data/lib/settingson/version.rb +1 -1
- data/settingson.gemspec +2 -3
- data/spec/dummy/config/environments/development.rb +2 -0
- data/spec/dummy/config/environments/test.rb +7 -2
- data/spec/dummy/config/initializers/settingson.rb +1 -0
- data/spec/models/settings_spec.rb +12 -0
- data/spec/models/settingson/defaults_spec.rb +36 -0
- data/spec/spec_helper.rb +3 -3
- metadata +14 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '029f4b7934884ec49504aa25070f056bd41c303cc4aa60e268f9874ef2135dbd'
|
4
|
+
data.tar.gz: 73c561c6fbd85eb06e4d65548228e0c287bfa801a58b7f3d28c9e25246639e7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f48a3d9ddee9b3c729b6c4ebf4301dbcef3913cf75d349510cd2555bf9d0699e2e18e5826c52cefc3242daac87c6d248c7debbdcad06e558e1b980eab6f279c8
|
7
|
+
data.tar.gz: 12df9a647182c640647ac6242021e18e6bd0a67fa7e393b737eb96a9d35a4fa1b93dcb8137912d1ded6af3a41298359ab9189e092c4668050e4a09c5828cc40e
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
language: ruby
|
2
|
+
cache: bundler
|
2
3
|
|
3
4
|
sudo: false
|
4
|
-
cache: bundler
|
5
|
+
#cache: bundler
|
5
6
|
|
6
|
-
script: bundle exec rspec
|
7
|
+
script: "bundle exec rspec && bundle exec codeclimate-test-reporter"
|
7
8
|
|
8
9
|
rvm:
|
9
|
-
- 2.2
|
10
|
+
- 2.2
|
11
|
+
- 2.3
|
12
|
+
- 2.4
|
13
|
+
- 2.6
|
10
14
|
|
11
15
|
gemfile:
|
12
16
|
- gemfiles/4.2.gemfile
|
13
17
|
- gemfiles/5.0.gemfile
|
18
|
+
- gemfiles/5.1.gemfile
|
19
|
+
- gemfiles/5.2.gemfile
|
14
20
|
|
15
21
|
env:
|
16
22
|
- CODECLIMATE_REPO_TOKEN=620b22e287791de2c9f8a522182ddf57098302ff8958768f8192eaaa7d8a685d
|
data/Appraisals
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
appraise "4.2" do
|
2
|
-
gem "rails", "~> 4.2
|
2
|
+
gem "rails", "~> 4.2"
|
3
3
|
end
|
4
4
|
|
5
5
|
appraise "5.0" do
|
6
|
-
gem "rails", "~> 5.0
|
6
|
+
gem "rails", "~> 5.0"
|
7
|
+
end
|
8
|
+
|
9
|
+
appraise "5.1" do
|
10
|
+
gem "rails", "~> 5.1"
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise "5.2" do
|
14
|
+
gem "rails", "~> 5.1"
|
7
15
|
end
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
# Settingson
|
7
7
|
|
8
|
-
Simple settings management for applications (Ruby on Rails
|
8
|
+
Simple settings management for applications (Ruby on Rails with ActiveRecord)
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -36,7 +36,10 @@ Replace MODEL by the class name used for the applications settings, it's frequen
|
|
36
36
|
|
37
37
|
Next, you'll usually run
|
38
38
|
```console
|
39
|
+
bin/rails db:migrate
|
40
|
+
# or
|
39
41
|
rake db:migrate
|
42
|
+
# for rails 4 or less
|
40
43
|
```
|
41
44
|
as the generator will have created a migration file (if your ORM supports them).
|
42
45
|
|
@@ -44,8 +47,8 @@ as the generator will have created a migration file (if your ORM supports them).
|
|
44
47
|
|
45
48
|
shell commands:
|
46
49
|
```console
|
47
|
-
rails g settingson Settings
|
48
|
-
|
50
|
+
bin/rails g settingson Settings
|
51
|
+
bin/rails db:migrate
|
49
52
|
```
|
50
53
|
|
51
54
|
code:
|
@@ -117,15 +120,31 @@ end
|
|
117
120
|
## The initial values
|
118
121
|
in config/initializers/settingson.rb
|
119
122
|
```ruby
|
120
|
-
Settings.defaults do |
|
121
|
-
|
122
|
-
|
123
|
+
Settings.defaults do |default|
|
124
|
+
default.server.smtp.host = 'host'
|
125
|
+
default.server.smtp.port = 25
|
123
126
|
end
|
124
127
|
|
125
128
|
Settings.server.smtp.host # => 'host'
|
126
129
|
Settings.server.smtp.port # => 25
|
127
130
|
```
|
128
131
|
|
132
|
+
## Debug and testings
|
133
|
+
in config/initializers/settingson.rb
|
134
|
+
```ruby
|
135
|
+
|
136
|
+
if Rails.env.development?
|
137
|
+
Settings.configure.debug = true
|
138
|
+
Settings.configure.trace = 3
|
139
|
+
Settings.configure.cache.enabled = false # default: true
|
140
|
+
end
|
141
|
+
```
|
142
|
+
Caching is disabled by default only in test environment.
|
143
|
+
|
144
|
+
## TODO:
|
145
|
+
* Skip key search when assignment requested
|
146
|
+
|
147
|
+
|
129
148
|
## Contributing
|
130
149
|
|
131
150
|
1. Fork it ( https://github.com/daanforever/settingson/fork )
|
data/Rakefile
CHANGED
@@ -19,15 +19,20 @@ module Settingson::Base
|
|
19
19
|
@_settings
|
20
20
|
end
|
21
21
|
|
22
|
-
# Settings.defaults do |
|
23
|
-
#
|
24
|
-
#
|
22
|
+
# Settings.defaults do |default|
|
23
|
+
# default.server.host = 'host'
|
24
|
+
# default.server.port = 80
|
25
25
|
# end
|
26
26
|
def defaults
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
@__defaults = Settingson::Store::Default.new( klass: self )
|
28
|
+
|
29
|
+
if block_given?
|
30
|
+
Rails.application.config.after_initialize do
|
31
|
+
yield @__defaults
|
32
|
+
end
|
30
33
|
end
|
34
|
+
|
35
|
+
@__defaults
|
31
36
|
end
|
32
37
|
|
33
38
|
# Settings.from_hash('smtp.host' => 'host')
|
@@ -53,7 +58,7 @@ module Settingson::Base
|
|
53
58
|
def method_missing(symbol, *args)
|
54
59
|
super
|
55
60
|
rescue NameError, NoMethodError
|
56
|
-
Settingson::Store.new(klass: self).send(symbol, *args)
|
61
|
+
Settingson::Store::General.new(klass: self).send(symbol, *args)
|
57
62
|
end
|
58
63
|
|
59
64
|
end # module ClassMethods
|
data/gemfiles/4.2.gemfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "codeclimate-test-reporter", :
|
6
|
-
gem "rails", "~> 4.2
|
5
|
+
gem "codeclimate-test-reporter", group: :test, require: nil
|
6
|
+
gem "rails", "~> 4.2"
|
7
7
|
|
8
|
-
gemspec :
|
8
|
+
gemspec path: "../"
|
data/gemfiles/4.2.gemfile.lock
CHANGED
@@ -1,149 +1,144 @@
|
|
1
1
|
PATH
|
2
|
-
remote:
|
2
|
+
remote: ..
|
3
3
|
specs:
|
4
|
-
settingson (1.
|
4
|
+
settingson (1.7.10)
|
5
5
|
rails (>= 4.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actionmailer (4.2.
|
11
|
-
actionpack (= 4.2.
|
12
|
-
actionview (= 4.2.
|
13
|
-
activejob (= 4.2.
|
10
|
+
actionmailer (4.2.10)
|
11
|
+
actionpack (= 4.2.10)
|
12
|
+
actionview (= 4.2.10)
|
13
|
+
activejob (= 4.2.10)
|
14
14
|
mail (~> 2.5, >= 2.5.4)
|
15
15
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
-
actionpack (4.2.
|
17
|
-
actionview (= 4.2.
|
18
|
-
activesupport (= 4.2.
|
16
|
+
actionpack (4.2.10)
|
17
|
+
actionview (= 4.2.10)
|
18
|
+
activesupport (= 4.2.10)
|
19
19
|
rack (~> 1.6)
|
20
20
|
rack-test (~> 0.6.2)
|
21
21
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
22
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
-
actionview (4.2.
|
24
|
-
activesupport (= 4.2.
|
23
|
+
actionview (4.2.10)
|
24
|
+
activesupport (= 4.2.10)
|
25
25
|
builder (~> 3.1)
|
26
26
|
erubis (~> 2.7.0)
|
27
27
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
28
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
29
|
-
activejob (4.2.
|
30
|
-
activesupport (= 4.2.
|
28
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
29
|
+
activejob (4.2.10)
|
30
|
+
activesupport (= 4.2.10)
|
31
31
|
globalid (>= 0.3.0)
|
32
|
-
activemodel (4.2.
|
33
|
-
activesupport (= 4.2.
|
32
|
+
activemodel (4.2.10)
|
33
|
+
activesupport (= 4.2.10)
|
34
34
|
builder (~> 3.1)
|
35
|
-
activerecord (4.2.
|
36
|
-
activemodel (= 4.2.
|
37
|
-
activesupport (= 4.2.
|
35
|
+
activerecord (4.2.10)
|
36
|
+
activemodel (= 4.2.10)
|
37
|
+
activesupport (= 4.2.10)
|
38
38
|
arel (~> 6.0)
|
39
|
-
activesupport (4.2.
|
39
|
+
activesupport (4.2.10)
|
40
40
|
i18n (~> 0.7)
|
41
|
-
json (~> 1.7, >= 1.7.7)
|
42
41
|
minitest (~> 5.1)
|
43
42
|
thread_safe (~> 0.3, >= 0.3.4)
|
44
43
|
tzinfo (~> 1.1)
|
45
|
-
appraisal (2.
|
44
|
+
appraisal (2.2.0)
|
46
45
|
bundler
|
47
46
|
rake
|
48
47
|
thor (>= 0.14.0)
|
49
|
-
arel (6.0.
|
50
|
-
builder (3.2.
|
51
|
-
codeclimate-test-reporter (0.
|
52
|
-
simplecov (
|
53
|
-
concurrent-ruby (1.0.
|
54
|
-
|
55
|
-
|
48
|
+
arel (6.0.4)
|
49
|
+
builder (3.2.3)
|
50
|
+
codeclimate-test-reporter (1.0.8)
|
51
|
+
simplecov (<= 0.13)
|
52
|
+
concurrent-ruby (1.0.5)
|
53
|
+
crass (1.0.3)
|
54
|
+
database_cleaner (1.6.2)
|
55
|
+
diff-lcs (1.3)
|
56
56
|
docile (1.1.5)
|
57
57
|
erubis (2.7.0)
|
58
|
-
faker (1.
|
58
|
+
faker (1.8.4)
|
59
59
|
i18n (~> 0.5)
|
60
|
-
globalid (0.
|
61
|
-
activesupport (>= 4.
|
62
|
-
i18n (0.
|
63
|
-
|
64
|
-
|
60
|
+
globalid (0.4.1)
|
61
|
+
activesupport (>= 4.2.0)
|
62
|
+
i18n (0.9.1)
|
63
|
+
concurrent-ruby (~> 1.0)
|
64
|
+
json (2.1.0)
|
65
|
+
loofah (2.1.1)
|
66
|
+
crass (~> 1.0.2)
|
65
67
|
nokogiri (>= 1.5.9)
|
66
|
-
mail (2.
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
mini_portile2 (~> 2.1.0)
|
75
|
-
pkg-config (~> 1.1.7)
|
76
|
-
pkg-config (1.1.7)
|
77
|
-
rack (1.6.4)
|
68
|
+
mail (2.7.0)
|
69
|
+
mini_mime (>= 0.1.1)
|
70
|
+
mini_mime (1.0.0)
|
71
|
+
mini_portile2 (2.3.0)
|
72
|
+
minitest (5.10.3)
|
73
|
+
nokogiri (1.8.1)
|
74
|
+
mini_portile2 (~> 2.3.0)
|
75
|
+
rack (1.6.8)
|
78
76
|
rack-test (0.6.3)
|
79
77
|
rack (>= 1.0)
|
80
|
-
rails (4.2.
|
81
|
-
actionmailer (= 4.2.
|
82
|
-
actionpack (= 4.2.
|
83
|
-
actionview (= 4.2.
|
84
|
-
activejob (= 4.2.
|
85
|
-
activemodel (= 4.2.
|
86
|
-
activerecord (= 4.2.
|
87
|
-
activesupport (= 4.2.
|
78
|
+
rails (4.2.10)
|
79
|
+
actionmailer (= 4.2.10)
|
80
|
+
actionpack (= 4.2.10)
|
81
|
+
actionview (= 4.2.10)
|
82
|
+
activejob (= 4.2.10)
|
83
|
+
activemodel (= 4.2.10)
|
84
|
+
activerecord (= 4.2.10)
|
85
|
+
activesupport (= 4.2.10)
|
88
86
|
bundler (>= 1.3.0, < 2.0)
|
89
|
-
railties (= 4.2.
|
87
|
+
railties (= 4.2.10)
|
90
88
|
sprockets-rails
|
91
89
|
rails-deprecated_sanitizer (1.0.3)
|
92
90
|
activesupport (>= 4.2.0.alpha)
|
93
|
-
rails-dom-testing (1.0.
|
91
|
+
rails-dom-testing (1.0.8)
|
94
92
|
activesupport (>= 4.2.0.beta, < 5.0)
|
95
|
-
nokogiri (~> 1.6
|
93
|
+
nokogiri (~> 1.6)
|
96
94
|
rails-deprecated_sanitizer (>= 1.0.1)
|
97
95
|
rails-dummy (0.0.4)
|
98
96
|
rails
|
99
97
|
rails-html-sanitizer (1.0.3)
|
100
98
|
loofah (~> 2.0)
|
101
|
-
railties (4.2.
|
102
|
-
actionpack (= 4.2.
|
103
|
-
activesupport (= 4.2.
|
99
|
+
railties (4.2.10)
|
100
|
+
actionpack (= 4.2.10)
|
101
|
+
activesupport (= 4.2.10)
|
104
102
|
rake (>= 0.8.7)
|
105
103
|
thor (>= 0.18.1, < 2.0)
|
106
|
-
rake (
|
107
|
-
rspec (3.
|
108
|
-
rspec-core (~> 3.
|
109
|
-
rspec-expectations (~> 3.
|
110
|
-
rspec-mocks (~> 3.
|
111
|
-
rspec-core (3.
|
112
|
-
rspec-support (~> 3.
|
113
|
-
rspec-expectations (3.
|
104
|
+
rake (12.3.0)
|
105
|
+
rspec (3.7.0)
|
106
|
+
rspec-core (~> 3.7.0)
|
107
|
+
rspec-expectations (~> 3.7.0)
|
108
|
+
rspec-mocks (~> 3.7.0)
|
109
|
+
rspec-core (3.7.0)
|
110
|
+
rspec-support (~> 3.7.0)
|
111
|
+
rspec-expectations (3.7.0)
|
114
112
|
diff-lcs (>= 1.2.0, < 2.0)
|
115
|
-
rspec-support (~> 3.
|
116
|
-
rspec-mocks (3.
|
113
|
+
rspec-support (~> 3.7.0)
|
114
|
+
rspec-mocks (3.7.0)
|
117
115
|
diff-lcs (>= 1.2.0, < 2.0)
|
118
|
-
rspec-support (~> 3.
|
119
|
-
rspec-rails (3.
|
116
|
+
rspec-support (~> 3.7.0)
|
117
|
+
rspec-rails (3.7.2)
|
120
118
|
actionpack (>= 3.0)
|
121
119
|
activesupport (>= 3.0)
|
122
120
|
railties (>= 3.0)
|
123
|
-
rspec-core (~> 3.
|
124
|
-
rspec-expectations (~> 3.
|
125
|
-
rspec-mocks (~> 3.
|
126
|
-
rspec-support (~> 3.
|
127
|
-
rspec-support (3.
|
128
|
-
simplecov (0.
|
121
|
+
rspec-core (~> 3.7.0)
|
122
|
+
rspec-expectations (~> 3.7.0)
|
123
|
+
rspec-mocks (~> 3.7.0)
|
124
|
+
rspec-support (~> 3.7.0)
|
125
|
+
rspec-support (3.7.0)
|
126
|
+
simplecov (0.13.0)
|
129
127
|
docile (~> 1.1.0)
|
130
128
|
json (>= 1.8, < 3)
|
131
129
|
simplecov-html (~> 0.10.0)
|
132
|
-
simplecov-html (0.10.
|
133
|
-
|
134
|
-
spring-commands-rspec (1.0.4)
|
135
|
-
spring (>= 0.9.1)
|
136
|
-
sprockets (3.7.0)
|
130
|
+
simplecov-html (0.10.2)
|
131
|
+
sprockets (3.7.1)
|
137
132
|
concurrent-ruby (~> 1.0)
|
138
133
|
rack (> 1, < 3)
|
139
|
-
sprockets-rails (3.2.
|
134
|
+
sprockets-rails (3.2.1)
|
140
135
|
actionpack (>= 4.0)
|
141
136
|
activesupport (>= 4.0)
|
142
137
|
sprockets (>= 3.0.0)
|
143
|
-
sqlite3 (1.3.
|
144
|
-
thor (0.
|
145
|
-
thread_safe (0.3.
|
146
|
-
tzinfo (1.2.
|
138
|
+
sqlite3 (1.3.13)
|
139
|
+
thor (0.20.0)
|
140
|
+
thread_safe (0.3.6)
|
141
|
+
tzinfo (1.2.4)
|
147
142
|
thread_safe (~> 0.1)
|
148
143
|
|
149
144
|
PLATFORMS
|
@@ -155,13 +150,12 @@ DEPENDENCIES
|
|
155
150
|
codeclimate-test-reporter
|
156
151
|
database_cleaner
|
157
152
|
faker
|
158
|
-
rails (~> 4.2
|
153
|
+
rails (~> 4.2)
|
159
154
|
rails-dummy
|
160
155
|
rspec (~> 3.5)
|
161
156
|
rspec-rails (~> 3.5)
|
162
157
|
settingson!
|
163
|
-
spring-commands-rspec
|
164
158
|
sqlite3
|
165
159
|
|
166
160
|
BUNDLED WITH
|
167
|
-
1.
|
161
|
+
1.16.6
|
data/gemfiles/5.0.gemfile
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem "codeclimate-test-reporter", :
|
6
|
-
gem "rails", "~> 5.0
|
5
|
+
gem "codeclimate-test-reporter", group: :test, require: nil
|
6
|
+
gem "rails", "~> 5.0"
|
7
7
|
|
8
|
-
gemspec :
|
8
|
+
gemspec path: "../"
|