asset_cloud 2.2.7 → 2.2.8

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: d356abcae5568be4981cdcbb779ba94471a67f942f048ee96119e9b9260cf366
4
- data.tar.gz: 3923b527fe0e5c7e670641f53c6397723465a02877431b50e8e7da20bc67ee74
3
+ metadata.gz: f1331f148d5e428464e3d7f539963c1c2651f528656a3c8ef0266d6aa299379c
4
+ data.tar.gz: 7f62fa26ae75e6e630aee982c08067cfbf38e1e6e3e49cd9afc99a33505825c3
5
5
  SHA512:
6
- metadata.gz: e8f3a5c2252c2cd574fc55e4feb4aa205a3340e8a43cb945414740be9f6313d422ecc241a8cb8279e48f7b32b6695817576f95779107dd072543c0024d69b33f
7
- data.tar.gz: 480ada19cbcddae3f9acc2fc46d1022d82b3ba7582534b91aa9f0fe6dc0bbae9efa70f09f5fafd64b95be3e39601ec2b88d2d3bb34b10fe0fe8b7c540f5d0603
6
+ metadata.gz: 03aca7a78234bbb51998cad8a0740e7f7ae2d0a14a2b3dc32ed9317bea003cf1e684845c56ae1554e90e2cf7d4f6ba64dbabdf63b1b90f2e85f7a8186b27c7d1
7
+ data.tar.gz: 7284d30086ea786bdc0b1a18fe6a8a27ea829bedacded167244d21a7334926aa8d444202ad594c98f0c8ed2cb7c998b7c9725fcf4ab4519008970865146908e0
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{asset_cloud}
5
- s.version = "2.2.7"
5
+ s.version = "2.2.8"
6
6
 
7
7
  s.authors = %w(Shopify)
8
8
  s.summary = %q{An abstraction layer around arbitrary and diverse asset stores.}
@@ -13,8 +13,12 @@ module AssetCloud
13
13
  downloaded.read
14
14
  end
15
15
 
16
- def write(key, data)
17
- bucket.create_file(data, absolute_key(key))
16
+ def write(key, data, options = {})
17
+ bucket.create_file(
18
+ data,
19
+ absolute_key(key),
20
+ options
21
+ )
18
22
  end
19
23
 
20
24
  def delete(key)
@@ -54,6 +54,35 @@ describe AssetCloud::GCSBucket, if: ENV['GCS_PROJECT_ID'] && ENV['GCS_KEY_FILEPA
54
54
  @bucket.write(key, local_path)
55
55
  end
56
56
 
57
+ it "#write writes a file into the bucket with metadata" do
58
+ local_path = "#{directory}/products/key.txt"
59
+ key = 'test/key.txt'
60
+ metadata = {
61
+ "X-Robots-Tag" => "none"
62
+ }
63
+
64
+ file = @bucket.write(key, local_path, metadata: metadata)
65
+ expect(file.metadata).to eq(metadata)
66
+ end
67
+
68
+ it "#write writes a file into the bucket with acl" do
69
+ local_path = "#{directory}/products/key.txt"
70
+ key = 'test/key.txt'
71
+ acl = 'public'
72
+
73
+ file = @bucket.write(key, local_path, acl: acl)
74
+ expect(file.acl).to be_truthy
75
+ end
76
+
77
+ it "#write writes a file into the bucket with content_disposition" do
78
+ local_path = "#{directory}/products/key.txt"
79
+ key = 'test/key.txt'
80
+ content_disposition = 'attachment'
81
+
82
+ file = @bucket.write(key, local_path, content_disposition: content_disposition)
83
+ expect(file.content_disposition).to eq(content_disposition)
84
+ end
85
+
57
86
  it "#delete removes the file from the bucket" do
58
87
  key = 'test/key.txt'
59
88
 
@@ -11,7 +11,7 @@ class MockGCSBucket < AssetCloud::GCSBucket
11
11
  def file(key)
12
12
  end
13
13
 
14
- def create_file(data, key)
14
+ def create_file(data, key, options = {})
15
15
  end
16
16
  end
17
17
 
@@ -40,11 +40,56 @@ describe AssetCloud::GCSBucket do
40
40
  it "#write writes a file into the bucket" do
41
41
  local_path = "#{directory}/products/key.txt"
42
42
  key = 'test/key.txt'
43
- expect_any_instance_of(MockGCSBucket).to receive(:create_file).with(local_path, "s#{@cloud.url}/#{key}")
43
+ expect_any_instance_of(MockGCSBucket).to receive(:create_file).with(
44
+ local_path,
45
+ "s#{@cloud.url}/#{key}",
46
+ {}
47
+ )
44
48
 
45
49
  @bucket.write(key, local_path)
46
50
  end
47
51
 
52
+ it "#write writes a file into the bucket with metadata" do
53
+ local_path = "#{directory}/products/key.txt"
54
+ key = 'test/key.txt'
55
+ metadata = {
56
+ "X-Robots-Tag" => "none"
57
+ }
58
+ expect_any_instance_of(MockGCSBucket).to receive(:create_file).with(
59
+ local_path,
60
+ "s#{@cloud.url}/#{key}",
61
+ metadata: metadata
62
+ )
63
+
64
+ @bucket.write(key, local_path, metadata: metadata)
65
+ end
66
+
67
+ it "#write writes a file into the bucket with acl" do
68
+ local_path = "#{directory}/products/key.txt"
69
+ key = 'test/key.txt'
70
+ acl = 'public'
71
+ expect_any_instance_of(MockGCSBucket).to receive(:create_file).with(
72
+ local_path,
73
+ "s#{@cloud.url}/#{key}",
74
+ acl: acl
75
+ )
76
+
77
+ @bucket.write(key, local_path, acl: acl)
78
+ end
79
+
80
+ it "#write writes a file into the bucket with content_disposition" do
81
+ local_path = "#{directory}/products/key.txt"
82
+ key = 'test/key.txt'
83
+ content_disposition = 'attachment'
84
+ expect_any_instance_of(MockGCSBucket).to receive(:create_file).with(
85
+ local_path,
86
+ "s#{@cloud.url}/#{key}",
87
+ content_disposition: content_disposition
88
+ )
89
+
90
+ @bucket.write(key, local_path, content_disposition: content_disposition)
91
+ end
92
+
48
93
  it "#delete removes the file from the bucket" do
49
94
  key = 'test/key.txt'
50
95
  expect_any_instance_of(MockGCSBucket).to receive(:file).with("s#{@cloud.url}/#{key}").and_return(Google::Cloud::Storage::File.new)
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.2.7
4
+ version: 2.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-01 00:00:00.000000000 Z
11
+ date: 2019-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport