cached_resource 8.0.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 -12
- data/lib/cached_resource/caching.rb +46 -34
- data/lib/cached_resource/configuration.rb +16 -16
- data/lib/cached_resource/version.rb +1 -1
- data/lib/cached_resource.rb +10 -10
- metadata +65 -33
- data/.github/workflows/ruby.yml +0 -103
- data/.gitignore +0 -7
- data/.rspec +0 -3
- data/FUNDING.json +0 -7
- data/Gemfile +0 -31
- data/LICENSE +0 -20
- data/README.md +0 -209
- data/Rakefile +0 -7
- data/cached_resource.gemspec +0 -29
- 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/gemfiles/7.1.gemfile +0 -3
- data/spec/cached_resource/cached_resource_spec.rb +0 -29
- data/spec/cached_resource/caching_spec.rb +0 -602
- 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
|
|
@@ -18,16 +18,6 @@ module CachedResource
|
|
18
18
|
# and establishing the necessary methods.
|
19
19
|
def setup_cached_resource!(options)
|
20
20
|
@cached_resource = CachedResource::Configuration.new(options)
|
21
|
-
if @cached_resource.concurrent_write
|
22
|
-
begin
|
23
|
-
send :require, 'concurrent/promise'
|
24
|
-
rescue LoadError
|
25
|
-
@cached_resource.logger.error(
|
26
|
-
"`concurrent_write` option is enabled, but `concurrent-ruby` is not an installed dependency"
|
27
|
-
)
|
28
|
-
raise
|
29
|
-
end
|
30
|
-
end
|
31
21
|
send :include, CachedResource::Caching
|
32
22
|
@cached_resource
|
33
23
|
end
|
@@ -40,7 +30,7 @@ module CachedResource
|
|
40
30
|
# that wants an independent configuration will need to execute:
|
41
31
|
# self.cached_resource = CachedResource::Configuration.new(options={})
|
42
32
|
def inherited(child)
|
43
|
-
child.cached_resource =
|
33
|
+
child.cached_resource = cached_resource if defined?(@cached_resource)
|
44
34
|
super
|
45
35
|
end
|
46
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
|
@@ -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
|
@@ -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)
|
@@ -123,44 +126,55 @@ module CachedResource
|
|
123
126
|
|
124
127
|
# Write an entry to the cache for the given key and value.
|
125
128
|
def cache_write(key, object, *arguments)
|
126
|
-
if cached_resource.concurrent_write
|
127
|
-
Concurrent::Promise.execute { _cache_write(key, object, *arguments) } && true
|
128
|
-
else
|
129
|
-
_cache_write(key, object, *arguments)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
def _cache_write(key, object, *arguments)
|
134
129
|
options = arguments[1] || {}
|
135
130
|
params = options[:params]
|
136
131
|
prefix_options, query_options = split_options(params)
|
137
132
|
|
138
|
-
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)
|
139
134
|
result && cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} WRITE #{key}")
|
140
135
|
result
|
141
136
|
end
|
142
137
|
|
143
|
-
|
144
|
-
|
145
|
-
# Memcache doesn't support delete_matched, which can also be computationally expensive
|
146
|
-
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)
|
147
140
|
cached_resource.cache.clear.tap do |result|
|
148
141
|
cached_resource.logger.info("#{CachedResource::Configuration::LOGGER_PREFIX} CLEAR ALL")
|
149
142
|
end
|
150
143
|
else
|
151
|
-
cached_resource.cache.delete_matched(
|
152
|
-
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}")
|
153
146
|
end
|
154
147
|
end
|
155
148
|
end
|
156
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
|
+
|
157
159
|
# Generate the request cache key.
|
158
160
|
def cache_key(*arguments)
|
159
|
-
"#{name_key}/#{arguments.join(
|
161
|
+
"#{name_key}/#{arguments.join("/")}".downcase.delete(" ")
|
160
162
|
end
|
161
163
|
|
162
164
|
def name_key
|
163
|
-
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
|
164
178
|
end
|
165
179
|
|
166
180
|
# Make a full duplicate of an ActiveResource record.
|
@@ -172,16 +186,16 @@ module CachedResource
|
|
172
186
|
end
|
173
187
|
|
174
188
|
def json_to_object(json)
|
175
|
-
resource = json[
|
189
|
+
resource = json["resource"]
|
176
190
|
if resource.is_a? Array
|
177
191
|
resource.map do |attrs|
|
178
|
-
|
179
|
-
resource.prefix_options = json[
|
192
|
+
new(attrs["object"], attrs["persistence"]).tap do |resource|
|
193
|
+
resource.prefix_options = json["prefix_options"]
|
180
194
|
end
|
181
195
|
end
|
182
196
|
else
|
183
|
-
|
184
|
-
resource.prefix_options = json[
|
197
|
+
new(resource["object"], resource["persistence"]).tap do |resource|
|
198
|
+
resource.prefix_options = json["prefix_options"]
|
185
199
|
end
|
186
200
|
end
|
187
201
|
end
|
@@ -189,16 +203,14 @@ module CachedResource
|
|
189
203
|
def object_to_json(object, prefix_options, query_options)
|
190
204
|
if object.is_a? Enumerable
|
191
205
|
{
|
192
|
-
:
|
193
|
-
:
|
194
|
-
:
|
206
|
+
resource: object.map { |o| {object: o, persistence: o.persisted?} },
|
207
|
+
prefix_options: prefix_options,
|
208
|
+
original_params: query_options
|
195
209
|
}.to_json
|
196
|
-
elsif object.nil?
|
197
|
-
nil.to_json
|
198
210
|
else
|
199
211
|
{
|
200
|
-
:
|
201
|
-
:
|
212
|
+
resource: {object: object, persistence: object.persisted?},
|
213
|
+
prefix_options: prefix_options
|
202
214
|
}.to_json
|
203
215
|
end
|
204
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,20 +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
|
-
|
28
|
-
def initialize(options={})
|
26
|
+
def initialize(options = {})
|
29
27
|
super({
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
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
|
41
39
|
}.merge(options))
|
42
40
|
end
|
43
41
|
|
@@ -49,6 +47,8 @@ module CachedResource
|
|
49
47
|
end
|
50
48
|
|
51
49
|
# Enables caching.
|
50
|
+
# NOTE: Disabled coverage because it is not being picked up by simplecov
|
51
|
+
# :nocov:
|
52
52
|
def on!
|
53
53
|
self.enabled = true
|
54
54
|
end
|
@@ -57,6 +57,7 @@ module CachedResource
|
|
57
57
|
def off!
|
58
58
|
self.enabled = false
|
59
59
|
end
|
60
|
+
# :nocov:
|
60
61
|
|
61
62
|
private
|
62
63
|
|
@@ -68,10 +69,9 @@ module CachedResource
|
|
68
69
|
|
69
70
|
# Choose a random value from within the given range, optionally
|
70
71
|
# seeded by seed.
|
71
|
-
def sample_range(range, seed=nil)
|
72
|
+
def sample_range(range, seed = nil)
|
72
73
|
srand seed if seed
|
73
74
|
rand * (range.end - range.begin) + range.begin
|
74
75
|
end
|
75
|
-
|
76
76
|
end
|
77
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
|
@@ -81,56 +109,64 @@ dependencies:
|
|
81
109
|
- !ruby/object:Gem::Version
|
82
110
|
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
112
|
+
name: simplecov
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
115
|
- - "~>"
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
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'
|
90
132
|
- - ">="
|
91
133
|
- !ruby/object:Gem::Version
|
92
|
-
version: 1.
|
134
|
+
version: 1.39.1
|
93
135
|
type: :development
|
94
136
|
prerelease: false
|
95
137
|
version_requirements: !ruby/object:Gem::Requirement
|
96
138
|
requirements:
|
97
139
|
- - "~>"
|
98
140
|
- !ruby/object:Gem::Version
|
99
|
-
version: '1.
|
141
|
+
version: '1.39'
|
100
142
|
- - ">="
|
101
143
|
- !ruby/object:Gem::Version
|
102
|
-
version: 1.
|
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
|
103
159
|
description: Enables request-based caching for ActiveResource
|
104
160
|
email: cached_resource@email.mhgbrown.is
|
105
161
|
executables: []
|
106
162
|
extensions: []
|
107
163
|
extra_rdoc_files: []
|
108
164
|
files:
|
109
|
-
- ".github/workflows/ruby.yml"
|
110
|
-
- ".gitignore"
|
111
|
-
- ".rspec"
|
112
|
-
- FUNDING.json
|
113
|
-
- Gemfile
|
114
|
-
- LICENSE
|
115
|
-
- README.md
|
116
|
-
- Rakefile
|
117
|
-
- cached_resource.gemspec
|
118
|
-
- gemfiles/4.2.gemfile
|
119
|
-
- gemfiles/5.0.gemfile
|
120
|
-
- gemfiles/5.1.gemfile
|
121
|
-
- gemfiles/6.0.gemfile
|
122
|
-
- gemfiles/6.1.gemfile
|
123
|
-
- gemfiles/7.0.gemfile
|
124
|
-
- gemfiles/7.1.gemfile
|
125
165
|
- lib/cached_resource.rb
|
126
166
|
- lib/cached_resource/cached_resource.rb
|
127
167
|
- lib/cached_resource/caching.rb
|
128
168
|
- lib/cached_resource/configuration.rb
|
129
169
|
- lib/cached_resource/version.rb
|
130
|
-
- spec/cached_resource/cached_resource_spec.rb
|
131
|
-
- spec/cached_resource/caching_spec.rb
|
132
|
-
- spec/cached_resource/configuration_spec.rb
|
133
|
-
- spec/spec_helper.rb
|
134
170
|
homepage: https://github.com/mhgbrown/cached_resource
|
135
171
|
licenses:
|
136
172
|
- MIT
|
@@ -143,7 +179,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
179
|
requirements:
|
144
180
|
- - ">="
|
145
181
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
182
|
+
version: '3.0'
|
147
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
184
|
requirements:
|
149
185
|
- - ">="
|
@@ -154,8 +190,4 @@ rubygems_version: 3.1.6
|
|
154
190
|
signing_key:
|
155
191
|
specification_version: 4
|
156
192
|
summary: Caching for ActiveResource
|
157
|
-
test_files:
|
158
|
-
- spec/cached_resource/cached_resource_spec.rb
|
159
|
-
- spec/cached_resource/caching_spec.rb
|
160
|
-
- spec/cached_resource/configuration_spec.rb
|
161
|
-
- spec/spec_helper.rb
|
193
|
+
test_files: []
|
data/.github/workflows/ruby.yml
DELETED
@@ -1,103 +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: ['2.3', '2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3']
|
23
|
-
rails-version: ['4.2', '5.0', '5.1', '6.0', '6.1', '7.0', '7.1']
|
24
|
-
exclude:
|
25
|
-
# activesupport (~> 6.0.0) was resolved to 6.0.6.1, which depends on ruby (>= 2.5.0)
|
26
|
-
# activesupport (~> 6.1.0) was resolved to 6.1.7.2, which depends on ruby (>= 2.5.0)
|
27
|
-
- ruby-version: '2.3'
|
28
|
-
rails-version: '6.0'
|
29
|
-
- ruby-version: '2.3'
|
30
|
-
rails-version: '6.1'
|
31
|
-
- ruby-version: '2.4'
|
32
|
-
rails-version: '6.0'
|
33
|
-
- ruby-version: '2.4'
|
34
|
-
rails-version: '6.1'
|
35
|
-
# activesupport (~> 7.0.0) was resolved to 7.0.4.2, which depends on Ruby (>= 2.7.0)
|
36
|
-
- ruby-version: '2.3'
|
37
|
-
rails-version: '7.0'
|
38
|
-
- ruby-version: '2.4'
|
39
|
-
rails-version: '7.0'
|
40
|
-
- ruby-version: '2.5'
|
41
|
-
rails-version: '7.0'
|
42
|
-
- ruby-version: '2.6'
|
43
|
-
rails-version: '7.0'
|
44
|
-
# incompatbility with BigDecimal.new
|
45
|
-
- ruby-version: '2.7'
|
46
|
-
rails-version: '4.2'
|
47
|
-
- ruby-version: '3.0'
|
48
|
-
rails-version: '4.2'
|
49
|
-
- ruby-version: '3.1'
|
50
|
-
rails-version: '4.2'
|
51
|
-
- ruby-version: '3.2'
|
52
|
-
rails-version: '4.2'
|
53
|
-
# ArgumentError: expected attributes to be able to convert to Hash, got "#<Thing:0x000055d208b2e258>"
|
54
|
-
# probably keyword argument delegation different in Ruby 3
|
55
|
-
# https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
|
56
|
-
- ruby-version: '3.0'
|
57
|
-
rails-version: '5.0'
|
58
|
-
- ruby-version: '3.0'
|
59
|
-
rails-version: '5.1'
|
60
|
-
- ruby-version: '3.1'
|
61
|
-
rails-version: '5.0'
|
62
|
-
- ruby-version: '3.1'
|
63
|
-
rails-version: '5.1'
|
64
|
-
- ruby-version: '3.2'
|
65
|
-
rails-version: '5.0'
|
66
|
-
- ruby-version: '3.2'
|
67
|
-
rails-version: '5.1'
|
68
|
-
# rails (~> 7.1.0) was resolved to 7.1.3.2, which depends on Ruby (>= 2.7.0)
|
69
|
-
- ruby-version: '2.3'
|
70
|
-
rails-version: '7.1'
|
71
|
-
- ruby-version: '2.4'
|
72
|
-
rails-version: '7.1'
|
73
|
-
- ruby-version: '2.5'
|
74
|
-
rails-version: '7.1'
|
75
|
-
- ruby-version: '2.6'
|
76
|
-
rails-version: '7.1'
|
77
|
-
# Because rails >= 4.0.0.beta1, < 5.0.5.rc1 depends on bundler >= 1.3.0, < 2.0
|
78
|
-
# and the current Bundler version (2.5.9) does not satisfy bundler >= 1.3.0, < 2.0,
|
79
|
-
# rails >= 4.0.0.beta1, < 5.0.5.rc1 cannot be used.
|
80
|
-
# So, because Gemfile depends on rails ~> 4.2.0,
|
81
|
-
# version solving has failed.
|
82
|
-
- ruby-version: '3.3'
|
83
|
-
rails-version: '4.2'
|
84
|
-
|
85
|
-
steps:
|
86
|
-
- uses: actions/checkout@v4
|
87
|
-
- name: Set up Ruby ${{ matrix.ruby-version }}
|
88
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
89
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
90
|
-
# uses: ruby/setup-ruby@v1
|
91
|
-
uses: ruby/setup-ruby@v1
|
92
|
-
with:
|
93
|
-
ruby-version: ${{ matrix.ruby-version }}
|
94
|
-
- name: Install bundler 1.x.x
|
95
|
-
if: matrix.rails-version == '4.2'
|
96
|
-
run: gem uninstall -aIx bundler && gem install bundler -v 1.17.3
|
97
|
-
- name: Install dependencies
|
98
|
-
run: bundle install
|
99
|
-
env:
|
100
|
-
TEST_RAILS_VERSION: ${{ matrix.rails-version }}
|
101
|
-
DEBUG: true
|
102
|
-
- name: Run tests
|
103
|
-
run: bundle exec rake
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/FUNDING.json
DELETED
data/Gemfile
DELETED
@@ -1,31 +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
|
-
when "7.1"
|
28
|
-
eval_gemfile('../gemfiles/7.1.gemfile')
|
29
|
-
else
|
30
|
-
puts "\e[93mNo TEST_RAILS_VERSION present, letting dependency manager decide what's best.\e[0m" if ENV['DEBUG']
|
31
|
-
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.
|