stashify-aws-s3 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.reek.yml +0 -3
- data/.rubocop.yml +0 -3
- data/Gemfile +1 -1
- data/Gemfile.lock +11 -8
- data/README.md +23 -4
- data/lib/stashify/aws/s3/version.rb +1 -1
- data/lib/stashify/directory/aws/s3.rb +16 -7
- data/lib/stashify/file/aws/s3.rb +7 -0
- data/stashify-aws-s3.gemspec +39 -0
- metadata +5 -5
- data/lib/stashify/aws/s3.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce717afda57c7d79f38076ed0a99d31a30addd862130127c39e0b1cd4e9b74e0
|
4
|
+
data.tar.gz: 4d8201ac2421c564ac6ddd315d6423349d6f9ec9be14fc3fa106f5884ce1ba3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 105eeb1a4271a585ffea9e05dd8accfc38ad2cf95b36d75d8c43f40e202320f7c45fd3ca3fd20fafe0a27b4470cb8b349576686867ce6063f51b1f9d3ff71272
|
7
|
+
data.tar.gz: ee603c5f9313be928fde0d3fb470595af324d6b21c042fb62e6103650b442675a63bbf7ec2d4aae550b246d1594ee986333d96335f2a39660e9206400aa28294
|
data/.reek.yml
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stashify-aws-s3 (
|
4
|
+
stashify-aws-s3 (1.2.0)
|
5
5
|
aws-sdk-s3 (~> 1.119.2)
|
6
|
-
stashify (~> 3.
|
6
|
+
stashify (~> 3.2.1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
ast (2.4.2)
|
12
12
|
aws-eventstream (1.2.0)
|
13
|
-
aws-partitions (1.
|
13
|
+
aws-partitions (1.743.0)
|
14
14
|
aws-sdk-core (3.171.0)
|
15
15
|
aws-eventstream (~> 1, >= 1.0.2)
|
16
16
|
aws-partitions (~> 1, >= 1.651.0)
|
@@ -63,7 +63,7 @@ GEM
|
|
63
63
|
nenv (~> 0.1)
|
64
64
|
shellany (~> 0.0)
|
65
65
|
parallel (1.22.1)
|
66
|
-
parser (3.2.
|
66
|
+
parser (3.2.2.0)
|
67
67
|
ast (~> 2.4.1)
|
68
68
|
pry (0.14.2)
|
69
69
|
coderay (~> 1.1)
|
@@ -93,21 +93,24 @@ GEM
|
|
93
93
|
diff-lcs (>= 1.2.0, < 2.0)
|
94
94
|
rspec-support (~> 3.12.0)
|
95
95
|
rspec-support (3.12.0)
|
96
|
-
rubocop (1.
|
96
|
+
rubocop (1.49.0)
|
97
97
|
json (~> 2.3)
|
98
98
|
parallel (~> 1.10)
|
99
99
|
parser (>= 3.2.0.0)
|
100
100
|
rainbow (>= 2.2.2, < 4.0)
|
101
101
|
regexp_parser (>= 1.8, < 3.0)
|
102
102
|
rexml (>= 3.2.5, < 4.0)
|
103
|
-
rubocop-ast (>= 1.
|
103
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
104
104
|
ruby-progressbar (~> 1.7)
|
105
105
|
unicode-display_width (>= 2.4.0, < 3.0)
|
106
106
|
rubocop-ast (1.28.0)
|
107
107
|
parser (>= 3.2.1.0)
|
108
108
|
ruby-progressbar (1.13.0)
|
109
109
|
shellany (0.0.1)
|
110
|
-
stashify (3.
|
110
|
+
stashify (3.2.1)
|
111
|
+
stashify-contract (1.0.1)
|
112
|
+
rantly (~> 2.0.0)
|
113
|
+
rspec (~> 3.0)
|
111
114
|
thor (1.2.1)
|
112
115
|
unicode-display_width (2.4.2)
|
113
116
|
|
@@ -121,11 +124,11 @@ DEPENDENCIES
|
|
121
124
|
guard-rspec
|
122
125
|
guard-rubocop
|
123
126
|
rake (~> 13.0)
|
124
|
-
rantly
|
125
127
|
reek (~> 6.1.4)
|
126
128
|
rspec (~> 3.0)
|
127
129
|
rubocop (~> 1.21)
|
128
130
|
stashify-aws-s3!
|
131
|
+
stashify-contract
|
129
132
|
|
130
133
|
BUNDLED WITH
|
131
134
|
2.2.33
|
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Stashify::Aws::S3
|
2
2
|
|
3
|
-
|
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 AWS S3. 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
|
|
@@ -22,7 +20,28 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
This implementation is built on top of an instance of `Aws::S3::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 "aws-sdk-s3"
|
27
|
+
=> true
|
28
|
+
> s3 = Aws::S3::Resource.new
|
29
|
+
=> #<Aws::S3::Resource:0x0000558723dad2e8 @client=#<Aws::S3::Client>>
|
30
|
+
irb(main):005:0> bucket = s3.bucket("some-bucket")
|
31
|
+
=>
|
32
|
+
#<Aws::S3::Bucket:0x0000558723f5a6e0
|
33
|
+
...
|
34
|
+
> file.contents
|
35
|
+
=> "foo"
|
36
|
+
> require "stashify/directory/aws/s3"
|
37
|
+
=> true
|
38
|
+
> dir = Stashify::Directory::AWS::S3.new(bucket: bucket, path: "path/to")
|
39
|
+
=>
|
40
|
+
#<Stashify::Directory::AWS::S3:0x000055872460c628
|
41
|
+
...
|
42
|
+
> dir.find("file") == file
|
43
|
+
=> true
|
44
|
+
```
|
26
45
|
|
27
46
|
## Development
|
28
47
|
|
@@ -6,6 +6,10 @@ require "stashify/file/aws/s3"
|
|
6
6
|
module Stashify
|
7
7
|
class Directory
|
8
8
|
module AWS
|
9
|
+
# An implementation for interacting with AWS S3 buckets as if
|
10
|
+
# they had directories with "/" as a path separator. In
|
11
|
+
# addition to a path, it also needs a Aws::S3::Bucket object
|
12
|
+
# representing the bucket the file resides within.
|
9
13
|
class S3 < Stashify::Directory
|
10
14
|
attr_reader :bucket, :path
|
11
15
|
|
@@ -14,6 +18,13 @@ module Stashify
|
|
14
18
|
super(path: path)
|
15
19
|
end
|
16
20
|
|
21
|
+
def parent
|
22
|
+
Stashify::Directory::AWS::S3.new(
|
23
|
+
bucket: @bucket,
|
24
|
+
path: ::File.dirname(path),
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
17
28
|
def files
|
18
29
|
@bucket.objects.map do |object|
|
19
30
|
key = object.key
|
@@ -21,12 +32,6 @@ module Stashify
|
|
21
32
|
end.compact
|
22
33
|
end
|
23
34
|
|
24
|
-
def ==(other)
|
25
|
-
self.class == other.class && @bucket == other.bucket && path == other.path
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
35
|
def directory?(name)
|
31
36
|
@bucket.objects(prefix: path_of(name, "")).count.positive?
|
32
37
|
end
|
@@ -35,13 +40,17 @@ module Stashify
|
|
35
40
|
Stashify::Directory::AWS::S3.new(bucket: @bucket, path: path_of(name))
|
36
41
|
end
|
37
42
|
|
38
|
-
def
|
43
|
+
def exists?(name)
|
39
44
|
@bucket.object(::File.join(path, name)).exists?
|
40
45
|
end
|
41
46
|
|
42
47
|
def file(name)
|
43
48
|
Stashify::File::AWS::S3.new(bucket: @bucket, path: ::File.join(path, name))
|
44
49
|
end
|
50
|
+
|
51
|
+
def ==(other)
|
52
|
+
self.class == other.class && @bucket == other.bucket && path == other.path
|
53
|
+
end
|
45
54
|
end
|
46
55
|
end
|
47
56
|
end
|
data/lib/stashify/file/aws/s3.rb
CHANGED
@@ -5,6 +5,9 @@ require "stashify/file"
|
|
5
5
|
module Stashify
|
6
6
|
class File
|
7
7
|
module AWS
|
8
|
+
# An implementation for interacting with files in AWS S3
|
9
|
+
# buckets. The constructor needs an instance of Aws::S3::Bucket
|
10
|
+
# order to know which bucket to interact with.
|
8
11
|
class S3 < Stashify::File
|
9
12
|
def initialize(bucket:, path:)
|
10
13
|
@bucket = bucket
|
@@ -22,6 +25,10 @@ module Stashify
|
|
22
25
|
def delete
|
23
26
|
@bucket.object(path).delete
|
24
27
|
end
|
28
|
+
|
29
|
+
def exists?
|
30
|
+
@bucket.object(path).exists?
|
31
|
+
end
|
25
32
|
end
|
26
33
|
end
|
27
34
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/stashify/aws/s3/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "stashify-aws-s3"
|
7
|
+
spec.version = Stashify::AWS::S3::VERSION
|
8
|
+
spec.authors = ["Lambda Null"]
|
9
|
+
spec.email = ["lambda.null.42@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "An AWS S3 implementation of the Stashify abstraction"
|
12
|
+
spec.description = "Interact with AWS S3 using the common building blocks provided by Stashify"
|
13
|
+
spec.homepage = "https://github.com/Lambda-Null/stashify-aws-s3"
|
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 "example-gem", "~> 1.0"
|
33
|
+
spec.add_dependency "aws-sdk-s3", "~> 1.119.2"
|
34
|
+
spec.add_dependency "stashify", "~> 3.2.1"
|
35
|
+
|
36
|
+
# For more information and examples about making a new gem, checkout our
|
37
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
38
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
39
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stashify-aws-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
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-
|
11
|
+
date: 2023-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
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.
|
40
|
+
version: 3.2.1
|
41
41
|
description: Interact with AWS S3 using the common building blocks provided by Stashify
|
42
42
|
email:
|
43
43
|
- lambda.null.42@gmail.com
|
@@ -57,11 +57,11 @@ files:
|
|
57
57
|
- Rakefile
|
58
58
|
- bin/console
|
59
59
|
- bin/setup
|
60
|
-
- lib/stashify/aws/s3.rb
|
61
60
|
- lib/stashify/aws/s3/version.rb
|
62
61
|
- lib/stashify/directory/aws/s3.rb
|
63
62
|
- lib/stashify/file/aws/s3.rb
|
64
63
|
- sig/stashify/aws/s3.rbs
|
64
|
+
- stashify-aws-s3.gemspec
|
65
65
|
homepage: https://github.com/Lambda-Null/stashify-aws-s3
|
66
66
|
licenses:
|
67
67
|
- MIT
|