asset_cloud 2.6.1 → 2.7.0

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: d5f21ffc94cb1b9d60698ca150060999dfc3c2e01f347698bb8f0c8e108bf460
4
- data.tar.gz: a7d8bddbdbc14473c7eb7d0f8c4d50a4e8db12e72dbb320df3f97025ad08cd90
3
+ metadata.gz: 8573a0d845bd6022d3540cbb6e28027637bea815896060a6637ed70402fb0614
4
+ data.tar.gz: df5f502bd556e2414ee896327ba18c54ce679faa2a2ebcf5b50a630803454719
5
5
  SHA512:
6
- metadata.gz: '08454bc3fc53e14b98b69d1a6feee2d57505d26cc61f7b43e52174300704e441faaea4a2710da524ab7136197d5c396de6f53110d66edb4b0a1d89d7cb1339cb'
7
- data.tar.gz: 9802fca3c1bcc63a72b3effeca88044df1d1022854a5be72f9da865fb1acea768c57160896ea9930c0eece74c8301120c19fc09c2f1df8867ab530bca5b91a33
6
+ metadata.gz: 7302dd7d0e4e4ca392b344c530d3ebd3e610c25e5e6aa45658582944e2333ca66371e511e911f93e38f471815fb184a7d2c52d38dadfdda172a33ff7ff90e6ec
7
+ data.tar.gz: 91a7fcfaf2dddbb1b855d6b25cadd563c414e09a625ceafdaaecf68faf07d4b89a6e80b89ab9cd2f264098f3ab9f1f387cf08f8ec8bcde19b67179045989bf40
data/History.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Asset Cloud Version History
2
2
 
3
+ ## Version 2.7.0, 2020-07-15
4
+
5
+ * Add `Asset#write!` which raises on validation failure (https://github.com/Shopify/asset_cloud/pull/67)
6
+
3
7
  ## Version 2.6.0, 2020-05-22
4
8
 
5
9
  * Add checksum to metadata (https://github.com/Shopify/asset_cloud/pull/57)
@@ -9,7 +9,7 @@ An abstraction layer around arbitrary and diverse asset stores.
9
9
  +value_hash+ is intended as a *private* hash/checksum, not exposed to end users. Its underlying algorithm is private, and
10
10
  could change over time so should not be relied on by clients.
11
11
 
12
- +checksum+ is intended as a *public* hash/checksum, exposed to end users. Its underlying algorithms is documented (e.g. MD5)
12
+ +checksum+ is intended as a *public* hash/checksum, exposed to end users. Its underlying algorithm is documented (e.g. MD5)
13
13
  and is not expected to change.
14
14
 
15
15
  == Installation
@@ -30,6 +30,18 @@ With GCS Remote test:
30
30
 
31
31
  GCS_PROJECT_ID="<project_id>" GCS_KEY_FILEPATH="<path_to_key>" GCS_BUCKET="<bucket_name>" bundle exec rake spec
32
32
 
33
+ == Releasing
34
+
35
+ Releasing is handled by Shopify's internal Shipit server.
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/))
39
+
40
+ When merged, the new release will be automatically tagged and deployed to rubygems.org.
41
+
42
+ Note that the automatic process does not create a new [release](https://github.com/Shopify/asset_cloud/releases) on
43
+ GitHub.
44
+
33
45
  == Copyright
34
46
 
35
47
  Copyright (c) 2008-2014 Tobias Lütke & Shopify, Inc. Released under the MIT license (see LICENSE for details).
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{asset_cloud}
5
- s.version = "2.6.1"
5
+ s.version = "2.7.0"
6
6
 
7
7
  s.authors = %w(Shopify)
8
8
  s.summary = %q{An abstraction layer around arbitrary and diverse asset stores.}
@@ -151,6 +151,12 @@ module AssetCloud
151
151
  bucket_for(key).write(key, value)
152
152
  end
153
153
 
154
+ def write!(key, value)
155
+ asset = self[key]
156
+ asset.value = value
157
+ asset.store!
158
+ end
159
+
154
160
  def read(key)
155
161
  logger.info { " [#{self.class.name}] Reading from #{key}" } if logger
156
162
 
@@ -7,11 +7,18 @@ end
7
7
  class LiquidAsset < AssetCloud::Asset
8
8
  end
9
9
 
10
+ class BrokenBucket < AssetCloud::Bucket
11
+ def write(*)
12
+ false
13
+ end
14
+ end
15
+
10
16
  class BasicCloud < AssetCloud::Base
11
17
  bucket :special, AssetCloud::MemoryBucket, asset_class: SpecialAsset
12
18
  bucket :conditional, AssetCloud::MemoryBucket, asset_class: proc { |key|
13
19
  LiquidAsset if key.ends_with?('.liquid')
14
20
  }
21
+ bucket :broken, BrokenBucket, asset_class: AssetCloud::Asset
15
22
  end
16
23
 
17
24
  describe BasicCloud do
@@ -192,6 +199,20 @@ describe BasicCloud do
192
199
  end
193
200
  end
194
201
 
202
+ describe "write!" do
203
+ it "should write through the Asset object (and thus run any callbacks on the asset)" do
204
+ special_asset = double(:special_asset)
205
+ expect(special_asset).to(receive(:value=).with('fancy fancy!'))
206
+ expect(special_asset).to(receive(:store!))
207
+ expect(SpecialAsset).to(receive(:at).and_return(special_asset))
208
+ @fs.write!('special/fancy.txt', 'fancy fancy!')
209
+ end
210
+
211
+ it "should raise AssetNotSaved when write fails" do
212
+ expect { @fs.write!('broken/file.txt', 'n/a') }.to(raise_error(AssetCloud::AssetNotSaved))
213
+ end
214
+ end
215
+
195
216
  describe "MATCH_BUCKET" do
196
217
  it "should match following stuff " do
197
218
  'products/key.txt' =~ AssetCloud::Base::MATCH_BUCKET
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.6.1
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-26 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport