setler 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MDlmODVjNzM5ZWZiMzY3Njk4YjJkMWM4YTZiMTQyMDEyYTRkYzU3MA==
5
- data.tar.gz: !binary |-
6
- MWM0MTJjNWE2YmYyZmE4MWM1NGUyYWZkNzllNTM3YzgxMTQ4NzdiNg==
2
+ SHA256:
3
+ metadata.gz: cbe29674970fc77e130e8ab2927c5afb9697f2f60d0c6b1edd0f7e95c9fa4710
4
+ data.tar.gz: 896867601cf7eee4ae4eeb4cca788952a334f450e9980c123ba38f54568778af
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NDVjNDRlNjU0MDZjZWJiODdkNzNiY2YyNGQ2MDBhMTBmZjE3NzJiYTcxMjc0
10
- NmFkNzRhZTZhOTllZTU2MTk5MDZkZDBmOTBiZjNhMTdiNDQ0NjQ5MGQ0ZDg4
11
- NTcwOWY2ZWFiMGM5YjU4MGM0MDg1MzhjMGVhZjQ3YWVhZTcxMGM=
12
- data.tar.gz: !binary |-
13
- MzdlNDgwMGZlNzYxMGQ3ODQ5Y2Q2Y2JkMDNiNWIwNmYyY2FhMjYzMmE4MWYw
14
- OTY0MDE3MDVhNjVmYWM3Mjc1OWEwOGUzNDVjYmJmZWViOTY3NjYzYjczMmEw
15
- M2NkNDZhNDQ4ZmViOGNiMzJjZTc2MmE3MjIwOTY1ZDM1NmM2Mzk=
6
+ metadata.gz: e9f90bc4f78b627a5d512cdf18bdedc7947a80f20fe7ef46acedbdad4f3321e02f76c7d8ab86278c41aee252a9607a2688d31086ee1621123c9ed8e4deec5aef
7
+ data.tar.gz: e01e2a723f9b0db1b77625f5f50912f670edfe71b519f07a975ae07412a360f9d3f7a727fd1b58cc1eb8a9bcc2d04aebf3d44c7c20a12513f046f1d7b6523e20
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-1.9.3-p547
1
+ 2.6.5
data/.travis.yml CHANGED
@@ -1,8 +1,22 @@
1
+ language: ruby
1
2
  rvm:
2
- - 1.9.3
3
- - 2.1.2
3
+ - 2.3.8
4
+ - 2.4.7
5
+ - 2.5.7
6
+ - 2.6.5
7
+ before_install: "gem install bundler:1.17.2"
4
8
  cache: bundler
5
- script:
6
- - bundle exec rake test
9
+ script: "bundle exec rake test"
7
10
  notifications:
8
11
  email: false
12
+ gemfile:
13
+ - gemfiles/rails_4.gemfile
14
+ - gemfiles/rails_5.gemfile
15
+ - gemfiles/rails_6_edge.gemfile
16
+ matrix:
17
+ fast_finish: true
18
+ exclude:
19
+ - rvm: 2.3.8
20
+ gemfile: gemfiles/rails_6_edge.gemfile
21
+ - rvm: 2.4.7
22
+ gemfile: gemfiles/rails_6_edge.gemfile
data/Appraisals ADDED
@@ -0,0 +1,14 @@
1
+ appraise "rails-4" do
2
+ gem "rails", "4.2.11.1"
3
+ gem 'sqlite3', '1.3.13' # 5/13/2019: LOCKED DOWN AGAIN.
4
+ end
5
+
6
+ appraise "rails-5" do
7
+ gem "rails", "5.2.3"
8
+ gem 'sqlite3'
9
+ end
10
+
11
+ appraise "rails-6-edge" do
12
+ gem 'rails', git: 'https://github.com/rails/rails'
13
+ gem 'sqlite3'
14
+ end
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in setler.gemspec
4
4
  gemspec
data/README.rdoc CHANGED
@@ -3,6 +3,9 @@
3
3
  Setler is a Gem that lets one easily implement the "Feature Flags" pattern, or add settings to individual models. This is a cleanroom implementation of what the 'rails-settings' gem does. It's been forked all over the place, and my favorite version of it doesn't have any tests and doesn't work with settings associated with models.
4
4
 
5
5
  {<img src="https://travis-ci.org/ckdake/setler.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/ckdake/setler]
6
+ {<img src="https://badge.fury.io/rb/setler.svg" alt="Gem Version" />}[http://badge.fury.io/rb/setler]
7
+
8
+ While Setler enables you to create both app-level and model-level settings, they are two separate things and don't mix. For example, if you create defaults for the app, they won't appear as defaults for individual models.
6
9
 
7
10
  == Setup
8
11
 
@@ -74,7 +77,8 @@ Getting started is pretty straightforward:
74
77
 
75
78
  1. Check out the code: `git clone git://github.com/ckdake/setler.git`
76
79
  2. Bundle install: `bundle install`
77
- 3. Run the tests and make sure they all pass and code coverage is still 100%: `rake test`
80
+ 3. Run: `appraisal install` to generate the appraisal's gemfiles.
81
+ 4. Run the tests for all supported releases in Appraisals file and make sure they all pass and code coverage is still the same: `appraisal rake test`
78
82
 
79
83
  If you'd like to contribute code, make your changes and submit a pull request that includes appropriate tests
80
84
 
data/Rakefile CHANGED
@@ -1,6 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler/setup'
5
+ require 'bundler/gem_tasks'
6
+
1
7
  require 'rake'
2
8
  require 'rake/testtask'
3
- require 'bundler/gem_tasks'
9
+ require 'appraisal'
4
10
 
5
11
  Rake::TestTask.new(:test) do |test|
6
12
  test.libs << 'lib' << 'test'
@@ -8,4 +14,20 @@ Rake::TestTask.new(:test) do |test|
8
14
  test.verbose = true
9
15
  end
10
16
 
11
- task default: [:test]
17
+ require 'bundler/gem_tasks'
18
+
19
+ require 'rake'
20
+ require 'appraisal'
21
+
22
+ desc 'Default'
23
+ task :default do
24
+ if ENV['BUNDLE_GEMFILE'] =~ /gemfiles/
25
+ task default: [:test]
26
+ else
27
+ Rake::Task['appraise'].invoke
28
+ end
29
+ end
30
+
31
+ task :appraise do
32
+ exec 'appraisal install && appraisal rake test'
33
+ end
data/contributors.txt CHANGED
@@ -7,3 +7,5 @@ Steven Harman github.com/stevenharman
7
7
  Chris Stefano github.com/virtualstaticvoid
8
8
  Brian Stanwyck github.com/brianstanwyck
9
9
  Jay Hayes github.com/iamvery
10
+ Al Snow github.com/jasnow
11
+ Gal Tsubery github.com/tsubery
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "4.2.11.1"
6
+ gem "sqlite3", "1.3.13"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,128 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ setler (0.0.13)
5
+ activerecord (>= 3.0.0)
6
+ rails (>= 3.0.0)
7
+ sprockets (= 3.7.2)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionmailer (4.2.11.1)
13
+ actionpack (= 4.2.11.1)
14
+ actionview (= 4.2.11.1)
15
+ activejob (= 4.2.11.1)
16
+ mail (~> 2.5, >= 2.5.4)
17
+ rails-dom-testing (~> 1.0, >= 1.0.5)
18
+ actionpack (4.2.11.1)
19
+ actionview (= 4.2.11.1)
20
+ activesupport (= 4.2.11.1)
21
+ rack (~> 1.6)
22
+ rack-test (~> 0.6.2)
23
+ rails-dom-testing (~> 1.0, >= 1.0.5)
24
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
25
+ actionview (4.2.11.1)
26
+ activesupport (= 4.2.11.1)
27
+ builder (~> 3.1)
28
+ erubis (~> 2.7.0)
29
+ rails-dom-testing (~> 1.0, >= 1.0.5)
30
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
31
+ activejob (4.2.11.1)
32
+ activesupport (= 4.2.11.1)
33
+ globalid (>= 0.3.0)
34
+ activemodel (4.2.11.1)
35
+ activesupport (= 4.2.11.1)
36
+ builder (~> 3.1)
37
+ activerecord (4.2.11.1)
38
+ activemodel (= 4.2.11.1)
39
+ activesupport (= 4.2.11.1)
40
+ arel (~> 6.0)
41
+ activesupport (4.2.11.1)
42
+ i18n (~> 0.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.3, >= 0.3.4)
45
+ tzinfo (~> 1.1)
46
+ appraisal (2.2.0)
47
+ bundler
48
+ rake
49
+ thor (>= 0.14.0)
50
+ arel (6.0.4)
51
+ builder (3.2.4)
52
+ concurrent-ruby (1.1.5)
53
+ crass (1.0.6)
54
+ docile (1.3.2)
55
+ erubis (2.7.0)
56
+ globalid (0.4.2)
57
+ activesupport (>= 4.2.0)
58
+ i18n (0.9.5)
59
+ concurrent-ruby (~> 1.0)
60
+ loofah (2.4.0)
61
+ crass (~> 1.0.2)
62
+ nokogiri (>= 1.5.9)
63
+ mail (2.7.1)
64
+ mini_mime (>= 0.1.1)
65
+ mini_mime (1.0.2)
66
+ mini_portile2 (2.4.0)
67
+ minitest (5.14.0)
68
+ nokogiri (1.10.7)
69
+ mini_portile2 (~> 2.4.0)
70
+ rack (1.6.13)
71
+ rack-test (0.6.3)
72
+ rack (>= 1.0)
73
+ rails (4.2.11.1)
74
+ actionmailer (= 4.2.11.1)
75
+ actionpack (= 4.2.11.1)
76
+ actionview (= 4.2.11.1)
77
+ activejob (= 4.2.11.1)
78
+ activemodel (= 4.2.11.1)
79
+ activerecord (= 4.2.11.1)
80
+ activesupport (= 4.2.11.1)
81
+ bundler (>= 1.3.0, < 2.0)
82
+ railties (= 4.2.11.1)
83
+ sprockets-rails
84
+ rails-deprecated_sanitizer (1.0.3)
85
+ activesupport (>= 4.2.0.alpha)
86
+ rails-dom-testing (1.0.9)
87
+ activesupport (>= 4.2.0, < 5.0)
88
+ nokogiri (~> 1.6)
89
+ rails-deprecated_sanitizer (>= 1.0.1)
90
+ rails-html-sanitizer (1.3.0)
91
+ loofah (~> 2.3)
92
+ railties (4.2.11.1)
93
+ actionpack (= 4.2.11.1)
94
+ activesupport (= 4.2.11.1)
95
+ rake (>= 0.8.7)
96
+ thor (>= 0.18.1, < 2.0)
97
+ rake (13.0.1)
98
+ simplecov (0.18.1)
99
+ docile (~> 1.1)
100
+ simplecov-html (~> 0.11.0)
101
+ simplecov-html (0.11.0)
102
+ sprockets (3.7.2)
103
+ concurrent-ruby (~> 1.0)
104
+ rack (> 1, < 3)
105
+ sprockets-rails (3.2.1)
106
+ actionpack (>= 4.0)
107
+ activesupport (>= 4.0)
108
+ sprockets (>= 3.0.0)
109
+ sqlite3 (1.3.13)
110
+ thor (1.0.1)
111
+ thread_safe (0.3.6)
112
+ tzinfo (1.2.6)
113
+ thread_safe (~> 0.1)
114
+
115
+ PLATFORMS
116
+ ruby
117
+
118
+ DEPENDENCIES
119
+ appraisal
120
+ minitest
121
+ rails (= 4.2.11.1)
122
+ rake
123
+ setler!
124
+ simplecov
125
+ sqlite3 (= 1.3.13)
126
+
127
+ BUNDLED WITH
128
+ 1.17.3
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "5.2.3"
6
+ gem "sqlite3"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,143 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ setler (0.0.13)
5
+ activerecord (>= 3.0.0)
6
+ rails (>= 3.0.0)
7
+ sprockets (= 3.7.2)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actioncable (5.2.3)
13
+ actionpack (= 5.2.3)
14
+ nio4r (~> 2.0)
15
+ websocket-driver (>= 0.6.1)
16
+ actionmailer (5.2.3)
17
+ actionpack (= 5.2.3)
18
+ actionview (= 5.2.3)
19
+ activejob (= 5.2.3)
20
+ mail (~> 2.5, >= 2.5.4)
21
+ rails-dom-testing (~> 2.0)
22
+ actionpack (5.2.3)
23
+ actionview (= 5.2.3)
24
+ activesupport (= 5.2.3)
25
+ rack (~> 2.0)
26
+ rack-test (>= 0.6.3)
27
+ rails-dom-testing (~> 2.0)
28
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
+ actionview (5.2.3)
30
+ activesupport (= 5.2.3)
31
+ builder (~> 3.1)
32
+ erubi (~> 1.4)
33
+ rails-dom-testing (~> 2.0)
34
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
+ activejob (5.2.3)
36
+ activesupport (= 5.2.3)
37
+ globalid (>= 0.3.6)
38
+ activemodel (5.2.3)
39
+ activesupport (= 5.2.3)
40
+ activerecord (5.2.3)
41
+ activemodel (= 5.2.3)
42
+ activesupport (= 5.2.3)
43
+ arel (>= 9.0)
44
+ activestorage (5.2.3)
45
+ actionpack (= 5.2.3)
46
+ activerecord (= 5.2.3)
47
+ marcel (~> 0.3.1)
48
+ activesupport (5.2.3)
49
+ concurrent-ruby (~> 1.0, >= 1.0.2)
50
+ i18n (>= 0.7, < 2)
51
+ minitest (~> 5.1)
52
+ tzinfo (~> 1.1)
53
+ appraisal (2.2.0)
54
+ bundler
55
+ rake
56
+ thor (>= 0.14.0)
57
+ arel (9.0.0)
58
+ builder (3.2.4)
59
+ concurrent-ruby (1.1.5)
60
+ crass (1.0.6)
61
+ docile (1.3.2)
62
+ erubi (1.9.0)
63
+ globalid (0.4.2)
64
+ activesupport (>= 4.2.0)
65
+ i18n (1.8.2)
66
+ concurrent-ruby (~> 1.0)
67
+ loofah (2.4.0)
68
+ crass (~> 1.0.2)
69
+ nokogiri (>= 1.5.9)
70
+ mail (2.7.1)
71
+ mini_mime (>= 0.1.1)
72
+ marcel (0.3.3)
73
+ mimemagic (~> 0.3.2)
74
+ method_source (0.9.2)
75
+ mimemagic (0.3.4)
76
+ mini_mime (1.0.2)
77
+ mini_portile2 (2.4.0)
78
+ minitest (5.14.0)
79
+ nio4r (2.5.2)
80
+ nokogiri (1.10.7)
81
+ mini_portile2 (~> 2.4.0)
82
+ rack (2.2.1)
83
+ rack-test (1.1.0)
84
+ rack (>= 1.0, < 3)
85
+ rails (5.2.3)
86
+ actioncable (= 5.2.3)
87
+ actionmailer (= 5.2.3)
88
+ actionpack (= 5.2.3)
89
+ actionview (= 5.2.3)
90
+ activejob (= 5.2.3)
91
+ activemodel (= 5.2.3)
92
+ activerecord (= 5.2.3)
93
+ activestorage (= 5.2.3)
94
+ activesupport (= 5.2.3)
95
+ bundler (>= 1.3.0)
96
+ railties (= 5.2.3)
97
+ sprockets-rails (>= 2.0.0)
98
+ rails-dom-testing (2.0.3)
99
+ activesupport (>= 4.2.0)
100
+ nokogiri (>= 1.6)
101
+ rails-html-sanitizer (1.3.0)
102
+ loofah (~> 2.3)
103
+ railties (5.2.3)
104
+ actionpack (= 5.2.3)
105
+ activesupport (= 5.2.3)
106
+ method_source
107
+ rake (>= 0.8.7)
108
+ thor (>= 0.19.0, < 2.0)
109
+ rake (13.0.1)
110
+ simplecov (0.18.1)
111
+ docile (~> 1.1)
112
+ simplecov-html (~> 0.11.0)
113
+ simplecov-html (0.11.0)
114
+ sprockets (3.7.2)
115
+ concurrent-ruby (~> 1.0)
116
+ rack (> 1, < 3)
117
+ sprockets-rails (3.2.1)
118
+ actionpack (>= 4.0)
119
+ activesupport (>= 4.0)
120
+ sprockets (>= 3.0.0)
121
+ sqlite3 (1.4.2)
122
+ thor (1.0.1)
123
+ thread_safe (0.3.6)
124
+ tzinfo (1.2.6)
125
+ thread_safe (~> 0.1)
126
+ websocket-driver (0.7.1)
127
+ websocket-extensions (>= 0.1.0)
128
+ websocket-extensions (0.1.4)
129
+
130
+ PLATFORMS
131
+ ruby
132
+
133
+ DEPENDENCIES
134
+ appraisal
135
+ minitest
136
+ rails (= 5.2.3)
137
+ rake
138
+ setler!
139
+ simplecov
140
+ sqlite3
141
+
142
+ BUNDLED WITH
143
+ 1.17.3
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", git: "https://github.com/rails/rails"
6
+ gem "sqlite3"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,167 @@
1
+ GIT
2
+ remote: https://github.com/rails/rails
3
+ revision: c77a949299fcddd0f6f35d9bc21888b862ff665c
4
+ specs:
5
+ actioncable (6.1.0.alpha)
6
+ actionpack (= 6.1.0.alpha)
7
+ activesupport (= 6.1.0.alpha)
8
+ nio4r (~> 2.0)
9
+ websocket-driver (>= 0.6.1)
10
+ actionmailbox (6.1.0.alpha)
11
+ actionpack (= 6.1.0.alpha)
12
+ activejob (= 6.1.0.alpha)
13
+ activerecord (= 6.1.0.alpha)
14
+ activestorage (= 6.1.0.alpha)
15
+ activesupport (= 6.1.0.alpha)
16
+ mail (>= 2.7.1)
17
+ actionmailer (6.1.0.alpha)
18
+ actionpack (= 6.1.0.alpha)
19
+ actionview (= 6.1.0.alpha)
20
+ activejob (= 6.1.0.alpha)
21
+ activesupport (= 6.1.0.alpha)
22
+ mail (~> 2.5, >= 2.5.4)
23
+ rails-dom-testing (~> 2.0)
24
+ actionpack (6.1.0.alpha)
25
+ actionview (= 6.1.0.alpha)
26
+ activesupport (= 6.1.0.alpha)
27
+ rack (~> 2.0, >= 2.0.8)
28
+ rack-test (>= 0.6.3)
29
+ rails-dom-testing (~> 2.0)
30
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
31
+ actiontext (6.1.0.alpha)
32
+ actionpack (= 6.1.0.alpha)
33
+ activerecord (= 6.1.0.alpha)
34
+ activestorage (= 6.1.0.alpha)
35
+ activesupport (= 6.1.0.alpha)
36
+ nokogiri (>= 1.8.5)
37
+ actionview (6.1.0.alpha)
38
+ activesupport (= 6.1.0.alpha)
39
+ builder (~> 3.1)
40
+ erubi (~> 1.4)
41
+ rails-dom-testing (~> 2.0)
42
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
43
+ activejob (6.1.0.alpha)
44
+ activesupport (= 6.1.0.alpha)
45
+ globalid (>= 0.3.6)
46
+ activemodel (6.1.0.alpha)
47
+ activesupport (= 6.1.0.alpha)
48
+ activerecord (6.1.0.alpha)
49
+ activemodel (= 6.1.0.alpha)
50
+ activesupport (= 6.1.0.alpha)
51
+ activestorage (6.1.0.alpha)
52
+ actionpack (= 6.1.0.alpha)
53
+ activejob (= 6.1.0.alpha)
54
+ activerecord (= 6.1.0.alpha)
55
+ activesupport (= 6.1.0.alpha)
56
+ marcel (~> 0.3.1)
57
+ activesupport (6.1.0.alpha)
58
+ concurrent-ruby (~> 1.0, >= 1.0.2)
59
+ i18n (>= 1.6, < 2)
60
+ minitest (~> 5.1)
61
+ tzinfo (~> 1.1)
62
+ zeitwerk (~> 2.2, >= 2.2.2)
63
+ rails (6.1.0.alpha)
64
+ actioncable (= 6.1.0.alpha)
65
+ actionmailbox (= 6.1.0.alpha)
66
+ actionmailer (= 6.1.0.alpha)
67
+ actionpack (= 6.1.0.alpha)
68
+ actiontext (= 6.1.0.alpha)
69
+ actionview (= 6.1.0.alpha)
70
+ activejob (= 6.1.0.alpha)
71
+ activemodel (= 6.1.0.alpha)
72
+ activerecord (= 6.1.0.alpha)
73
+ activestorage (= 6.1.0.alpha)
74
+ activesupport (= 6.1.0.alpha)
75
+ bundler (>= 1.3.0)
76
+ railties (= 6.1.0.alpha)
77
+ sprockets-rails (>= 2.0.0)
78
+ railties (6.1.0.alpha)
79
+ actionpack (= 6.1.0.alpha)
80
+ activesupport (= 6.1.0.alpha)
81
+ method_source
82
+ rake (>= 0.8.7)
83
+ thor (~> 1.0)
84
+
85
+ PATH
86
+ remote: ..
87
+ specs:
88
+ setler (0.0.13)
89
+ activerecord (>= 3.0.0)
90
+ rails (>= 3.0.0)
91
+ sprockets (= 3.7.2)
92
+
93
+ GEM
94
+ remote: https://rubygems.org/
95
+ specs:
96
+ appraisal (2.2.0)
97
+ bundler
98
+ rake
99
+ thor (>= 0.14.0)
100
+ builder (3.2.4)
101
+ concurrent-ruby (1.1.5)
102
+ crass (1.0.6)
103
+ docile (1.3.2)
104
+ erubi (1.9.0)
105
+ globalid (0.4.2)
106
+ activesupport (>= 4.2.0)
107
+ i18n (1.8.2)
108
+ concurrent-ruby (~> 1.0)
109
+ loofah (2.4.0)
110
+ crass (~> 1.0.2)
111
+ nokogiri (>= 1.5.9)
112
+ mail (2.7.1)
113
+ mini_mime (>= 0.1.1)
114
+ marcel (0.3.3)
115
+ mimemagic (~> 0.3.2)
116
+ method_source (0.9.2)
117
+ mimemagic (0.3.4)
118
+ mini_mime (1.0.2)
119
+ mini_portile2 (2.4.0)
120
+ minitest (5.14.0)
121
+ nio4r (2.5.2)
122
+ nokogiri (1.10.7)
123
+ mini_portile2 (~> 2.4.0)
124
+ rack (2.2.1)
125
+ rack-test (1.1.0)
126
+ rack (>= 1.0, < 3)
127
+ rails-dom-testing (2.0.3)
128
+ activesupport (>= 4.2.0)
129
+ nokogiri (>= 1.6)
130
+ rails-html-sanitizer (1.3.0)
131
+ loofah (~> 2.3)
132
+ rake (13.0.1)
133
+ simplecov (0.18.1)
134
+ docile (~> 1.1)
135
+ simplecov-html (~> 0.11.0)
136
+ simplecov-html (0.11.0)
137
+ sprockets (3.7.2)
138
+ concurrent-ruby (~> 1.0)
139
+ rack (> 1, < 3)
140
+ sprockets-rails (3.2.1)
141
+ actionpack (>= 4.0)
142
+ activesupport (>= 4.0)
143
+ sprockets (>= 3.0.0)
144
+ sqlite3 (1.4.2)
145
+ thor (1.0.1)
146
+ thread_safe (0.3.6)
147
+ tzinfo (1.2.6)
148
+ thread_safe (~> 0.1)
149
+ websocket-driver (0.7.1)
150
+ websocket-extensions (>= 0.1.0)
151
+ websocket-extensions (0.1.4)
152
+ zeitwerk (2.2.2)
153
+
154
+ PLATFORMS
155
+ ruby
156
+
157
+ DEPENDENCIES
158
+ appraisal
159
+ minitest
160
+ rails!
161
+ rake
162
+ setler!
163
+ simplecov
164
+ sqlite3
165
+
166
+ BUNDLED WITH
167
+ 1.17.3
@@ -9,6 +9,7 @@ class SetlerCreate<%= table_name.camelize %> < ActiveRecord::Migration
9
9
  end
10
10
 
11
11
  add_index :<%= table_name %>, [ :thing_type, :thing_id, :var ], unique: true
12
+ add_index :<%= table_name %>, :var, unique: true, where: "thing_id IS NULL AND thing_type is NULL"
12
13
  end
13
14
 
14
15
  def self.down
@@ -48,11 +48,19 @@ module Setler
48
48
  # thing_scoped.find_or_create_by_var(method_name[0..-2]) should work but doesnt for some reason
49
49
  # When @object is present, thing_scoped sets the where scope for the polymorphic association
50
50
  # but the find_or_create_by wasn't using the thing_type and thing_id
51
- thing_scoped.find_or_create_by(
52
- var: var.to_s,
53
- thing_type: @object.try(:class).try(:base_class).try(:to_s),
54
- thing_id: @object.try(:id)
55
- ).update_attributes({ :value => value })
51
+ if Rails::VERSION::MAJOR == 3
52
+ thing_scoped.find_or_create_by_var_and_thing_type_and_thing_id(
53
+ var.to_s,
54
+ @object.try(:class).try(:base_class).try(:to_s),
55
+ @object.try(:id)
56
+ ).update({ :value => value })
57
+ else
58
+ thing_scoped.find_or_create_by(
59
+ var: var.to_s,
60
+ thing_type: @object.try(:class).try(:base_class).try(:to_s),
61
+ thing_id: @object.try(:id)
62
+ ).update({ :value => value })
63
+ end
56
64
  end
57
65
 
58
66
  def self.destroy(var_name)
@@ -1,3 +1,3 @@
1
1
  module Setler
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
data/setler.gemspec CHANGED
@@ -7,12 +7,11 @@ Gem::Specification.new do |s|
7
7
  s.version = Setler::VERSION
8
8
  s.authors = ["Chris Kelly"]
9
9
  s.email = ["ckdake@ckdake.com"]
10
+ s.license = 'MIT'
10
11
  s.homepage = "https://github.com/ckdake/setler"
11
12
  s.summary = %q{Settler lets you use the 'Feature Flags' pettern or add settings to models.}
12
13
  s.description = %q{Setler is a Gem that lets one easily implement the "Feature Flags" pattern, or add settings to individual models. This is a cleanroom implementation of what the 'rails-settings' gem does. It's been forked all over the place, and my favorite version of it doesn't have any tests and doesn't work with settings associated with models.}
13
14
 
14
- s.rubyforge_project = "setler"
15
-
16
15
  s.files = `git ls-files`.split("\n")
17
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
@@ -20,8 +19,10 @@ Gem::Specification.new do |s|
20
19
 
21
20
  s.add_dependency('activerecord', '>=3.0.0')
22
21
  s.add_dependency('rails', '>=3.0.0')
22
+ s.add_dependency('sprockets', '3.7.2') # 10/16/2019: LOCKED DOWN
23
23
 
24
- s.add_development_dependency('sqlite3')
25
24
  s.add_development_dependency('rake')
26
25
  s.add_development_dependency('minitest')
26
+ s.add_development_dependency('simplecov')
27
+ s.add_development_dependency('appraisal')
27
28
  end
@@ -60,7 +60,7 @@ class ::SettingsTest < Minitest::Test
60
60
  def test_update_with_nil_and_default_not_nil
61
61
  ::Settings.defaults[:foo] = :test
62
62
  ::Settings.foo = nil
63
- assert_equal nil, ::Settings.foo
63
+ assert_nil ::Settings.foo
64
64
  end
65
65
 
66
66
  def test_update_with_array_syntax
@@ -76,8 +76,20 @@ class ::SettingsTest < Minitest::Test
76
76
  assert_equal '123', ::Settings.onetwothree
77
77
  end
78
78
 
79
+ def test_multithreaded_create
80
+ s1 = Settings.new var: :conflict, value: 1
81
+ s2 = Settings.new var: :conflict, value: 2
82
+ s1.save!
83
+ exc = assert_raises ActiveRecord::RecordNotUnique, ActiveRecord::StatementInvalid do
84
+ s2.save!
85
+ end
86
+ unless exc.is_a?(ActiveRecord::RecordNotUnique)
87
+ assert exc.message.match(/UNIQUE/)
88
+ end
89
+ end
90
+
79
91
  def test_complex_serialization
80
- complex = [1, '2', {:three => true}]
92
+ complex = [1, '2', {"three" => true}]
81
93
  ::Settings.complex = complex
82
94
  assert_equal complex, ::Settings.complex
83
95
  end
data/test/test_helper.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  require 'rubygems'
2
2
 
3
+ require 'simplecov'
4
+ SimpleCov.start 'rails'
5
+
3
6
  require 'bundler'
4
7
  begin
5
8
  Bundler.setup(:default, :development)
@@ -34,18 +37,20 @@ def setup_db
34
37
  t.text :value, :null => true
35
38
  t.integer :thing_id, :null => true
36
39
  t.string :thing_type, :limit => 30, :null => true
37
- t.timestamps
40
+ t.timestamps null: false
38
41
  end
39
42
  add_index :settings, [ :thing_type, :thing_id, :var ], :unique => true
43
+ add_index :settings, :var, unique: true, where: "thing_id IS NULL AND thing_type is NULL"
40
44
 
41
45
  create_table :preferences do |t|
42
46
  t.string :var, :null => false
43
47
  t.text :value, :null => true
44
48
  t.integer :thing_id, :null => true
45
49
  t.string :thing_type, :limit => 30, :null => true
46
- t.timestamps
50
+ t.timestamps null: false
47
51
  end
48
52
  add_index :preferences, [ :thing_type, :thing_id, :var ], :unique => true
53
+ add_index :preferences, :var, unique: true, where: "thing_id IS NULL AND thing_type is NULL"
49
54
 
50
55
  create_table :users do |t|
51
56
  t.string :name
metadata CHANGED
@@ -1,83 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: setler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Kelly
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-26 00:00:00.000000000 Z
11
+ date: 2021-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 3.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 3.0.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: sqlite3
42
+ name: sprockets
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 3.7.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.7.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - ! '>='
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: rake
70
+ name: minitest
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ! '>='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - ! '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: minitest
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: appraisal
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - ! '>='
101
+ - - ">="
74
102
  - !ruby/object:Gem::Version
75
103
  version: '0'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - ! '>='
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
111
  description: Setler is a Gem that lets one easily implement the "Feature Flags" pattern,
@@ -91,15 +119,22 @@ executables: []
91
119
  extensions: []
92
120
  extra_rdoc_files: []
93
121
  files:
94
- - .gitignore
95
- - .ruby-gemset
96
- - .ruby-version
97
- - .travis.yml
122
+ - ".gitignore"
123
+ - ".ruby-gemset"
124
+ - ".ruby-version"
125
+ - ".travis.yml"
126
+ - Appraisals
98
127
  - Gemfile
99
128
  - MIT-LICENSE
100
129
  - README.rdoc
101
130
  - Rakefile
102
131
  - contributors.txt
132
+ - gemfiles/rails_4.gemfile
133
+ - gemfiles/rails_4.gemfile.lock
134
+ - gemfiles/rails_5.gemfile
135
+ - gemfiles/rails_5.gemfile.lock
136
+ - gemfiles/rails_6_edge.gemfile
137
+ - gemfiles/rails_6_edge.gemfile.lock
103
138
  - lib/generators/setler/setler_generator.rb
104
139
  - lib/generators/setler/templates/migration.rb
105
140
  - lib/generators/setler/templates/model.rb
@@ -113,26 +148,26 @@ files:
113
148
  - test/settings_test.rb
114
149
  - test/test_helper.rb
115
150
  homepage: https://github.com/ckdake/setler
116
- licenses: []
151
+ licenses:
152
+ - MIT
117
153
  metadata: {}
118
- post_install_message:
154
+ post_install_message:
119
155
  rdoc_options: []
120
156
  require_paths:
121
157
  - lib
122
158
  required_ruby_version: !ruby/object:Gem::Requirement
123
159
  requirements:
124
- - - ! '>='
160
+ - - ">="
125
161
  - !ruby/object:Gem::Version
126
162
  version: '0'
127
163
  required_rubygems_version: !ruby/object:Gem::Requirement
128
164
  requirements:
129
- - - ! '>='
165
+ - - ">="
130
166
  - !ruby/object:Gem::Version
131
167
  version: '0'
132
168
  requirements: []
133
- rubyforge_project: setler
134
- rubygems_version: 2.2.2
135
- signing_key:
169
+ rubygems_version: 3.2.22
170
+ signing_key:
136
171
  specification_version: 4
137
172
  summary: Settler lets you use the 'Feature Flags' pettern or add settings to models.
138
173
  test_files: