stashify-google-cloud-storage 3.0.0 → 3.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 750d4b6d827c4d277ac656444a240c85965c878639c7325237e45f913f1abd59
4
- data.tar.gz: c0250df28f855b1ca9021f76342443ee1ea6d87c819fd1a71c0f9104f9d5d35e
3
+ metadata.gz: bd0b2c9765b2e4114b50cef616bcb39bcbb263d5f6d591da9b36be9e25fd0fc4
4
+ data.tar.gz: 589647aa4834c56c9c1afac29f69a5ddcdc8693259e6e5040d1509724655ba03
5
5
  SHA512:
6
- metadata.gz: ce690f10bbfedaa4495ce5a05dd13177987abbe2f0a4de51c952d37ef956ffb21e17594098c3349bd212bee5a4138f06d7c58c1e0e09146b8646d455470ae876
7
- data.tar.gz: f0b44a9d62d003f591dc72513ed0caba827e5a5f77fc626df5de29d8fc1601f0b6cd1795a94120b2f8a4250d0e6f3e7bc211da8264682c18ad576c5721455334
6
+ metadata.gz: a6a04e2f86e2689f32c3c567bfac1431ea5e1e7512ec6c161d9f19196d524422c468be1e08ec6221983d605b7b52210c48b2b7af2f605fc86b6ada5e9e5b5d67
7
+ data.tar.gz: a323d70da2277db57b53061ee23dde13824dca04d2645e9dbab09aece2ab6f50c801212dc398a913b1c97223f271ee12baee0e8fa28b8416026d458714d88149
data/.rubocop.yml CHANGED
@@ -2,9 +2,6 @@ AllCops:
2
2
  TargetRubyVersion: 2.6
3
3
  NewCops: enable
4
4
 
5
- Style/Documentation:
6
- Enabled: false
7
-
8
5
  Style/StringLiterals:
9
6
  Enabled: true
10
7
  EnforcedStyle: double_quotes
data/Gemfile CHANGED
@@ -17,4 +17,4 @@ gem "guard-rspec"
17
17
  gem "guard-rubocop"
18
18
 
19
19
  gem "byebug"
20
- gem "rantly"
20
+ gem "stashify-contract"
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stashify-google-cloud-storage (2.0.0)
4
+ stashify-google-cloud-storage (3.1.1)
5
5
  google-cloud-storage (~> 1.44.0)
6
- stashify (~> 3.0.0)
6
+ stashify (~> 3.2.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.8.1)
11
+ addressable (2.8.3)
12
12
  public_suffix (>= 2.0.2, < 6.0)
13
13
  ast (2.4.2)
14
14
  byebug (11.1.3)
@@ -95,7 +95,7 @@ GEM
95
95
  shellany (~> 0.0)
96
96
  os (1.1.4)
97
97
  parallel (1.22.1)
98
- parser (3.2.1.1)
98
+ parser (3.2.2.0)
99
99
  ast (~> 2.4.1)
100
100
  pry (0.14.2)
101
101
  coderay (~> 1.1)
@@ -131,14 +131,14 @@ GEM
131
131
  diff-lcs (>= 1.2.0, < 2.0)
132
132
  rspec-support (~> 3.12.0)
133
133
  rspec-support (3.12.0)
134
- rubocop (1.48.1)
134
+ rubocop (1.49.0)
135
135
  json (~> 2.3)
136
136
  parallel (~> 1.10)
137
137
  parser (>= 3.2.0.0)
138
138
  rainbow (>= 2.2.2, < 4.0)
139
139
  regexp_parser (>= 1.8, < 3.0)
140
140
  rexml (>= 3.2.5, < 4.0)
141
- rubocop-ast (>= 1.26.0, < 2.0)
141
+ rubocop-ast (>= 1.28.0, < 2.0)
142
142
  ruby-progressbar (~> 1.7)
143
143
  unicode-display_width (>= 2.4.0, < 3.0)
144
144
  rubocop-ast (1.28.0)
@@ -151,7 +151,10 @@ GEM
151
151
  faraday (>= 0.17.5, < 3.a)
152
152
  jwt (>= 1.5, < 3.0)
153
153
  multi_json (~> 1.10)
154
- stashify (3.0.0)
154
+ stashify (3.2.1)
155
+ stashify-contract (1.0.1)
156
+ rantly (~> 2.0.0)
157
+ rspec (~> 3.0)
155
158
  thor (1.2.1)
156
159
  trailblazer-option (0.1.2)
157
160
  uber (0.1.0)
@@ -168,10 +171,10 @@ DEPENDENCIES
168
171
  guard-rspec
169
172
  guard-rubocop
170
173
  rake (~> 13.0)
171
- rantly
172
174
  reek (~> 6.1.4)
173
175
  rspec (~> 3.0)
174
176
  rubocop (~> 1.21)
177
+ stashify-contract
175
178
  stashify-google-cloud-storage!
176
179
 
177
180
  BUNDLED WITH
data/README.md CHANGED
@@ -1,15 +1,13 @@
1
1
  # Stashify::GoogleCloudStorage
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/stashify/google_cloud_storage`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ This is an implementation of the [Stashify](https://rubydoc.info/gems/stashify) abstraction for Google Cloud Storage. It operates under the assumption that the "/" in file names has the typical meaning of a path separater.
6
4
 
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
10
8
 
11
9
  ```ruby
12
- gem 'stashify-google_cloud_storage'
10
+ gem 'stashify-google-cloud-storage'
13
11
  ```
14
12
 
15
13
  And then execute:
@@ -18,11 +16,35 @@ And then execute:
18
16
 
19
17
  Or install it yourself as:
20
18
 
21
- $ gem install stashify-google_cloud_storage
19
+ $ gem install stashify-google-cloud-storage
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ This implementation is built on top of an instance of `Google::Cloud::Storage::Bucket`. The following usage is an abbreviated form to illustrate how to engage in this particular library. For a more extensive example see [Stashify's Usage](https://rubydoc.info/gems/stashify#usage).
24
+
25
+ ```ruby
26
+ > require "google/cloud/storage"
27
+ => true
28
+ > storage = Google::Cloud::Storage.new(project_id: "some-project-id")
29
+ > bucket = storage.bucket("some-bucket-name")
30
+ > require "stashify/file/google/cloud/storage"
31
+ => true
32
+ > file = Stashify::File::Google::Cloud::Storage.new(bucket: bucket, path: "pa
33
+ th/to/file")
34
+ =>
35
+ #<Stashify::File::Google::Cloud::Storage:0x000055af8eb86800
36
+ ...
37
+ > file.contents
38
+ => "foo"
39
+ > require "stashify/directory/google/cloud/storage"
40
+ => true
41
+ > dir = Stashify::Directory::Google::Cloud::Storage.new(bucket: bucket, path: "path/to")
42
+ =>
43
+ #<Stashify::Directory::Google::Cloud::Storage:0x000055af8ebd6918
44
+ ...
45
+ > dir.find("file") == file
46
+ => true
47
+ ```
26
48
 
27
49
  ## Development
28
50
 
@@ -8,6 +8,11 @@ module Stashify
8
8
  class Directory
9
9
  module Google
10
10
  module Cloud
11
+ # An implementation for interacting with Google Cloud Storage
12
+ # buckets as if they had directories with "/" as a path
13
+ # separator. In addition to a path, it also needs a
14
+ # Google::Cloud::Storage::Bucket object representing the
15
+ # bucket the file resides within.
11
16
  class Storage < Stashify::Directory
12
17
  attr_reader :bucket
13
18
 
@@ -16,18 +21,19 @@ module Stashify
16
21
  super(path: path)
17
22
  end
18
23
 
24
+ def parent
25
+ Stashify::Directory::Google::Cloud::Storage.new(
26
+ bucket: @bucket,
27
+ path: ::File.dirname(path),
28
+ )
29
+ end
30
+
19
31
  def files
20
32
  @bucket.files.map do |gcloud_file|
21
33
  find(::Regexp.last_match(1)) if gcloud_file.name =~ %r{^#{Regexp.escape(path)}/([^/]*)(/.*)?$}
22
34
  end.compact
23
35
  end
24
36
 
25
- def ==(other)
26
- self.class == other.class && @bucket == other.bucket && path == other.path
27
- end
28
-
29
- private
30
-
31
37
  def directory?(name)
32
38
  path = path_of(name)
33
39
  !@bucket.file(path) && !@bucket.files(prefix: path).empty?
@@ -37,13 +43,17 @@ module Stashify
37
43
  Stashify::Directory::Google::Cloud::Storage.new(bucket: @bucket, path: path_of(name))
38
44
  end
39
45
 
40
- def file?(name)
46
+ def exists?(name)
41
47
  @bucket.file(path_of(name))
42
48
  end
43
49
 
44
50
  def file(name)
45
51
  Stashify::File::Google::Cloud::Storage.new(bucket: @bucket, path: path_of(name))
46
52
  end
53
+
54
+ def ==(other)
55
+ self.class == other.class && @bucket == other.bucket && path == other.path
56
+ end
47
57
  end
48
58
  end
49
59
  end
@@ -6,6 +6,10 @@ module Stashify
6
6
  class File
7
7
  module Google
8
8
  module Cloud
9
+ # An implementation for interacting with files in Google Cloud
10
+ # Storage buckets. The constructor needs an instance of
11
+ # Google::Cloud::Storage::Bucket in order to know which bucket
12
+ # to interact with.
9
13
  class Storage < Stashify::File
10
14
  def initialize(bucket:, path:)
11
15
  @bucket = bucket
@@ -26,6 +30,10 @@ module Stashify
26
30
  def delete
27
31
  @bucket.file(path).delete
28
32
  end
33
+
34
+ def exists?
35
+ @bucket.file(path)
36
+ end
29
37
  end
30
38
  end
31
39
  end
@@ -4,7 +4,7 @@ module Stashify
4
4
  module Google
5
5
  module Cloud
6
6
  module Storage
7
- VERSION = "3.0.0"
7
+ VERSION = "3.1.1"
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/stashify/google/cloud/storage/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "stashify-google-cloud-storage"
7
+ spec.version = Stashify::Google::Cloud::Storage::VERSION
8
+ spec.authors = ["Lambda Null"]
9
+ spec.email = ["lambda.null.42@gmail.com"]
10
+
11
+ spec.summary = "A Google Cloud Storage implementation of the Stashify abstraction"
12
+ spec.description = "Interact with Google Cloud Storage using the common building blocks provided by Stashify"
13
+ spec.homepage = "https://github.com/Lambda-Null/stashify-google-cloud-storage"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 2.6.0"
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
+ end
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ # Uncomment to register a new dependency of your gem
32
+ spec.add_dependency "google-cloud-storage", "~> 1.44.0"
33
+ spec.add_dependency "stashify", "~> 3.2.1"
34
+
35
+ # For more information and examples about making a new gem, checkout our
36
+ # guide at: https://bundler.io/guides/creating_gem.html
37
+ spec.metadata["rubygems_mfa_required"] = "true"
38
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stashify-google-cloud-storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lambda Null
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-30 00:00:00.000000000 Z
11
+ date: 2023-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-storage
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0
33
+ version: 3.2.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.0
40
+ version: 3.2.1
41
41
  description: Interact with Google Cloud Storage using the common building blocks provided
42
42
  by Stashify
43
43
  email:
@@ -46,7 +46,6 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - ".reek.yml"
50
49
  - ".rspec"
51
50
  - ".rubocop.yml"
52
51
  - CODE_OF_CONDUCT.md
@@ -60,9 +59,9 @@ files:
60
59
  - bin/setup
61
60
  - lib/stashify/directory/google/cloud/storage.rb
62
61
  - lib/stashify/file/google/cloud/storage.rb
63
- - lib/stashify/google/cloud/storage.rb
64
62
  - lib/stashify/google/cloud/storage/version.rb
65
63
  - sig/stashify/google_cloud_storage.rbs
64
+ - stashify-google-cloud-storage.gemspec
66
65
  homepage: https://github.com/Lambda-Null/stashify-google-cloud-storage
67
66
  licenses:
68
67
  - MIT
data/.reek.yml DELETED
@@ -1,3 +0,0 @@
1
- detectors:
2
- IrresponsibleModule:
3
- enabled: false
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "google/cloud/storage/version"
4
-
5
- module Stashify
6
- module Google
7
- module Cloud
8
- module Storage
9
- end
10
- end
11
- end
12
- end