cached_resource 7.2.0 → 9.0.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/lib/cached_resource/cached_resource.rb +2 -2
- data/lib/cached_resource/caching.rb +48 -28
- data/lib/cached_resource/configuration.rb +17 -15
- data/lib/cached_resource/version.rb +1 -1
- data/lib/cached_resource.rb +10 -10
- metadata +80 -27
- data/.github/workflows/ruby.yml +0 -109
- data/.gitignore +0 -7
- data/.rspec +0 -3
- data/FUNDING.json +0 -7
- data/Gemfile +0 -29
- data/LICENSE +0 -20
- data/README.md +0 -208
- data/Rakefile +0 -7
- data/cached_resource.gemspec +0 -28
- data/gemfiles/4.2.gemfile +0 -6
- data/gemfiles/5.0.gemfile +0 -3
- data/gemfiles/5.1.gemfile +0 -3
- data/gemfiles/6.0.gemfile +0 -3
- data/gemfiles/6.1.gemfile +0 -3
- data/gemfiles/7.0.gemfile +0 -3
- data/spec/cached_resource/cached_resource_spec.rb +0 -29
- data/spec/cached_resource/caching_spec.rb +0 -594
- data/spec/cached_resource/configuration_spec.rb +0 -235
- data/spec/spec_helper.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42ea4ceb6fd67accfe68fba67eecbde7c9c2f6289fdc382c095e88faf431b37a
|
4
|
+
data.tar.gz: 3ed45f62bf3d3be125b348ca0181fbd87f0becf70c5fb3d617095476cb0d6b6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 677095f51ebb4555c9c42cf66989146e3d972cf7522cae23f9618ab55843730bfa15b32ba607e84bdf8451b270142edbf4e600477a68712bba4a98b5ac2cec56
|
7
|
+
data.tar.gz: 6401482cbcc33c775b12b64a0c66d029073a904eb485be863bb8236cb60b9635683f478d97f9b5a30cb1aadc2808182f3f1eaf6f5f6e9df6a48f85194cdea19d
|
@@ -10,7 +10,7 @@ module CachedResource
|
|
10
10
|
attr_accessor :cached_resource
|
11
11
|
|
12
12
|
# Initialize cached resource or retrieve the current cached resource configuration.
|
13
|
-
def cached_resource(options={})
|
13
|
+
def cached_resource(options = {})
|
14
14
|
defined?(@cached_resource) && @cached_resource || setup_cached_resource!(options)
|
15
15
|
end
|
16
16
|
|
@@ -30,7 +30,7 @@ module CachedResource
|
|
30
30
|
# that wants an independent configuration will need to execute:
|
31
31
|
# self.cached_resource = CachedResource::Configuration.new(options={})
|
32
32
|
def inherited(child)
|
33
|
-
child.cached_resource =
|
33
|
+
child.cached_resource = cached_resource if defined?(@cached_resource)
|
34
34
|
super
|
35
35
|
end
|
36
36
|
end
|
@@ -25,8 +25,10 @@ module CachedResource
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# Clear the cache.
|
28
|
-
def clear_cache(options=nil)
|
28
|
+
def clear_cache(options = nil)
|
29
29
|
cache_clear(options)
|
30
|
+
|
31
|
+
true
|
30
32
|
end
|
31
33
|
|
32
34
|
private
|
@@ -45,7 +47,7 @@ module CachedResource
|
|
45
47
|
cache_collection_synchronize(object, *arguments) if cached_resource.collection_synchronize
|
46
48
|
return object if !cached_resource.cache_collections && is_any_collection?(*arguments)
|
47
49
|
cache_write(key, object, *arguments)
|
48
|
-
|
50
|
+
object
|
49
51
|
end
|
50
52
|
|
51
53
|
# If this is a pure, unadulterated "all" request
|
@@ -73,7 +75,9 @@ module CachedResource
|
|
73
75
|
collection = cache_read(cache_key(cached_resource.collection_arguments))
|
74
76
|
|
75
77
|
if collection && !updates.empty?
|
76
|
-
index = collection.
|
78
|
+
index = collection.each_with_object({}) { |object, hash|
|
79
|
+
hash[object.send(primary_key)] = object
|
80
|
+
}
|
77
81
|
updates.each { |object| index[object.send(primary_key)] = object }
|
78
82
|
cache_write(cache_key(cached_resource.collection_arguments), index.values, *arguments)
|
79
83
|
end
|
@@ -82,7 +86,7 @@ module CachedResource
|
|
82
86
|
# Avoid cache nil or [] objects
|
83
87
|
def should_cache?(object)
|
84
88
|
return false unless cached_resource.enabled
|
85
|
-
object.
|
89
|
+
object.present?
|
86
90
|
end
|
87
91
|
|
88
92
|
# Determine if the given arguments represent
|
@@ -94,13 +98,12 @@ module CachedResource
|
|
94
98
|
# Determine if the given arguments represent
|
95
99
|
# any collection of objects
|
96
100
|
def is_any_collection?(*arguments)
|
97
|
-
cached_resource.collection_arguments.all?{ |arg| arguments.include?(arg) } || arguments.include?(:all)
|
101
|
+
cached_resource.collection_arguments.all? { |arg| arguments.include?(arg) } || arguments.include?(:all)
|
98
102
|
end
|
99
103
|
|
100
104
|
# Read a entry from the cache for the given key.
|
101
105
|
def cache_read(key)
|
102
106
|
object = cached_resource.cache.read(key).try do |json_cache|
|
103
|
-
|
104
107
|
json = ActiveSupport::JSON.decode(json_cache)
|
105
108
|
|
106
109
|
unless json.nil?
|
@@ -110,7 +113,7 @@ module CachedResource
|
|
110
113
|
next restored unless respond_to?(:collection_parser)
|
111
114
|
collection_parser.new(restored).tap do |parser|
|
112
115
|
parser.resource_class = self
|
113
|
-
parser.original_params = json[
|
116
|
+
parser.original_params = json["original_params"].deep_symbolize_keys
|
114
117
|
end
|
115
118
|
else
|
116
119
|
full_dup(cache)
|
@@ -127,32 +130,51 @@ module CachedResource
|
|
127
130
|
params = options[:params]
|
128
131
|
prefix_options, query_options = split_options(params)
|
129
132
|
|
130
|
-
result = cached_resource.cache.write(key, object_to_json(object, prefix_options, query_options), :
|
133
|
+
result = cached_resource.cache.write(key, object_to_json(object, prefix_options, query_options), race_condition_ttl: cached_resource.race_condition_ttl, expires_in: cached_resource.generate_ttl)
|
131
134
|
result && cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} WRITE #{key}")
|
132
135
|
result
|
133
136
|
end
|
134
137
|
|
135
|
-
|
136
|
-
|
137
|
-
# Memcache doesn't support delete_matched, which can also be computationally expensive
|
138
|
-
if cached_resource.cache.class.to_s == 'ActiveSupport::Cache::MemCacheStore' || options.try(:fetch,:all)
|
138
|
+
def cache_clear(options = nil)
|
139
|
+
if !cached_resource.cache.respond_to?(:delete_matched) || options.try(:fetch, :all)
|
139
140
|
cached_resource.cache.clear.tap do |result|
|
140
141
|
cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} CLEAR ALL")
|
141
142
|
end
|
142
143
|
else
|
143
|
-
cached_resource.cache.delete_matched(
|
144
|
-
cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} CLEAR #{
|
144
|
+
cached_resource.cache.delete_matched(cache_key_delete_pattern).tap do |result|
|
145
|
+
cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} CLEAR #{cache_key_delete_pattern}")
|
145
146
|
end
|
146
147
|
end
|
147
148
|
end
|
148
149
|
|
150
|
+
def cache_key_delete_pattern
|
151
|
+
case cached_resource.cache
|
152
|
+
when ActiveSupport::Cache::MemoryStore, ActiveSupport::Cache::FileStore
|
153
|
+
/^#{name_key}\//
|
154
|
+
else
|
155
|
+
"#{name_key}/*"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
149
159
|
# Generate the request cache key.
|
150
160
|
def cache_key(*arguments)
|
151
|
-
"#{name_key}/#{arguments.join(
|
161
|
+
"#{name_key}/#{arguments.join("/")}".downcase.delete(" ")
|
152
162
|
end
|
153
163
|
|
154
164
|
def name_key
|
155
|
-
name.parameterize.
|
165
|
+
cache_key_prefix + name.parameterize.tr("-", "/")
|
166
|
+
end
|
167
|
+
|
168
|
+
def cache_key_prefix
|
169
|
+
prefix = cached_resource.cache_key_prefix
|
170
|
+
return "" if prefix.nil?
|
171
|
+
|
172
|
+
if prefix.respond_to?(:call)
|
173
|
+
result = prefix.call
|
174
|
+
result.nil? ? "" : "#{result}/"
|
175
|
+
else
|
176
|
+
"#{prefix}/"
|
177
|
+
end
|
156
178
|
end
|
157
179
|
|
158
180
|
# Make a full duplicate of an ActiveResource record.
|
@@ -164,16 +186,16 @@ module CachedResource
|
|
164
186
|
end
|
165
187
|
|
166
188
|
def json_to_object(json)
|
167
|
-
resource = json[
|
189
|
+
resource = json["resource"]
|
168
190
|
if resource.is_a? Array
|
169
191
|
resource.map do |attrs|
|
170
|
-
|
171
|
-
resource.prefix_options = json[
|
192
|
+
new(attrs["object"], attrs["persistence"]).tap do |resource|
|
193
|
+
resource.prefix_options = json["prefix_options"]
|
172
194
|
end
|
173
195
|
end
|
174
196
|
else
|
175
|
-
|
176
|
-
resource.prefix_options = json[
|
197
|
+
new(resource["object"], resource["persistence"]).tap do |resource|
|
198
|
+
resource.prefix_options = json["prefix_options"]
|
177
199
|
end
|
178
200
|
end
|
179
201
|
end
|
@@ -181,16 +203,14 @@ module CachedResource
|
|
181
203
|
def object_to_json(object, prefix_options, query_options)
|
182
204
|
if object.is_a? Enumerable
|
183
205
|
{
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
206
|
+
resource: object.map { |o| {object: o, persistence: o.persisted?} },
|
207
|
+
prefix_options: prefix_options,
|
208
|
+
original_params: query_options
|
187
209
|
}.to_json
|
188
|
-
elsif object.nil?
|
189
|
-
nil.to_json
|
190
210
|
else
|
191
211
|
{
|
192
|
-
:
|
193
|
-
:
|
212
|
+
resource: {object: object, persistence: object.persisted?},
|
213
|
+
prefix_options: prefix_options
|
194
214
|
}.to_json
|
195
215
|
end
|
196
216
|
end
|
@@ -2,7 +2,6 @@ module CachedResource
|
|
2
2
|
# The Configuration class manages class specific options
|
3
3
|
# for cached resource.
|
4
4
|
class Configuration < OpenStruct
|
5
|
-
|
6
5
|
# default or fallback cache without rails
|
7
6
|
CACHE = ActiveSupport::Cache::MemoryStore.new
|
8
7
|
|
@@ -24,18 +23,19 @@ module CachedResource
|
|
24
23
|
# :cache, default: Rails.cache or ActiveSupport::Cache::MemoryStore.new,
|
25
24
|
# :logger, default: Rails.logger or ActiveSupport::Logger.new(NilIO.new),
|
26
25
|
# :cache_collections, default: true
|
27
|
-
def initialize(options={})
|
26
|
+
def initialize(options = {})
|
28
27
|
super({
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
28
|
+
cache: defined?(Rails.cache) && Rails.cache || CACHE,
|
29
|
+
cache_collections: true,
|
30
|
+
cache_key_prefix: nil,
|
31
|
+
collection_arguments: [:all],
|
32
|
+
collection_synchronize: false,
|
33
|
+
enabled: true,
|
34
|
+
logger: defined?(Rails.logger) && Rails.logger || LOGGER,
|
35
|
+
race_condition_ttl: 86400,
|
36
|
+
ttl: 604800,
|
37
|
+
ttl_randomization: false,
|
38
|
+
ttl_randomization_scale: 1..2
|
39
39
|
}.merge(options))
|
40
40
|
end
|
41
41
|
|
@@ -47,6 +47,8 @@ module CachedResource
|
|
47
47
|
end
|
48
48
|
|
49
49
|
# Enables caching.
|
50
|
+
# NOTE: Disabled coverage because it is not being picked up by simplecov
|
51
|
+
# :nocov:
|
50
52
|
def on!
|
51
53
|
self.enabled = true
|
52
54
|
end
|
@@ -55,6 +57,7 @@ module CachedResource
|
|
55
57
|
def off!
|
56
58
|
self.enabled = false
|
57
59
|
end
|
60
|
+
# :nocov:
|
58
61
|
|
59
62
|
private
|
60
63
|
|
@@ -66,10 +69,9 @@ module CachedResource
|
|
66
69
|
|
67
70
|
# Choose a random value from within the given range, optionally
|
68
71
|
# seeded by seed.
|
69
|
-
def sample_range(range, seed=nil)
|
72
|
+
def sample_range(range, seed = nil)
|
70
73
|
srand seed if seed
|
71
74
|
rand * (range.end - range.begin) + range.begin
|
72
75
|
end
|
73
|
-
|
74
76
|
end
|
75
|
-
end
|
77
|
+
end
|
data/lib/cached_resource.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
require
|
1
|
+
require "ostruct"
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
3
|
+
require "nilio"
|
4
|
+
require "active_support/cache"
|
5
|
+
require "active_support/concern"
|
6
|
+
require "active_support/logger"
|
7
|
+
require "cached_resource/cached_resource"
|
8
|
+
require "cached_resource/configuration"
|
9
|
+
require "cached_resource/caching"
|
10
|
+
require "cached_resource/version"
|
11
|
+
require "active_resource"
|
12
12
|
|
13
13
|
module CachedResource
|
14
14
|
# nada
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cached_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Morgan Brown
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: concurrent-ruby
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rake
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,36 +108,65 @@ dependencies:
|
|
80
108
|
- - ">="
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.22.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.22.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: standard
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.39'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 1.39.1
|
135
|
+
type: :development
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - "~>"
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '1.39'
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: 1.39.1
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: timecop
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: 0.9.10
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: 0.9.10
|
83
159
|
description: Enables request-based caching for ActiveResource
|
84
160
|
email: cached_resource@email.mhgbrown.is
|
85
161
|
executables: []
|
86
162
|
extensions: []
|
87
163
|
extra_rdoc_files: []
|
88
164
|
files:
|
89
|
-
- ".github/workflows/ruby.yml"
|
90
|
-
- ".gitignore"
|
91
|
-
- ".rspec"
|
92
|
-
- FUNDING.json
|
93
|
-
- Gemfile
|
94
|
-
- LICENSE
|
95
|
-
- README.md
|
96
|
-
- Rakefile
|
97
|
-
- cached_resource.gemspec
|
98
|
-
- gemfiles/4.2.gemfile
|
99
|
-
- gemfiles/5.0.gemfile
|
100
|
-
- gemfiles/5.1.gemfile
|
101
|
-
- gemfiles/6.0.gemfile
|
102
|
-
- gemfiles/6.1.gemfile
|
103
|
-
- gemfiles/7.0.gemfile
|
104
165
|
- lib/cached_resource.rb
|
105
166
|
- lib/cached_resource/cached_resource.rb
|
106
167
|
- lib/cached_resource/caching.rb
|
107
168
|
- lib/cached_resource/configuration.rb
|
108
169
|
- lib/cached_resource/version.rb
|
109
|
-
- spec/cached_resource/cached_resource_spec.rb
|
110
|
-
- spec/cached_resource/caching_spec.rb
|
111
|
-
- spec/cached_resource/configuration_spec.rb
|
112
|
-
- spec/spec_helper.rb
|
113
170
|
homepage: https://github.com/mhgbrown/cached_resource
|
114
171
|
licenses:
|
115
172
|
- MIT
|
@@ -122,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
179
|
requirements:
|
123
180
|
- - ">="
|
124
181
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
182
|
+
version: '3.0'
|
126
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
184
|
requirements:
|
128
185
|
- - ">="
|
@@ -133,8 +190,4 @@ rubygems_version: 3.1.6
|
|
133
190
|
signing_key:
|
134
191
|
specification_version: 4
|
135
192
|
summary: Caching for ActiveResource
|
136
|
-
test_files:
|
137
|
-
- spec/cached_resource/cached_resource_spec.rb
|
138
|
-
- spec/cached_resource/caching_spec.rb
|
139
|
-
- spec/cached_resource/configuration_spec.rb
|
140
|
-
- spec/spec_helper.rb
|
193
|
+
test_files: []
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
|
-
name: Test
|
9
|
-
|
10
|
-
on: [push]
|
11
|
-
|
12
|
-
permissions:
|
13
|
-
contents: read
|
14
|
-
|
15
|
-
jobs:
|
16
|
-
test:
|
17
|
-
|
18
|
-
runs-on: ubuntu-20.04
|
19
|
-
|
20
|
-
strategy:
|
21
|
-
matrix:
|
22
|
-
ruby-version: ['1.9', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2']
|
23
|
-
rails-version: ['4.2', '5.0', '5.1', '6.0', '6.1', '7.0']
|
24
|
-
exclude:
|
25
|
-
# Segmentation faults during tests, but should work?
|
26
|
-
- ruby-version: '2.2'
|
27
|
-
rails-version: '5.0'
|
28
|
-
- ruby-version: '2.2'
|
29
|
-
rails-version: '5.1'
|
30
|
-
# Too old
|
31
|
-
- ruby-version: '1.9'
|
32
|
-
rails-version: '5.0'
|
33
|
-
- ruby-version: '1.9'
|
34
|
-
rails-version: '5.1'
|
35
|
-
- ruby-version: '1.9'
|
36
|
-
rails-version: '6.0'
|
37
|
-
- ruby-version: '1.9'
|
38
|
-
rails-version: '6.1'
|
39
|
-
- ruby-version: '1.9'
|
40
|
-
rails-version: '7.0'
|
41
|
-
# activesupport (~> 6.0.0) was resolved to 6.0.6.1, which depends on ruby (>= 2.5.0)
|
42
|
-
# activesupport (~> 6.1.0) was resolved to 6.1.7.2, which depends on ruby (>= 2.5.0)
|
43
|
-
- ruby-version: '2.2'
|
44
|
-
rails-version: '6.0'
|
45
|
-
- ruby-version: '2.2'
|
46
|
-
rails-version: '6.1'
|
47
|
-
- ruby-version: '2.3'
|
48
|
-
rails-version: '6.0'
|
49
|
-
- ruby-version: '2.3'
|
50
|
-
rails-version: '6.1'
|
51
|
-
- ruby-version: '2.4'
|
52
|
-
rails-version: '6.0'
|
53
|
-
- ruby-version: '2.4'
|
54
|
-
rails-version: '6.1'
|
55
|
-
# activesupport (~> 7.0.0) was resolved to 7.0.4.2, which depends on Ruby (>= 2.7.0)
|
56
|
-
- ruby-version: '2.2'
|
57
|
-
rails-version: '7.0'
|
58
|
-
- ruby-version: '2.3'
|
59
|
-
rails-version: '7.0'
|
60
|
-
- ruby-version: '2.4'
|
61
|
-
rails-version: '7.0'
|
62
|
-
- ruby-version: '2.5'
|
63
|
-
rails-version: '7.0'
|
64
|
-
- ruby-version: '2.6'
|
65
|
-
rails-version: '7.0'
|
66
|
-
# incompatbility with BigDecimal.new
|
67
|
-
- ruby-version: '2.7'
|
68
|
-
rails-version: '4.2'
|
69
|
-
- ruby-version: '3.0'
|
70
|
-
rails-version: '4.2'
|
71
|
-
- ruby-version: '3.1'
|
72
|
-
rails-version: '4.2'
|
73
|
-
- ruby-version: '3.2'
|
74
|
-
rails-version: '4.2'
|
75
|
-
# ArgumentError: expected attributes to be able to convert to Hash, got "#<Thing:0x000055d208b2e258>"
|
76
|
-
# probably keyword argument delegation different in Ruby 3
|
77
|
-
# https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
|
78
|
-
- ruby-version: '3.0'
|
79
|
-
rails-version: '5.0'
|
80
|
-
- ruby-version: '3.0'
|
81
|
-
rails-version: '5.1'
|
82
|
-
- ruby-version: '3.1'
|
83
|
-
rails-version: '5.0'
|
84
|
-
- ruby-version: '3.1'
|
85
|
-
rails-version: '5.1'
|
86
|
-
- ruby-version: '3.2'
|
87
|
-
rails-version: '5.0'
|
88
|
-
- ruby-version: '3.2'
|
89
|
-
rails-version: '5.1'
|
90
|
-
|
91
|
-
steps:
|
92
|
-
- uses: actions/checkout@v3
|
93
|
-
- name: Set up Ruby ${{ matrix.ruby-version }}
|
94
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
95
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
96
|
-
# uses: ruby/setup-ruby@v1
|
97
|
-
uses: ruby/setup-ruby@v1
|
98
|
-
with:
|
99
|
-
ruby-version: ${{ matrix.ruby-version }}
|
100
|
-
- name: Install bundler 1.x.x
|
101
|
-
if: matrix.rails-version == '4.2'
|
102
|
-
run: gem uninstall -aIx bundler && gem install bundler -v 1.17.3
|
103
|
-
- name: Install dependencies
|
104
|
-
run: bundle install
|
105
|
-
env:
|
106
|
-
TEST_RAILS_VERSION: ${{ matrix.rails-version }}
|
107
|
-
DEBUG: true
|
108
|
-
- name: Run tests
|
109
|
-
run: bundle exec rake
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/FUNDING.json
DELETED
data/Gemfile
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
gemspec
|
4
|
-
|
5
|
-
def eval_gemfile(path)
|
6
|
-
gemfile_local = File.expand_path(path, __FILE__)
|
7
|
-
if File.readable?(gemfile_local)
|
8
|
-
puts "Loading #{gemfile_local}..." if ENV['DEBUG']
|
9
|
-
instance_eval(File.read(gemfile_local))
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
puts "\e[93mUsing TEST_RAILS_VERSION #{ENV['TEST_RAILS_VERSION']}\e[0m" if ENV['DEBUG']
|
14
|
-
case ENV['TEST_RAILS_VERSION']
|
15
|
-
when "4.2"
|
16
|
-
eval_gemfile('../gemfiles/4.2.gemfile')
|
17
|
-
when "5.0"
|
18
|
-
eval_gemfile('../gemfiles/5.0.gemfile')
|
19
|
-
when "5.1"
|
20
|
-
eval_gemfile('../gemfiles/5.1.gemfile')
|
21
|
-
when "6.0"
|
22
|
-
eval_gemfile('../gemfiles/6.0.gemfile')
|
23
|
-
when "6.1"
|
24
|
-
eval_gemfile('../gemfiles/6.1.gemfile')
|
25
|
-
when "7.0"
|
26
|
-
eval_gemfile('../gemfiles/7.0.gemfile')
|
27
|
-
else
|
28
|
-
puts "\e[93mNo TEST_RAILS_VERSION present, letting dependency manager decide what's best.\e[0m" if ENV['DEBUG']
|
29
|
-
end
|
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2018 Morgan Brown
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|