asset_cloud 2.7.2 → 2.7.3
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/.github/dependabot.yml +6 -0
- data/.github/workflows/ci.yml +5 -6
- data/.gitignore +0 -1
- data/.rubocop.yml +0 -3
- data/.ruby-version +1 -0
- data/Gemfile.lock +180 -0
- data/History.md +5 -0
- data/README.rdoc +1 -3
- data/asset_cloud.gemspec +2 -2
- data/dev.yml +1 -2
- data/lib/asset_cloud/callbacks.rb +21 -17
- data/lib/asset_cloud.rb +1 -1
- data/spec/callbacks_spec.rb +24 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bed261dca11417616d233595b006d2bd53e3f19c542320d387d0edc2dc76182f
|
4
|
+
data.tar.gz: 8c19949270fd24f85ac239c15e063be7369679bb235adcd26f96d2f13590aec9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eadac3515bc1efafa9e563a0596a74f84a2faa26234cc451ddd412935de975f5047b412149b0daeb9c93f0a733590fd244df983432fd68591aef7fb75d7bb34
|
7
|
+
data.tar.gz: f1ad4789ac383943515c389f1ec20b778c1bfcec7efe1cdab6970204646bace030bee8e22fef8c99bffe117b9559829db6bb56e4206d22933c05875b368f278d
|
data/.github/workflows/ci.yml
CHANGED
@@ -9,14 +9,14 @@ jobs:
|
|
9
9
|
strategy:
|
10
10
|
fail-fast: false
|
11
11
|
matrix:
|
12
|
-
ruby: ["
|
12
|
+
ruby: ["3.0", "3.1", "3.2", "3.3"]
|
13
13
|
steps:
|
14
14
|
|
15
15
|
- name: Check out code
|
16
|
-
uses: actions/checkout@
|
16
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
17
17
|
|
18
18
|
- name: Set up Ruby ${{ matrix.ruby }}
|
19
|
-
uses: ruby/setup-ruby@v1
|
19
|
+
uses: ruby/setup-ruby@e34163cd15f4bb403dcd72d98e295997e6a55798 # v1.238.0
|
20
20
|
with:
|
21
21
|
ruby-version: ${{ matrix.ruby }}
|
22
22
|
bundler-cache: true
|
@@ -30,12 +30,11 @@ jobs:
|
|
30
30
|
steps:
|
31
31
|
|
32
32
|
- name: Check out code
|
33
|
-
uses: actions/checkout@
|
33
|
+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
34
34
|
|
35
35
|
- name: Set up Ruby
|
36
|
-
uses: ruby/setup-ruby@v1
|
36
|
+
uses: ruby/setup-ruby@e34163cd15f4bb403dcd72d98e295997e6a55798 # v1.238.0
|
37
37
|
with:
|
38
|
-
ruby-version: '3.2'
|
39
38
|
bundler-cache: true
|
40
39
|
|
41
40
|
- name: RuboCop
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.2.2
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
asset_cloud (2.7.3)
|
5
|
+
activesupport
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (7.1.3.2)
|
11
|
+
base64
|
12
|
+
bigdecimal
|
13
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
+
connection_pool (>= 2.2.5)
|
15
|
+
drb
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
mutex_m
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
addressable (2.8.6)
|
21
|
+
public_suffix (>= 2.0.2, < 6.0)
|
22
|
+
ast (2.4.2)
|
23
|
+
aws-eventstream (1.3.0)
|
24
|
+
aws-partitions (1.922.0)
|
25
|
+
aws-sdk-core (3.193.0)
|
26
|
+
aws-eventstream (~> 1, >= 1.3.0)
|
27
|
+
aws-partitions (~> 1, >= 1.651.0)
|
28
|
+
aws-sigv4 (~> 1.8)
|
29
|
+
jmespath (~> 1, >= 1.6.1)
|
30
|
+
aws-sdk-kms (1.80.0)
|
31
|
+
aws-sdk-core (~> 3, >= 3.193.0)
|
32
|
+
aws-sigv4 (~> 1.1)
|
33
|
+
aws-sdk-s3 (1.148.0)
|
34
|
+
aws-sdk-core (~> 3, >= 3.193.0)
|
35
|
+
aws-sdk-kms (~> 1)
|
36
|
+
aws-sigv4 (~> 1.8)
|
37
|
+
aws-sigv4 (1.8.0)
|
38
|
+
aws-eventstream (~> 1, >= 1.0.2)
|
39
|
+
base64 (0.2.0)
|
40
|
+
bigdecimal (3.1.7)
|
41
|
+
byebug (11.1.3)
|
42
|
+
coderay (1.1.3)
|
43
|
+
concurrent-ruby (1.2.3)
|
44
|
+
connection_pool (2.4.1)
|
45
|
+
declarative (0.0.20)
|
46
|
+
diff-lcs (1.5.1)
|
47
|
+
digest-crc (0.6.5)
|
48
|
+
rake (>= 12.0.0, < 14.0.0)
|
49
|
+
drb (2.2.1)
|
50
|
+
faraday (2.9.0)
|
51
|
+
faraday-net_http (>= 2.0, < 3.2)
|
52
|
+
faraday-net_http (3.1.0)
|
53
|
+
net-http
|
54
|
+
google-apis-core (0.14.1)
|
55
|
+
addressable (~> 2.5, >= 2.5.1)
|
56
|
+
googleauth (~> 1.9)
|
57
|
+
httpclient (>= 2.8.1, < 3.a)
|
58
|
+
mini_mime (~> 1.0)
|
59
|
+
representable (~> 3.0)
|
60
|
+
retriable (>= 2.0, < 4.a)
|
61
|
+
rexml
|
62
|
+
google-apis-iamcredentials_v1 (0.20.0)
|
63
|
+
google-apis-core (>= 0.14.0, < 2.a)
|
64
|
+
google-apis-storage_v1 (0.37.0)
|
65
|
+
google-apis-core (>= 0.14.0, < 2.a)
|
66
|
+
google-cloud-core (1.7.0)
|
67
|
+
google-cloud-env (>= 1.0, < 3.a)
|
68
|
+
google-cloud-errors (~> 1.0)
|
69
|
+
google-cloud-env (2.1.1)
|
70
|
+
faraday (>= 1.0, < 3.a)
|
71
|
+
google-cloud-errors (1.4.0)
|
72
|
+
google-cloud-storage (1.51.0)
|
73
|
+
addressable (~> 2.8)
|
74
|
+
digest-crc (~> 0.4)
|
75
|
+
google-apis-core (~> 0.13)
|
76
|
+
google-apis-iamcredentials_v1 (~> 0.18)
|
77
|
+
google-apis-storage_v1 (~> 0.37)
|
78
|
+
google-cloud-core (~> 1.6)
|
79
|
+
googleauth (~> 1.9)
|
80
|
+
mini_mime (~> 1.0)
|
81
|
+
googleauth (1.11.0)
|
82
|
+
faraday (>= 1.0, < 3.a)
|
83
|
+
google-cloud-env (~> 2.1)
|
84
|
+
jwt (>= 1.4, < 3.0)
|
85
|
+
multi_json (~> 1.11)
|
86
|
+
os (>= 0.9, < 2.0)
|
87
|
+
signet (>= 0.16, < 2.a)
|
88
|
+
httpclient (2.8.3)
|
89
|
+
i18n (1.14.4)
|
90
|
+
concurrent-ruby (~> 1.0)
|
91
|
+
jmespath (1.6.2)
|
92
|
+
json (2.7.2)
|
93
|
+
jwt (2.8.1)
|
94
|
+
base64
|
95
|
+
language_server-protocol (3.17.0.3)
|
96
|
+
method_source (1.1.0)
|
97
|
+
mini_mime (1.1.5)
|
98
|
+
minitest (5.22.3)
|
99
|
+
multi_json (1.15.0)
|
100
|
+
mutex_m (0.2.0)
|
101
|
+
net-http (0.4.1)
|
102
|
+
uri
|
103
|
+
os (1.1.4)
|
104
|
+
parallel (1.24.0)
|
105
|
+
parser (3.3.1.0)
|
106
|
+
ast (~> 2.4.1)
|
107
|
+
racc
|
108
|
+
pry (0.14.2)
|
109
|
+
coderay (~> 1.1)
|
110
|
+
method_source (~> 1.0)
|
111
|
+
pry-byebug (3.10.1)
|
112
|
+
byebug (~> 11.0)
|
113
|
+
pry (>= 0.13, < 0.15)
|
114
|
+
public_suffix (5.0.5)
|
115
|
+
racc (1.7.3)
|
116
|
+
rainbow (3.1.1)
|
117
|
+
rake (13.2.1)
|
118
|
+
regexp_parser (2.9.0)
|
119
|
+
representable (3.2.0)
|
120
|
+
declarative (< 0.1.0)
|
121
|
+
trailblazer-option (>= 0.1.1, < 0.2.0)
|
122
|
+
uber (< 0.2.0)
|
123
|
+
retriable (3.1.2)
|
124
|
+
rexml (3.3.9)
|
125
|
+
rspec (3.13.0)
|
126
|
+
rspec-core (~> 3.13.0)
|
127
|
+
rspec-expectations (~> 3.13.0)
|
128
|
+
rspec-mocks (~> 3.13.0)
|
129
|
+
rspec-core (3.13.0)
|
130
|
+
rspec-support (~> 3.13.0)
|
131
|
+
rspec-expectations (3.13.0)
|
132
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
133
|
+
rspec-support (~> 3.13.0)
|
134
|
+
rspec-mocks (3.13.0)
|
135
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
136
|
+
rspec-support (~> 3.13.0)
|
137
|
+
rspec-support (3.13.1)
|
138
|
+
rubocop (1.63.4)
|
139
|
+
json (~> 2.3)
|
140
|
+
language_server-protocol (>= 3.17.0)
|
141
|
+
parallel (~> 1.10)
|
142
|
+
parser (>= 3.3.0.2)
|
143
|
+
rainbow (>= 2.2.2, < 4.0)
|
144
|
+
regexp_parser (>= 1.8, < 3.0)
|
145
|
+
rexml (>= 3.2.5, < 4.0)
|
146
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
147
|
+
ruby-progressbar (~> 1.7)
|
148
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
149
|
+
rubocop-ast (1.31.3)
|
150
|
+
parser (>= 3.3.1.0)
|
151
|
+
rubocop-shopify (2.15.1)
|
152
|
+
rubocop (~> 1.51)
|
153
|
+
ruby-progressbar (1.13.0)
|
154
|
+
signet (0.19.0)
|
155
|
+
addressable (~> 2.8)
|
156
|
+
faraday (>= 0.17.5, < 3.a)
|
157
|
+
jwt (>= 1.5, < 3.0)
|
158
|
+
multi_json (~> 1.10)
|
159
|
+
trailblazer-option (0.1.2)
|
160
|
+
tzinfo (2.0.6)
|
161
|
+
concurrent-ruby (~> 1.0)
|
162
|
+
uber (0.1.0)
|
163
|
+
unicode-display_width (2.5.0)
|
164
|
+
uri (0.13.2)
|
165
|
+
|
166
|
+
PLATFORMS
|
167
|
+
ruby
|
168
|
+
|
169
|
+
DEPENDENCIES
|
170
|
+
asset_cloud!
|
171
|
+
aws-sdk-s3 (>= 1.60.2)
|
172
|
+
google-cloud-storage
|
173
|
+
pry
|
174
|
+
pry-byebug
|
175
|
+
rake
|
176
|
+
rspec
|
177
|
+
rubocop-shopify
|
178
|
+
|
179
|
+
BUNDLED WITH
|
180
|
+
2.5.9
|
data/History.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Asset Cloud Version History
|
2
2
|
|
3
|
+
## Version 2.7.3, 2025-07-31
|
4
|
+
|
5
|
+
* Refactor AssetCloud::Callbacks.execute_callbacks to allow for subclassing
|
6
|
+
* Fix usage of Procs with callback methods
|
7
|
+
|
3
8
|
## Version 2.7.2, 2023-04-20
|
4
9
|
|
5
10
|
* Swap the order of operations for checking UUID and asset exist logic in free key locator (https://github.com/Shopify/asset_cloud/pull/83)
|
data/README.rdoc
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
{<img src="https://travis-ci.org/Shopify/asset_cloud.png?branch=master" alt="Build Status" />}[https://travis-ci.org/Shopify/asset_cloud]
|
2
|
-
|
3
1
|
= AssetCloud
|
4
2
|
|
5
3
|
An abstraction layer around arbitrary and diverse asset stores.
|
@@ -43,4 +41,4 @@ Note that the automatic process does not create a new {release}[https://github.c
|
|
43
41
|
|
44
42
|
== Copyright
|
45
43
|
|
46
|
-
Copyright (c) 2008-
|
44
|
+
Copyright (c) 2008-2025 Tobias Lütke & Shopify, Inc. Released under the MIT license (see LICENSE for details).
|
data/asset_cloud.gemspec
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
require "English"
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "asset_cloud"
|
7
|
-
s.version = "2.7.
|
7
|
+
s.version = "2.7.3"
|
8
8
|
|
9
9
|
s.authors = ["Shopify"]
|
10
10
|
s.summary = "An abstraction layer around arbitrary and diverse asset stores."
|
11
11
|
s.description = "An abstraction layer around arbitrary and diverse asset stores."
|
12
12
|
|
13
|
-
s.required_ruby_version = ">=
|
13
|
+
s.required_ruby_version = ">= 3.0.0"
|
14
14
|
|
15
15
|
s.email = "developers@shopify.com"
|
16
16
|
s.homepage = "http://github.com/Shopify/asset_cloud"
|
data/dev.yml
CHANGED
@@ -35,13 +35,13 @@ module AssetCloud
|
|
35
35
|
end
|
36
36
|
|
37
37
|
define_singleton_method(before) do |*callbacks, &block|
|
38
|
-
callbacks << block
|
38
|
+
callbacks << block unless block.nil?
|
39
39
|
callbacks = (_callbacks[before] || []) + callbacks
|
40
40
|
self._callbacks = _callbacks.merge(before => callbacks).freeze
|
41
41
|
end
|
42
42
|
|
43
43
|
define_singleton_method(after) do |*callbacks, &block|
|
44
|
-
callbacks << block
|
44
|
+
callbacks << block unless block.nil?
|
45
45
|
callbacks = (_callbacks[after] || []) + callbacks
|
46
46
|
self._callbacks = _callbacks.merge(after => callbacks).freeze
|
47
47
|
end
|
@@ -61,26 +61,30 @@ module AssetCloud
|
|
61
61
|
|
62
62
|
def execute_callbacks(symbol, args)
|
63
63
|
callbacks_for(symbol).each do |callback|
|
64
|
-
result =
|
65
|
-
when Symbol
|
66
|
-
send(callback, *args)
|
67
|
-
when Proc, Method
|
68
|
-
callback.call(self, *args)
|
69
|
-
else
|
70
|
-
if callback.respond_to?(symbol)
|
71
|
-
callback.send(symbol, self, *args)
|
72
|
-
else
|
73
|
-
raise StandardError,
|
74
|
-
"Callbacks must be a symbol denoting the method to call, " \
|
75
|
-
"a string to be evaluated, a block to be invoked, " \
|
76
|
-
"or an object responding to the callback method."
|
77
|
-
end
|
78
|
-
end
|
64
|
+
result = execute_callback(symbol, callback, args)
|
79
65
|
return false if result == false
|
80
66
|
end
|
81
67
|
true
|
82
68
|
end
|
83
69
|
|
70
|
+
def execute_callback(symbol, callback, args)
|
71
|
+
case callback
|
72
|
+
when Symbol
|
73
|
+
send(callback, *args)
|
74
|
+
when Proc, Method
|
75
|
+
callback.call(self, *args)
|
76
|
+
else
|
77
|
+
if callback.respond_to?(symbol)
|
78
|
+
callback.send(symbol, self, *args)
|
79
|
+
else
|
80
|
+
raise StandardError,
|
81
|
+
"Callbacks must be a symbol denoting the method to call, " \
|
82
|
+
"a string to be evaluated, a block to be invoked, " \
|
83
|
+
"or an object responding to the callback method."
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
84
88
|
def callbacks_for(symbol)
|
85
89
|
self.class._callbacks[symbol] || []
|
86
90
|
end
|
data/lib/asset_cloud.rb
CHANGED
@@ -32,7 +32,7 @@ require "asset_cloud/asset_extension"
|
|
32
32
|
AssetCloud::Base.class_eval do
|
33
33
|
include AssetCloud::FreeKeyLocator
|
34
34
|
include AssetCloud::Callbacks
|
35
|
-
callback_methods :
|
35
|
+
callback_methods :write, :delete
|
36
36
|
end
|
37
37
|
|
38
38
|
AssetCloud::Asset.class_eval do
|
data/spec/callbacks_spec.rb
CHANGED
@@ -16,8 +16,14 @@ class CallbackAsset < AssetCloud::Asset
|
|
16
16
|
after_validate :add_spice
|
17
17
|
validate :valid_value
|
18
18
|
|
19
|
+
before_validate(&:proc_executed_before)
|
20
|
+
after_validate(&:proc_executed_after)
|
21
|
+
|
19
22
|
after_store ::AfterStoreCallback
|
20
23
|
|
24
|
+
def proc_executed_before(*args); end
|
25
|
+
def proc_executed_after(*args); end
|
26
|
+
|
21
27
|
private
|
22
28
|
|
23
29
|
def callback_before_delete(*args); end
|
@@ -139,6 +145,24 @@ describe CallbackAsset do
|
|
139
145
|
expect(@asset.value).to(eq("valid spice"))
|
140
146
|
end
|
141
147
|
|
148
|
+
it "should run before_validate with procs" do
|
149
|
+
expect(@asset).to(receive(:callback_before_store).and_return(true))
|
150
|
+
expect(@asset).to(receive(:proc_executed_before))
|
151
|
+
|
152
|
+
@asset.value = "foo"
|
153
|
+
|
154
|
+
expect(@asset.store).to(eq(true))
|
155
|
+
end
|
156
|
+
|
157
|
+
it "should run after_validate with procs" do
|
158
|
+
expect(@asset).to(receive(:callback_before_store).and_return(true))
|
159
|
+
expect(@asset).to(receive(:proc_executed_after))
|
160
|
+
|
161
|
+
@asset.value = "foo"
|
162
|
+
|
163
|
+
expect(@asset.store).to(eq(true))
|
164
|
+
end
|
165
|
+
|
142
166
|
it "should run its after_delete callback after delete is called" do
|
143
167
|
expect(@asset).not_to(receive(:callback_before_store))
|
144
168
|
expect(@asset).to(receive(:callback_after_delete).and_return(true))
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activesupport
|
@@ -100,11 +99,14 @@ executables: []
|
|
100
99
|
extensions: []
|
101
100
|
extra_rdoc_files: []
|
102
101
|
files:
|
102
|
+
- ".github/dependabot.yml"
|
103
103
|
- ".github/workflows/ci.yml"
|
104
104
|
- ".github/workflows/cla.yml"
|
105
105
|
- ".gitignore"
|
106
106
|
- ".rubocop.yml"
|
107
|
+
- ".ruby-version"
|
107
108
|
- Gemfile
|
109
|
+
- Gemfile.lock
|
108
110
|
- History.md
|
109
111
|
- LICENSE
|
110
112
|
- README.rdoc
|
@@ -156,7 +158,6 @@ homepage: http://github.com/Shopify/asset_cloud
|
|
156
158
|
licenses: []
|
157
159
|
metadata:
|
158
160
|
allowed_push_host: https://rubygems.org
|
159
|
-
post_install_message:
|
160
161
|
rdoc_options: []
|
161
162
|
require_paths:
|
162
163
|
- lib
|
@@ -164,15 +165,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
165
|
requirements:
|
165
166
|
- - ">="
|
166
167
|
- !ruby/object:Gem::Version
|
167
|
-
version:
|
168
|
+
version: 3.0.0
|
168
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
170
|
requirements:
|
170
171
|
- - ">="
|
171
172
|
- !ruby/object:Gem::Version
|
172
173
|
version: '0'
|
173
174
|
requirements: []
|
174
|
-
rubygems_version: 3.
|
175
|
-
signing_key:
|
175
|
+
rubygems_version: 3.6.9
|
176
176
|
specification_version: 4
|
177
177
|
summary: An abstraction layer around arbitrary and diverse asset stores.
|
178
178
|
test_files: []
|