settingson 1.7.6 → 1.7.7

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
  SHA1:
3
- metadata.gz: f694dc0ae8fbd86f5c64e4c66844876c90ae607b
4
- data.tar.gz: 8732e4b92ec3ebab8c5c5fbf24a09921f9c2088f
3
+ metadata.gz: 2e0abff7e29154b68e0008ebc83fb512c6418042
4
+ data.tar.gz: 3e3318ab67f0b95e0fc8a8dfce9f27f41753e286
5
5
  SHA512:
6
- metadata.gz: a26fc3405ec03c65bd3c663b9de579975bb0a811d919ea4cec5e0dcb4cce990b339f96846d8165c5a30d3fcef019d44974b3554a0f69e866debbec8ec9eb6056
7
- data.tar.gz: 073b4eb59078be399ad906166008ed1f82d8264113f2e0acb02e15e5b15f69b377d8aabdb5cf55e82f12a2d0acd90636d1b689cda48c910ac574541dd95107ec
6
+ metadata.gz: bdc095b96d9ef702464c42ec7f65fba3a8f5a86f9d45870eb4bf1d621f7b8ff4824b4ff83828fd3c6613c4a4d15c83f4a31de23b7ee6935112b7d22a44a1c22b
7
+ data.tar.gz: 3ce8f5406467feee5fc043ce643d6f47050c848e9af166075eb6559527971183aa69924dcb1f79bbea307960a6cdba806f1d551cf25e0656734afa63a99c8dc2
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
@@ -27,3 +26,4 @@ spec/dummy/tmp/*
27
26
  !spec/dummy/tmp/cache
28
27
  spec/dummy/tmp/cache/*
29
28
  !spec/dummy/tmp/cache/.keep
29
+ Gemfile.lock
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
 
3
3
  sudo: false
4
- cache: bundler
4
+ #cache: bundler
5
5
 
6
- script: bundle exec rspec
6
+ script: "bundle exec rspec && bundle exec codeclimate-test-reporter"
7
7
 
8
8
  rvm:
9
9
  - 2.2.2
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  # Settingson
7
7
 
8
- Simple settings management for applications (Ruby on Rails 4 with ActiveRecord)
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,7 @@ 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
- rake db:migrate
50
+ bin/rails g settingson Settings
49
51
  ```
50
52
 
51
53
  code:
data/Rakefile CHANGED
@@ -1,3 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "appraisal"
1
+ #require "bundler/gem_tasks"
2
+ #require "appraisal"
3
3
  #require "rails/dummy/tasks"
4
+
5
+ require "rubygems"
6
+ require "bundler/setup"
@@ -26,7 +26,7 @@ module Settingson::Base
26
26
  def defaults
27
27
  return unless block_given?
28
28
  Rails.application.config.after_initialize do
29
- yield Settingson::Store.new( klass: self, path: '__defaults' )
29
+ yield Settingson::Defaults.new( klass: self )
30
30
  end
31
31
  end
32
32
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "codeclimate-test-reporter", :group => :test, :require => nil
5
+ gem "codeclimate-test-reporter", group: :test, require: nil
6
6
  gem "rails", "~> 4.2.0"
7
7
 
8
- gemspec :path => "../"
8
+ gemspec path: "../"
@@ -1,66 +1,65 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- settingson (1.6.0)
4
+ settingson (1.7.6)
5
5
  rails (>= 4.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionmailer (4.2.7.1)
11
- actionpack (= 4.2.7.1)
12
- actionview (= 4.2.7.1)
13
- activejob (= 4.2.7.1)
10
+ actionmailer (4.2.8)
11
+ actionpack (= 4.2.8)
12
+ actionview (= 4.2.8)
13
+ activejob (= 4.2.8)
14
14
  mail (~> 2.5, >= 2.5.4)
15
15
  rails-dom-testing (~> 1.0, >= 1.0.5)
16
- actionpack (4.2.7.1)
17
- actionview (= 4.2.7.1)
18
- activesupport (= 4.2.7.1)
16
+ actionpack (4.2.8)
17
+ actionview (= 4.2.8)
18
+ activesupport (= 4.2.8)
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.7.1)
24
- activesupport (= 4.2.7.1)
23
+ actionview (4.2.8)
24
+ activesupport (= 4.2.8)
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.2)
29
- activejob (4.2.7.1)
30
- activesupport (= 4.2.7.1)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
29
+ activejob (4.2.8)
30
+ activesupport (= 4.2.8)
31
31
  globalid (>= 0.3.0)
32
- activemodel (4.2.7.1)
33
- activesupport (= 4.2.7.1)
32
+ activemodel (4.2.8)
33
+ activesupport (= 4.2.8)
34
34
  builder (~> 3.1)
35
- activerecord (4.2.7.1)
36
- activemodel (= 4.2.7.1)
37
- activesupport (= 4.2.7.1)
35
+ activerecord (4.2.8)
36
+ activemodel (= 4.2.8)
37
+ activesupport (= 4.2.8)
38
38
  arel (~> 6.0)
39
- activesupport (4.2.7.1)
39
+ activesupport (4.2.8)
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.1.0)
44
+ appraisal (2.2.0)
46
45
  bundler
47
46
  rake
48
47
  thor (>= 0.14.0)
49
- arel (6.0.3)
50
- builder (3.2.2)
51
- codeclimate-test-reporter (0.6.0)
52
- simplecov (>= 0.7.1, < 1.0.0)
53
- concurrent-ruby (1.0.2)
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)
54
53
  database_cleaner (1.5.3)
55
- diff-lcs (1.2.5)
54
+ diff-lcs (1.3)
56
55
  docile (1.1.5)
57
56
  erubis (2.7.0)
58
- faker (1.6.6)
57
+ faker (1.7.3)
59
58
  i18n (~> 0.5)
60
- globalid (0.3.7)
61
- activesupport (>= 4.1.0)
62
- i18n (0.7.0)
63
- json (1.8.3)
59
+ globalid (0.4.0)
60
+ activesupport (>= 4.2.0)
61
+ i18n (0.8.1)
62
+ json (2.1.0)
64
63
  loofah (2.0.3)
65
64
  nokogiri (>= 1.5.9)
66
65
  mail (2.6.4)
@@ -69,46 +68,44 @@ GEM
69
68
  mime-types-data (~> 3.2015)
70
69
  mime-types-data (3.2016.0521)
71
70
  mini_portile2 (2.1.0)
72
- minitest (5.9.0)
73
- nokogiri (1.6.8)
71
+ minitest (5.10.1)
72
+ nokogiri (1.7.1)
74
73
  mini_portile2 (~> 2.1.0)
75
- pkg-config (~> 1.1.7)
76
- pkg-config (1.1.7)
77
- rack (1.6.4)
74
+ rack (1.6.5)
78
75
  rack-test (0.6.3)
79
76
  rack (>= 1.0)
80
- rails (4.2.7.1)
81
- actionmailer (= 4.2.7.1)
82
- actionpack (= 4.2.7.1)
83
- actionview (= 4.2.7.1)
84
- activejob (= 4.2.7.1)
85
- activemodel (= 4.2.7.1)
86
- activerecord (= 4.2.7.1)
87
- activesupport (= 4.2.7.1)
77
+ rails (4.2.8)
78
+ actionmailer (= 4.2.8)
79
+ actionpack (= 4.2.8)
80
+ actionview (= 4.2.8)
81
+ activejob (= 4.2.8)
82
+ activemodel (= 4.2.8)
83
+ activerecord (= 4.2.8)
84
+ activesupport (= 4.2.8)
88
85
  bundler (>= 1.3.0, < 2.0)
89
- railties (= 4.2.7.1)
86
+ railties (= 4.2.8)
90
87
  sprockets-rails
91
88
  rails-deprecated_sanitizer (1.0.3)
92
89
  activesupport (>= 4.2.0.alpha)
93
- rails-dom-testing (1.0.7)
90
+ rails-dom-testing (1.0.8)
94
91
  activesupport (>= 4.2.0.beta, < 5.0)
95
- nokogiri (~> 1.6.0)
92
+ nokogiri (~> 1.6)
96
93
  rails-deprecated_sanitizer (>= 1.0.1)
97
94
  rails-dummy (0.0.4)
98
95
  rails
99
96
  rails-html-sanitizer (1.0.3)
100
97
  loofah (~> 2.0)
101
- railties (4.2.7.1)
102
- actionpack (= 4.2.7.1)
103
- activesupport (= 4.2.7.1)
98
+ railties (4.2.8)
99
+ actionpack (= 4.2.8)
100
+ activesupport (= 4.2.8)
104
101
  rake (>= 0.8.7)
105
102
  thor (>= 0.18.1, < 2.0)
106
- rake (11.2.2)
103
+ rake (12.0.0)
107
104
  rspec (3.5.0)
108
105
  rspec-core (~> 3.5.0)
109
106
  rspec-expectations (~> 3.5.0)
110
107
  rspec-mocks (~> 3.5.0)
111
- rspec-core (3.5.3)
108
+ rspec-core (3.5.4)
112
109
  rspec-support (~> 3.5.0)
113
110
  rspec-expectations (3.5.0)
114
111
  diff-lcs (>= 1.2.0, < 2.0)
@@ -125,25 +122,26 @@ GEM
125
122
  rspec-mocks (~> 3.5.0)
126
123
  rspec-support (~> 3.5.0)
127
124
  rspec-support (3.5.0)
128
- simplecov (0.12.0)
125
+ simplecov (0.13.0)
129
126
  docile (~> 1.1.0)
130
127
  json (>= 1.8, < 3)
131
128
  simplecov-html (~> 0.10.0)
132
129
  simplecov-html (0.10.0)
133
- spring (1.7.2)
130
+ spring (2.0.1)
131
+ activesupport (>= 4.2)
134
132
  spring-commands-rspec (1.0.4)
135
133
  spring (>= 0.9.1)
136
- sprockets (3.7.0)
134
+ sprockets (3.7.1)
137
135
  concurrent-ruby (~> 1.0)
138
136
  rack (> 1, < 3)
139
137
  sprockets-rails (3.2.0)
140
138
  actionpack (>= 4.0)
141
139
  activesupport (>= 4.0)
142
140
  sprockets (>= 3.0.0)
143
- sqlite3 (1.3.11)
144
- thor (0.19.1)
145
- thread_safe (0.3.5)
146
- tzinfo (1.2.2)
141
+ sqlite3 (1.3.13)
142
+ thor (0.19.4)
143
+ thread_safe (0.3.6)
144
+ tzinfo (1.2.3)
147
145
  thread_safe (~> 0.1)
148
146
 
149
147
  PLATFORMS
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "codeclimate-test-reporter", :group => :test, :require => nil
5
+ gem "codeclimate-test-reporter", group: :test, require: nil
6
6
  gem "rails", "~> 5.0.0"
7
7
 
8
- gemspec :path => "../"
8
+ gemspec path: "../"
@@ -1,68 +1,68 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- settingson (1.6.0)
4
+ settingson (1.7.6)
5
5
  rails (>= 4.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (5.0.0.1)
11
- actionpack (= 5.0.0.1)
12
- nio4r (~> 1.2)
10
+ actioncable (5.0.2)
11
+ actionpack (= 5.0.2)
12
+ nio4r (>= 1.2, < 3.0)
13
13
  websocket-driver (~> 0.6.1)
14
- actionmailer (5.0.0.1)
15
- actionpack (= 5.0.0.1)
16
- actionview (= 5.0.0.1)
17
- activejob (= 5.0.0.1)
14
+ actionmailer (5.0.2)
15
+ actionpack (= 5.0.2)
16
+ actionview (= 5.0.2)
17
+ activejob (= 5.0.2)
18
18
  mail (~> 2.5, >= 2.5.4)
19
19
  rails-dom-testing (~> 2.0)
20
- actionpack (5.0.0.1)
21
- actionview (= 5.0.0.1)
22
- activesupport (= 5.0.0.1)
20
+ actionpack (5.0.2)
21
+ actionview (= 5.0.2)
22
+ activesupport (= 5.0.2)
23
23
  rack (~> 2.0)
24
24
  rack-test (~> 0.6.3)
25
25
  rails-dom-testing (~> 2.0)
26
26
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
- actionview (5.0.0.1)
28
- activesupport (= 5.0.0.1)
27
+ actionview (5.0.2)
28
+ activesupport (= 5.0.2)
29
29
  builder (~> 3.1)
30
30
  erubis (~> 2.7.0)
31
31
  rails-dom-testing (~> 2.0)
32
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
33
- activejob (5.0.0.1)
34
- activesupport (= 5.0.0.1)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
+ activejob (5.0.2)
34
+ activesupport (= 5.0.2)
35
35
  globalid (>= 0.3.6)
36
- activemodel (5.0.0.1)
37
- activesupport (= 5.0.0.1)
38
- activerecord (5.0.0.1)
39
- activemodel (= 5.0.0.1)
40
- activesupport (= 5.0.0.1)
36
+ activemodel (5.0.2)
37
+ activesupport (= 5.0.2)
38
+ activerecord (5.0.2)
39
+ activemodel (= 5.0.2)
40
+ activesupport (= 5.0.2)
41
41
  arel (~> 7.0)
42
- activesupport (5.0.0.1)
42
+ activesupport (5.0.2)
43
43
  concurrent-ruby (~> 1.0, >= 1.0.2)
44
44
  i18n (~> 0.7)
45
45
  minitest (~> 5.1)
46
46
  tzinfo (~> 1.1)
47
- appraisal (2.1.0)
47
+ appraisal (2.2.0)
48
48
  bundler
49
49
  rake
50
50
  thor (>= 0.14.0)
51
- arel (7.1.2)
52
- builder (3.2.2)
53
- codeclimate-test-reporter (0.6.0)
54
- simplecov (>= 0.7.1, < 1.0.0)
55
- concurrent-ruby (1.0.2)
51
+ arel (7.1.4)
52
+ builder (3.2.3)
53
+ codeclimate-test-reporter (1.0.8)
54
+ simplecov (<= 0.13)
55
+ concurrent-ruby (1.0.5)
56
56
  database_cleaner (1.5.3)
57
- diff-lcs (1.2.5)
57
+ diff-lcs (1.3)
58
58
  docile (1.1.5)
59
59
  erubis (2.7.0)
60
- faker (1.6.6)
60
+ faker (1.7.3)
61
61
  i18n (~> 0.5)
62
- globalid (0.3.7)
63
- activesupport (>= 4.1.0)
64
- i18n (0.7.0)
65
- json (2.0.2)
62
+ globalid (0.4.0)
63
+ activesupport (>= 4.2.0)
64
+ i18n (0.8.1)
65
+ json (2.1.0)
66
66
  loofah (2.0.3)
67
67
  nokogiri (>= 1.5.9)
68
68
  mail (2.6.4)
@@ -72,46 +72,44 @@ GEM
72
72
  mime-types-data (~> 3.2015)
73
73
  mime-types-data (3.2016.0521)
74
74
  mini_portile2 (2.1.0)
75
- minitest (5.9.0)
76
- nio4r (1.2.1)
77
- nokogiri (1.6.8)
75
+ minitest (5.10.1)
76
+ nio4r (2.0.0)
77
+ nokogiri (1.7.1)
78
78
  mini_portile2 (~> 2.1.0)
79
- pkg-config (~> 1.1.7)
80
- pkg-config (1.1.7)
81
79
  rack (2.0.1)
82
80
  rack-test (0.6.3)
83
81
  rack (>= 1.0)
84
- rails (5.0.0.1)
85
- actioncable (= 5.0.0.1)
86
- actionmailer (= 5.0.0.1)
87
- actionpack (= 5.0.0.1)
88
- actionview (= 5.0.0.1)
89
- activejob (= 5.0.0.1)
90
- activemodel (= 5.0.0.1)
91
- activerecord (= 5.0.0.1)
92
- activesupport (= 5.0.0.1)
82
+ rails (5.0.2)
83
+ actioncable (= 5.0.2)
84
+ actionmailer (= 5.0.2)
85
+ actionpack (= 5.0.2)
86
+ actionview (= 5.0.2)
87
+ activejob (= 5.0.2)
88
+ activemodel (= 5.0.2)
89
+ activerecord (= 5.0.2)
90
+ activesupport (= 5.0.2)
93
91
  bundler (>= 1.3.0, < 2.0)
94
- railties (= 5.0.0.1)
92
+ railties (= 5.0.2)
95
93
  sprockets-rails (>= 2.0.0)
96
- rails-dom-testing (2.0.1)
94
+ rails-dom-testing (2.0.2)
97
95
  activesupport (>= 4.2.0, < 6.0)
98
- nokogiri (~> 1.6.0)
96
+ nokogiri (~> 1.6)
99
97
  rails-dummy (0.0.4)
100
98
  rails
101
99
  rails-html-sanitizer (1.0.3)
102
100
  loofah (~> 2.0)
103
- railties (5.0.0.1)
104
- actionpack (= 5.0.0.1)
105
- activesupport (= 5.0.0.1)
101
+ railties (5.0.2)
102
+ actionpack (= 5.0.2)
103
+ activesupport (= 5.0.2)
106
104
  method_source
107
105
  rake (>= 0.8.7)
108
106
  thor (>= 0.18.1, < 2.0)
109
- rake (11.2.2)
107
+ rake (12.0.0)
110
108
  rspec (3.5.0)
111
109
  rspec-core (~> 3.5.0)
112
110
  rspec-expectations (~> 3.5.0)
113
111
  rspec-mocks (~> 3.5.0)
114
- rspec-core (3.5.3)
112
+ rspec-core (3.5.4)
115
113
  rspec-support (~> 3.5.0)
116
114
  rspec-expectations (3.5.0)
117
115
  diff-lcs (>= 1.2.0, < 2.0)
@@ -128,27 +126,28 @@ GEM
128
126
  rspec-mocks (~> 3.5.0)
129
127
  rspec-support (~> 3.5.0)
130
128
  rspec-support (3.5.0)
131
- simplecov (0.12.0)
129
+ simplecov (0.13.0)
132
130
  docile (~> 1.1.0)
133
131
  json (>= 1.8, < 3)
134
132
  simplecov-html (~> 0.10.0)
135
133
  simplecov-html (0.10.0)
136
- spring (1.7.2)
134
+ spring (2.0.1)
135
+ activesupport (>= 4.2)
137
136
  spring-commands-rspec (1.0.4)
138
137
  spring (>= 0.9.1)
139
- sprockets (3.7.0)
138
+ sprockets (3.7.1)
140
139
  concurrent-ruby (~> 1.0)
141
140
  rack (> 1, < 3)
142
141
  sprockets-rails (3.2.0)
143
142
  actionpack (>= 4.0)
144
143
  activesupport (>= 4.0)
145
144
  sprockets (>= 3.0.0)
146
- sqlite3 (1.3.11)
147
- thor (0.19.1)
148
- thread_safe (0.3.5)
149
- tzinfo (1.2.2)
145
+ sqlite3 (1.3.13)
146
+ thor (0.19.4)
147
+ thread_safe (0.3.6)
148
+ tzinfo (1.2.3)
150
149
  thread_safe (~> 0.1)
151
- websocket-driver (0.6.4)
150
+ websocket-driver (0.6.5)
152
151
  websocket-extensions (>= 0.1.0)
153
152
  websocket-extensions (0.1.2)
154
153
 
@@ -5,5 +5,6 @@ module Settingson
5
5
  if defined?(Rails)
6
6
  require 'settingson/engine'
7
7
  require 'settingson/store'
8
+ require 'settingson/defaults'
8
9
  end
9
10
  end
@@ -0,0 +1,12 @@
1
+ class Settingson::Defaults
2
+ def initialize(klass:)
3
+ @__klass = klass
4
+ @__path = '__defaults'
5
+ end # initialize
6
+
7
+ def method_missing(symbol, *args)
8
+ Settingson::Store.new(
9
+ klass: @__klass, path: @__path, defaults: true
10
+ ).send(symbol, *args)
11
+ end # method_missing
12
+ end
@@ -3,9 +3,10 @@ class Settingson::Store
3
3
  # extend ActiveModel::Naming
4
4
  # include ActiveModel::Conversion
5
5
  #
6
- def initialize(klass:, path: nil)
7
- @__klass = klass
8
- @__path = path
6
+ def initialize(klass:, path: nil, defaults: false)
7
+ @__klass = klass
8
+ @__path = path
9
+ @__defaults = defaults
9
10
  end
10
11
 
11
12
  def to_s
@@ -44,11 +45,12 @@ class Settingson::Store
44
45
  protected
45
46
  # TODO: move all methods to support class
46
47
  def __debug(message="")
48
+ return unless @__klass.configure.debug
47
49
  message = sprintf("%s#%20s: %s",
48
50
  self.class.name,
49
51
  caller_locations.first.label,
50
52
  message)
51
- Rails.logger.debug(message) if @__klass.configure.debug
53
+ Rails.logger.debug(message)
52
54
  end
53
55
 
54
56
  def __references_action(symbol, *args)
@@ -153,7 +155,7 @@ class Settingson::Store
153
155
  def __cached_or_default_value(key)
154
156
  result = __cached_value(key)
155
157
 
156
- if result.is_a?(ActiveRecord::RecordNotFound) # Try defaults
158
+ if ! @__defaults and result.is_a?(ActiveRecord::RecordNotFound)
157
159
  __cached_value('__defaults.' + key)
158
160
  else
159
161
  result
@@ -1,3 +1,3 @@
1
1
  module Settingson
2
- VERSION = "1.7.6"
2
+ VERSION = "1.7.7"
3
3
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Settingson::VERSION
9
9
  spec.authors = ["dan"]
10
10
  spec.email = ["daan.forever@gmail.com"]
11
- spec.summary = %q{Settings management for Ruby on Rails 4 applications (ActiveRecord) }
12
- spec.description = %q{Settings management for Ruby on Rails 4 applications (ActiveRecord) }
11
+ spec.summary = %q{Settings management for Ruby on Rails applications (with ActiveRecord) }
12
+ spec.description = %q{Settings management for Ruby on Rails applications (with ActiveRecord) }
13
13
  spec.homepage = "https://github.com/daanforever/settingson"
14
14
  spec.license = "MIT"
15
15
 
@@ -13,8 +13,13 @@ Rails.application.configure do
13
13
  config.eager_load = false
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
16
+ if Rails::VERSION::MAJOR < 5
17
+ config.serve_static_files = true
18
+ config.static_cache_control = 'public, max-age=3600'
19
+ else
20
+ config.public_file_server.enabled = true
21
+ config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
22
+ end
18
23
 
19
24
  # Show full error reports and disable caching.
20
25
  config.consider_all_requests_local = true
@@ -18,6 +18,18 @@ describe Settings do
18
18
  Settings.defaults{|s| s.some.key = word}
19
19
  expect( Settings.some.key ).to eq(word)
20
20
  end
21
+
22
+ it 'save and returns correct value for multiple default values' do
23
+ word1 = Faker::Lorem.word
24
+ word2 = Faker::Lorem.word
25
+ Settings.defaults do |s|
26
+ s.some.key1 = word1
27
+ s.some.key2 = word2
28
+ end
29
+ expect( Settings.some.key1 ).to eq(word1)
30
+ expect( Settings.some.key2 ).to eq(word2)
31
+ end
32
+
21
33
  end
22
34
 
23
35
  describe '::from_hash' do
@@ -1,7 +1,7 @@
1
1
  ENV["RAILS_ENV"] ||= 'test'
2
2
 
3
- require "codeclimate-test-reporter"
4
- CodeClimate::TestReporter.start
3
+ require 'simplecov'
4
+ SimpleCov.start
5
5
 
6
6
  require ::File.expand_path('../dummy/config/environment', __FILE__)
7
7
  require 'rspec/rails'
@@ -35,7 +35,7 @@ RSpec.configure do |config|
35
35
  config.before(:suite) do
36
36
  begin
37
37
  DatabaseCleaner.strategy = :transaction
38
- DatabaseCleaner.clean_with(:truncation)
38
+ DatabaseCleaner.clean_with(:transaction)
39
39
  end
40
40
  end
41
41
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: settingson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.6
4
+ version: 1.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - dan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-29 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -150,7 +150,7 @@ dependencies:
150
150
  - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
- description: 'Settings management for Ruby on Rails 4 applications (ActiveRecord) '
153
+ description: 'Settings management for Ruby on Rails applications (with ActiveRecord) '
154
154
  email:
155
155
  - daan.forever@gmail.com
156
156
  executables: []
@@ -177,6 +177,7 @@ files:
177
177
  - lib/generators/settingson/templates/migrations/rename_name_to_key_on_settings.rb
178
178
  - lib/settingson.rb
179
179
  - lib/settingson/config.rb
180
+ - lib/settingson/defaults.rb
180
181
  - lib/settingson/engine.rb
181
182
  - lib/settingson/store.rb
182
183
  - lib/settingson/utils.rb
@@ -252,10 +253,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
253
  version: '0'
253
254
  requirements: []
254
255
  rubyforge_project:
255
- rubygems_version: 2.6.10
256
+ rubygems_version: 2.6.14
256
257
  signing_key:
257
258
  specification_version: 4
258
- summary: Settings management for Ruby on Rails 4 applications (ActiveRecord)
259
+ summary: Settings management for Ruby on Rails applications (with ActiveRecord)
259
260
  test_files:
260
261
  - spec/dummy/README.rdoc
261
262
  - spec/dummy/Rakefile