shrine-google_cloud_storage 2.0.1 → 3.0.0
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/README.md +1 -3
- data/lib/shrine/storage/google_cloud_storage.rb +8 -12
- data/shrine-google_cloud_storage.gemspec +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a34cac58aef221675146d164422739c7479e066f0057c66535316f5c73d2e1b5
|
4
|
+
data.tar.gz: a8d23873e4df8609cd7ee8a4243bf1dc434d88b8bd6e3bd4025393139e461df9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0e51f47f9fb65a594803b9ad33a7ea3cd1209767176951c0d564ca7e0988838cc046f7866331ae9179739bc597a2bfb18039c1bbaa498358f7c269967ac00ca
|
7
|
+
data.tar.gz: b11dccee9fb4ed67f2ff3e0de94f15d697a9e1dce2f2f24b00e15e3a69786c2f7e873828218584446db048c0df928e7721b2f9bb38e4915d063acf2cd6b6d22c
|
data/README.md
CHANGED
@@ -12,8 +12,7 @@ gem "shrine-google_cloud_storage"
|
|
12
12
|
|
13
13
|
## Authentication
|
14
14
|
|
15
|
-
The GCS plugin uses
|
16
|
-
documentation for the various ways to provide credentials.
|
15
|
+
The GCS plugin uses the `google-cloud-storage` gem. Please refer to [its documentation for setting up authentication](http://googleapis.github.io/google-cloud-ruby/docs/google-cloud-storage/latest/file.AUTHENTICATION.html).
|
17
16
|
|
18
17
|
## Usage
|
19
18
|
|
@@ -97,4 +96,3 @@ GCS_DEBUG=true
|
|
97
96
|
|
98
97
|
[Google Cloud Storage]: https://cloud.google.com/storage/
|
99
98
|
[Shrine]: https://github.com/shrinerb/shrine
|
100
|
-
[Project and Credential Lookup]: http://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-storage/master/guides/authentication#projectandcredentiallookup
|
@@ -68,31 +68,27 @@ class Shrine
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
# Downloads the file from GCS, and returns a `Tempfile`.
|
72
|
-
def download(id)
|
73
|
-
tempfile = Tempfile.new(["googlestorage", File.extname(id)], binmode: true)
|
74
|
-
get_file(id).download tempfile.path
|
75
|
-
tempfile.tap(&:open)
|
76
|
-
end
|
77
|
-
|
78
71
|
# Opens the remote file and returns it as `Down::ChunkedIO` object.
|
79
72
|
# @return [Down::ChunkedIO] object
|
80
73
|
# @see https://github.com/janko-m/down#downchunkedio
|
81
|
-
def open(id)
|
74
|
+
def open(id, rewindable: true, **options)
|
82
75
|
file = get_file(id)
|
83
76
|
|
77
|
+
raise Shrine::FileNotFound, "file #{id.inspect} not found on storage" unless file
|
78
|
+
|
84
79
|
# create enumerator which lazily yields chunks of downloaded content
|
85
80
|
chunks = Enumerator.new do |yielder|
|
86
81
|
# trick to get google client to stream the download
|
87
82
|
proc_io = ProcIO.new { |data| yielder << data }
|
88
|
-
file.download(proc_io, verify: :none)
|
83
|
+
file.download(proc_io, verify: :none, **options)
|
89
84
|
end
|
90
85
|
|
91
86
|
# wrap chunks in an IO-like object which downloads when needed
|
92
87
|
Down::ChunkedIO.new(
|
93
|
-
chunks:
|
94
|
-
size:
|
95
|
-
|
88
|
+
chunks: chunks,
|
89
|
+
size: file.size,
|
90
|
+
rewindable: rewindable,
|
91
|
+
data: { file: file },
|
96
92
|
)
|
97
93
|
end
|
98
94
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |gem|
|
2
2
|
gem.name = "shrine-google_cloud_storage"
|
3
|
-
gem.version = "
|
3
|
+
gem.version = "3.0.0"
|
4
4
|
|
5
5
|
gem.required_ruby_version = ">= 2.1"
|
6
6
|
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.files = Dir["README.md", "LICENSE.txt", "lib/**/*.rb", "shrine-google_cloud_storage.gemspec"]
|
14
14
|
gem.require_path = "lib"
|
15
15
|
|
16
|
-
gem.add_dependency "shrine", "~>
|
16
|
+
gem.add_dependency "shrine", "~> 3.0"
|
17
17
|
gem.add_dependency "google-cloud-storage", "~> 1.6"
|
18
18
|
|
19
19
|
gem.add_development_dependency "rake"
|
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:
|
4
|
+
version: 3.0.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: 2019-10-
|
11
|
+
date: 2019-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shrine
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: google-cloud-storage
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|