asset_cloud 2.7.0 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8573a0d845bd6022d3540cbb6e28027637bea815896060a6637ed70402fb0614
4
- data.tar.gz: df5f502bd556e2414ee896327ba18c54ce679faa2a2ebcf5b50a630803454719
3
+ metadata.gz: 5b202062a28470fab35e4aadafe3600f7944d2cb075d0076274acfd72dd93a6e
4
+ data.tar.gz: ad42d5f81dbe67cfde24248c3f8f8b2cb5d9bd1694be44d98546f234c8ef703b
5
5
  SHA512:
6
- metadata.gz: 7302dd7d0e4e4ca392b344c530d3ebd3e610c25e5e6aa45658582944e2333ca66371e511e911f93e38f471815fb184a7d2c52d38dadfdda172a33ff7ff90e6ec
7
- data.tar.gz: 91a7fcfaf2dddbb1b855d6b25cadd563c414e09a625ceafdaaecf68faf07d4b89a6e80b89ab9cd2f264098f3ab9f1f387cf08f8ec8bcde19b67179045989bf40
6
+ metadata.gz: c22411e548811567b511d54b55b79591835721aefd3a34b89ab504871473a477eddbb0903e7c30292c2fefa0e7c51b54b0a94e8ae3081961b40bfb8a69287de4
7
+ data.tar.gz: 822630e44304e0e2507d01a9e162898bd0c053ade3eabe785c625e407216c7a54166087c270f5166c63261cc98757664c201a6472cb474034b5c7a3af389679f
@@ -0,0 +1,27 @@
1
+ name: CI
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ name: Ruby ${{ matrix.ruby }}
9
+ strategy:
10
+ matrix:
11
+ ruby: ["2.5", "2.6", "2.7"]
12
+ steps:
13
+
14
+ - name: Check out code
15
+ uses: actions/checkout@v3
16
+
17
+ - name: Set up Ruby ${{ matrix.ruby }}
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: ${{ matrix.ruby }}
21
+ bundler-cache: true
22
+
23
+ - name: RuboCop
24
+ run: bundle exec rubocop || true # until we fix offenses due to outdated config
25
+
26
+ - name: Tests
27
+ run: bundle exec rspec
data/History.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Asset Cloud Version History
2
2
 
3
+ ## Version 2.7.1, 2022-03-18
4
+
5
+ * Fix incorrect invocation of callbacks defined in external classes (https://github.com/Shopify/asset_cloud/issues/71)
6
+
3
7
  ## Version 2.7.0, 2020-07-15
4
8
 
5
9
  * Add `Asset#write!` which raises on validation failure (https://github.com/Shopify/asset_cloud/pull/67)
data/README.rdoc CHANGED
@@ -34,13 +34,12 @@ With GCS Remote test:
34
34
 
35
35
  Releasing is handled by Shopify's internal Shipit server.
36
36
 
37
- After merging a change, a separate PR should be opened to update `History.md` and bump the version
38
- (following [Semantic Versioning](https://semver.org/))
37
+ After merging a change, a separate PR should be opened to update +History.md+ and bump the version
38
+ (following {Semantic Versioning}[https://semver.org]).
39
39
 
40
40
  When merged, the new release will be automatically tagged and deployed to rubygems.org.
41
41
 
42
- Note that the automatic process does not create a new [release](https://github.com/Shopify/asset_cloud/releases) on
43
- GitHub.
42
+ Note that the automatic process does not create a new {release}[https://github.com/Shopify/asset_cloud/releases] on GitHub.
44
43
 
45
44
  == Copyright
46
45
 
data/asset_cloud.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{asset_cloud}
5
- s.version = "2.7.0"
5
+ s.version = "2.7.1"
6
6
 
7
7
  s.authors = %w(Shopify)
8
8
  s.summary = %q{An abstraction layer around arbitrary and diverse asset stores.}
@@ -59,15 +59,15 @@ module AssetCloud
59
59
 
60
60
  def execute_callbacks(symbol, args)
61
61
  callbacks_for(symbol).each do |callback|
62
-
62
+
63
63
  result = case callback
64
64
  when Symbol
65
65
  send(callback, *args)
66
66
  when Proc, Method
67
67
  callback.call(self, *args)
68
68
  else
69
- if callback.respond_to?(method)
70
- callback.send(method, self, *args)
69
+ if callback.respond_to?(symbol)
70
+ callback.send(symbol, self, *args)
71
71
  else
72
72
  raise StandardError, "Callbacks must be a symbol denoting the method to call, a string to be evaluated, a block to be invoked, or an object responding to the callback method."
73
73
  end
@@ -1,6 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
  require 'spec_helper'
3
3
 
4
+
5
+ class AfterStoreCallback
6
+ def self.after_store(*args); end
7
+ end
8
+
4
9
  class CallbackAsset < AssetCloud::Asset
5
10
  before_store :callback_before_store
6
11
  before_delete :callback_before_delete
@@ -9,6 +14,8 @@ class CallbackAsset < AssetCloud::Asset
9
14
  after_validate :add_spice
10
15
  validate :valid_value
11
16
 
17
+ after_store ::AfterStoreCallback
18
+
12
19
  private
13
20
 
14
21
  def callback_before_delete(*args); end
@@ -143,4 +150,15 @@ describe CallbackAsset do
143
150
 
144
151
  expect(@asset.delete).to(eq(nil))
145
152
  end
153
+
154
+ it "should invoke after_store callback defined in separate class" do
155
+ local_fs = BasicCloud.new(File.dirname(__FILE__) + '/files', 'http://assets/')
156
+ local_fs.write('callback_assets/foo', 'bar')
157
+ local_asset = local_fs.asset_at('callback_assets/foo')
158
+
159
+ expect(local_asset).to(receive(:callback_before_store).and_return(true))
160
+ expect(::AfterStoreCallback).to(receive(:after_store))
161
+
162
+ expect(local_asset.store).to(eq(true))
163
+ end
146
164
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-16 00:00:00.000000000 Z
11
+ date: 2022-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -101,10 +101,10 @@ extensions: []
101
101
  extra_rdoc_files: []
102
102
  files:
103
103
  - ".github/probots.yml"
104
+ - ".github/workflows/ci.yml"
104
105
  - ".gitignore"
105
106
  - ".rubocop.yml"
106
107
  - ".rubocop_todo.yml"
107
- - ".travis.yml"
108
108
  - Gemfile
109
109
  - History.md
110
110
  - LICENSE
@@ -172,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  requirements: []
175
- rubygems_version: 3.0.3
175
+ rubygems_version: 3.2.20
176
176
  signing_key:
177
177
  specification_version: 4
178
178
  summary: An abstraction layer around arbitrary and diverse asset stores.
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- language: ruby
2
- before_install:
3
- - gem install bundler
4
- rvm:
5
- - '2.5'
6
- - '2.6'
7
- - '2.7'
8
-
9
- matrix:
10
- exclude:
11
- rvm: '2.7'
12
- gemfile: gemfiles/Gemfile.activerecord52