shrine-google_cloud_storage 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/shrine/storage/google_cloud_storage.rb +13 -6
- data/shrine-google_cloud_storage.gemspec +2 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 021de2771b75b7e440d36788d7d3c45cec306d026c6aa08ed9e8218e69e61c86
|
4
|
+
data.tar.gz: cdbf68b610dca3468ba12095b2cff8fd38460593df573d6e8025c571659d9643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b088638b0c81d49587b2e9919267167c46de45638a661acee1558f7a017365ca25efc39c163a2e3a61ef0a4d494b527b4c1474d6e1b50c39349b017abbb6a6b9
|
7
|
+
data.tar.gz: bd972313c44c20899c4b1dd0b1909051d0b75cfadef0aadc0957c1f54f3741107a8ee3e3425673ae88e55626a4724f64660cbafac876f15cf82e1e4188f0d807
|
@@ -10,15 +10,22 @@ class Shrine
|
|
10
10
|
# Initialize a Shrine::Storage for GCS allowing for auto-discovery of the Google::Cloud::Storage client.
|
11
11
|
# @param [String] project Provide if not using auto discovery
|
12
12
|
# @see http://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-storage/v1.6.0/guides/authentication#environmentvariables for information on discovery
|
13
|
-
def initialize(project: nil, bucket:, prefix: nil, host: nil, default_acl: nil, object_options: {}, credentials: nil)
|
13
|
+
def initialize(project: nil, bucket:, prefix: nil, host: nil, default_acl: nil, object_options: {}, credentials: nil, public: false)
|
14
14
|
@project = project
|
15
15
|
@bucket = bucket
|
16
16
|
@prefix = prefix
|
17
17
|
@host = host
|
18
|
-
@default_acl = default_acl
|
19
18
|
@object_options = object_options
|
20
19
|
@storage = nil
|
21
20
|
@credentials = credentials
|
21
|
+
|
22
|
+
@default_acl = if public && default_acl && default_acl != "publicRead"
|
23
|
+
raise Shrine::Error, "You can not set both public and default_acl"
|
24
|
+
elsif public
|
25
|
+
"publicRead"
|
26
|
+
else
|
27
|
+
default_acl
|
28
|
+
end
|
22
29
|
end
|
23
30
|
|
24
31
|
# If the file is an UploadFile from GCS, issues a copy command, otherwise it uploads a file.
|
@@ -61,13 +68,13 @@ class Shrine
|
|
61
68
|
|
62
69
|
# URL to the remote file, accepts options for customizing the URL
|
63
70
|
def url(id, **options)
|
64
|
-
if
|
65
|
-
host = @host || "storage.googleapis.com/#{@bucket}"
|
66
|
-
"https://#{host}/#{URI.encode_www_form_component(object_name(id))}"
|
67
|
-
else
|
71
|
+
if options.key? :expires
|
68
72
|
signed_url = storage.signed_url(@bucket, object_name(id), **options)
|
69
73
|
signed_url.gsub!(/storage.googleapis.com\/#{@bucket}/, @host) if @host
|
70
74
|
signed_url
|
75
|
+
else
|
76
|
+
host = @host || "storage.googleapis.com/#{@bucket}"
|
77
|
+
"https://#{host}/#{Addressable::URI.encode_component(object_name(id), Addressable::URI::CharacterClasses::PATH)}"
|
71
78
|
end
|
72
79
|
end
|
73
80
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "shrine-google_cloud_storage"
|
3
|
-
gem.version = "3.
|
3
|
+
gem.version = "3.3.0"
|
4
4
|
|
5
5
|
gem.required_ruby_version = ">= 2.6"
|
6
6
|
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |gem|
|
|
22
22
|
|
23
23
|
gem.add_dependency "shrine", "~> 3.0"
|
24
24
|
gem.add_dependency "google-cloud-storage", "~> 1.6"
|
25
|
+
gem.add_dependency "addressable" # no version constraint to use the same as `google-cloud-storage`
|
25
26
|
|
26
27
|
gem.add_development_dependency "rake"
|
27
28
|
gem.add_development_dependency "minitest"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine-google_cloud_storage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Renaud Chaput
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shrine
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: addressable
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
142
|
- !ruby/object:Gem::Version
|
129
143
|
version: '0'
|
130
144
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
145
|
+
rubygems_version: 3.3.7
|
132
146
|
signing_key:
|
133
147
|
specification_version: 4
|
134
148
|
summary: Provides Google Cloud Storage storage for Shrine.
|