google-cloud-storage-extension 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +85 -0
- data/README.md +32 -0
- data/Rakefile +4 -0
- data/google-cloud-storage-extension.gemspec +31 -0
- data/lib/google/cloud/storage/extension/version.rb +11 -0
- data/lib/google/cloud/storage/extension.rb +32 -0
- data/sig/google/cloud/storage/extension.rbs +10 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b90c8012706923bd4b85456c031237fcb725ef9114267cfeba95a7fbafce8df8
|
4
|
+
data.tar.gz: 976730495eaa8761772d581e2404f5775aaafd3e2cb8e6881c527f8a806d2717
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 594d44d877a2d7c5c4baea7f0365b9e12b26b9b4d2b8a0bea51d7ba651492080f9638aea2699a50c35ce6eec80119c71a856ada1117f0308a67c642b68a5b2ac
|
7
|
+
data.tar.gz: 0270deec2820d2e9f684983f5d71f865c8a955e261ddecc4f67618d0b060751d1f1cdde328c50a80006881697e7196b94db3bb0cdc10e81d1c90813c646215f7
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
google-cloud-storage-extension (0.1.0)
|
5
|
+
google-cloud-storage
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.8.0)
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
12
|
+
declarative (0.0.20)
|
13
|
+
digest-crc (0.6.4)
|
14
|
+
rake (>= 12.0.0, < 14.0.0)
|
15
|
+
faraday (2.3.0)
|
16
|
+
faraday-net_http (~> 2.0)
|
17
|
+
ruby2_keywords (>= 0.0.4)
|
18
|
+
faraday-net_http (2.0.3)
|
19
|
+
google-apis-core (0.5.0)
|
20
|
+
addressable (~> 2.5, >= 2.5.1)
|
21
|
+
googleauth (>= 0.16.2, < 2.a)
|
22
|
+
httpclient (>= 2.8.1, < 3.a)
|
23
|
+
mini_mime (~> 1.0)
|
24
|
+
representable (~> 3.0)
|
25
|
+
retriable (>= 2.0, < 4.a)
|
26
|
+
rexml
|
27
|
+
webrick
|
28
|
+
google-apis-iamcredentials_v1 (0.10.0)
|
29
|
+
google-apis-core (>= 0.4, < 2.a)
|
30
|
+
google-apis-storage_v1 (0.14.0)
|
31
|
+
google-apis-core (>= 0.4, < 2.a)
|
32
|
+
google-cloud-core (1.6.0)
|
33
|
+
google-cloud-env (~> 1.0)
|
34
|
+
google-cloud-errors (~> 1.0)
|
35
|
+
google-cloud-env (1.6.0)
|
36
|
+
faraday (>= 0.17.3, < 3.0)
|
37
|
+
google-cloud-errors (1.2.0)
|
38
|
+
google-cloud-storage (1.36.2)
|
39
|
+
addressable (~> 2.8)
|
40
|
+
digest-crc (~> 0.4)
|
41
|
+
google-apis-iamcredentials_v1 (~> 0.1)
|
42
|
+
google-apis-storage_v1 (~> 0.1)
|
43
|
+
google-cloud-core (~> 1.6)
|
44
|
+
googleauth (>= 0.16.2, < 2.a)
|
45
|
+
mini_mime (~> 1.0)
|
46
|
+
googleauth (1.1.3)
|
47
|
+
faraday (>= 0.17.3, < 3.a)
|
48
|
+
jwt (>= 1.4, < 3.0)
|
49
|
+
memoist (~> 0.16)
|
50
|
+
multi_json (~> 1.11)
|
51
|
+
os (>= 0.9, < 2.0)
|
52
|
+
signet (>= 0.16, < 2.a)
|
53
|
+
httpclient (2.8.3)
|
54
|
+
jwt (2.4.1)
|
55
|
+
memoist (0.16.2)
|
56
|
+
mini_mime (1.1.2)
|
57
|
+
multi_json (1.15.0)
|
58
|
+
os (1.1.4)
|
59
|
+
public_suffix (4.0.7)
|
60
|
+
rake (13.0.6)
|
61
|
+
representable (3.2.0)
|
62
|
+
declarative (< 0.1.0)
|
63
|
+
trailblazer-option (>= 0.1.1, < 0.2.0)
|
64
|
+
uber (< 0.2.0)
|
65
|
+
retriable (3.1.2)
|
66
|
+
rexml (3.2.5)
|
67
|
+
ruby2_keywords (0.0.5)
|
68
|
+
signet (0.16.1)
|
69
|
+
addressable (~> 2.8)
|
70
|
+
faraday (>= 0.17.5, < 3.0)
|
71
|
+
jwt (>= 1.5, < 3.0)
|
72
|
+
multi_json (~> 1.10)
|
73
|
+
trailblazer-option (0.1.2)
|
74
|
+
uber (0.1.0)
|
75
|
+
webrick (1.7.0)
|
76
|
+
|
77
|
+
PLATFORMS
|
78
|
+
arm64-darwin-21
|
79
|
+
|
80
|
+
DEPENDENCIES
|
81
|
+
google-cloud-storage-extension!
|
82
|
+
rake (~> 13.0)
|
83
|
+
|
84
|
+
BUNDLED WITH
|
85
|
+
2.3.15
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Google::Cloud::Storage::Extension
|
2
|
+
|
3
|
+
An extension of google-cloud-storage gem.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
8
|
+
|
9
|
+
$ bundle add google-cloud-storage-extension
|
10
|
+
|
11
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
12
|
+
|
13
|
+
$ gem install google-cloud-storage-extension
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
bucket = storage.bucket('bucket-name')
|
19
|
+
bytesize = bucket.f('file.png') do |file|
|
20
|
+
File.binread(file).bytesize
|
21
|
+
end
|
22
|
+
```
|
23
|
+
|
24
|
+
## Development
|
25
|
+
|
26
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
27
|
+
|
28
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
29
|
+
|
30
|
+
## Contributing
|
31
|
+
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/google-cloud-storage-extension.
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/google/cloud/storage/extension/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'google-cloud-storage-extension'
|
7
|
+
spec.version = Google::Cloud::Storage::Extension::VERSION
|
8
|
+
spec.authors = ['Ishotihadus']
|
9
|
+
spec.email = ['hanachan.pao@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Gem to extend google-cloud-storage gem'
|
12
|
+
spec.description = 'Gem to extend google-cloud-storage gem'
|
13
|
+
spec.homepage = 'https://github.com/ishotihadus/google-cloud-storage-extension'
|
14
|
+
spec.required_ruby_version = '>= 3.1.0'
|
15
|
+
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = 'https://github.com/ishotihadus/google-cloud-storage-extension'
|
18
|
+
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(__dir__) do
|
22
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
24
|
+
end
|
25
|
+
end
|
26
|
+
spec.bindir = 'exe'
|
27
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) {|f| File.basename(f)}
|
28
|
+
spec.require_paths = ['lib']
|
29
|
+
|
30
|
+
spec.add_dependency 'google-cloud-storage'
|
31
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'google/cloud/storage'
|
4
|
+
require 'tempfile'
|
5
|
+
require_relative 'extension/version'
|
6
|
+
|
7
|
+
module Google
|
8
|
+
module Cloud
|
9
|
+
module Storage
|
10
|
+
class Bucket
|
11
|
+
# downloads the specified file and passes the path of the temporary file to the block argument
|
12
|
+
# @param [String] filename
|
13
|
+
# @yield [path]
|
14
|
+
# @yieldparam path [String] path of tempfile
|
15
|
+
def f(filename, mode: 0)
|
16
|
+
file = self.file(filename)
|
17
|
+
raise 'file not found' unless file
|
18
|
+
|
19
|
+
name = file.name
|
20
|
+
basename = ::File.basename(name, '.*')
|
21
|
+
extname = ::File.extname(name)
|
22
|
+
tempfile = ::Tempfile.create([basename, extname], mode:)
|
23
|
+
file.download(tempfile.path)
|
24
|
+
ret = yield(tempfile.path)
|
25
|
+
::File.delete(tempfile.path)
|
26
|
+
|
27
|
+
ret
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: google-cloud-storage-extension
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ishotihadus
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-06-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: google-cloud-storage
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Gem to extend google-cloud-storage gem
|
28
|
+
email:
|
29
|
+
- hanachan.pao@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- Gemfile
|
35
|
+
- Gemfile.lock
|
36
|
+
- README.md
|
37
|
+
- Rakefile
|
38
|
+
- google-cloud-storage-extension.gemspec
|
39
|
+
- lib/google/cloud/storage/extension.rb
|
40
|
+
- lib/google/cloud/storage/extension/version.rb
|
41
|
+
- sig/google/cloud/storage/extension.rbs
|
42
|
+
homepage: https://github.com/ishotihadus/google-cloud-storage-extension
|
43
|
+
licenses: []
|
44
|
+
metadata:
|
45
|
+
homepage_uri: https://github.com/ishotihadus/google-cloud-storage-extension
|
46
|
+
source_code_uri: https://github.com/ishotihadus/google-cloud-storage-extension
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 3.1.0
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubygems_version: 3.3.3
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Gem to extend google-cloud-storage gem
|
66
|
+
test_files: []
|