fake_s3 0.9 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d994993efd15d616784cb985f37d921acd2c65bd814e69484db256250b4ca4b9
4
- data.tar.gz: 6fb65389b196b8b06a58e28eb7fe326aa07507386002fb007426b77067b45a35
3
+ metadata.gz: 1df8e2cc7976463b853cb729dc63b434f0a53dcd12ef637ef9f788612fae64e5
4
+ data.tar.gz: 4dcef70888e4ea6bec62a1d1c35fe5b5701a0fb44dd888abb096689679dbf4d9
5
5
  SHA512:
6
- metadata.gz: 54bfc011cc636df685d63ece661677f8e0f05e1afab46bf314ecf2f2fb6e531ab2d8c5ced302469e2f7eb75a734b6f2544cf53f70a1342cc0125cfab451a4583
7
- data.tar.gz: ef079e7e352459563c443baf1ad4ce3c4d0b2ed656393a757c4f1690cfcd4f9070f1128cdc92763e1d480f7ed86cff4ffe5ef7b632df8ad41271133d0097ca35
6
+ metadata.gz: 47b23b59f0c8dadb2d0df0d64546a4e1bb84f027385f6e65d22d195a6853c18620aac23b5dd9f30de265941f7211383226d414e4344effd5446bf3a9d191f366
7
+ data.tar.gz: 9b89c0a74e8bf5a72dfe88c1c36cc7b39214448dd45b2882cc91a96bce350075ec38933c000c80eab0cd625f99d3195917bd15855785b446f46111ae9f26a714
data/.gitignore CHANGED
@@ -48,3 +48,4 @@ build-iPhoneSimulator/
48
48
 
49
49
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
50
  .rvmrc
51
+ .tool-versions
data/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## [0.12.0] - 2022-11-08
6
+
7
+ - fix bug w/ bucket.objects
8
+ - allow bucket.objects() to take prefix
9
+
10
+ ## [0.11.0] - 2022-11-03
11
+
12
+ - add delete on object and delete_objects on bucket
13
+ - support ruby 3.0
14
+ - [#3](https://github.com/transparentclassroom/fake_s3/pull/3) Dependency updates
15
+
16
+ ## [0.10.0] - 2020-10-30
17
+
18
+ ### Added
19
+
20
+ - [#2](https://github.com/transparentclassroom/fake_s3/pull/2) Adds `#presigned_url` to `FakeS3::Object`
21
+
22
+ ### Changed
23
+
24
+ - [#2](https://github.com/transparentclassroom/fake_s3/pull/2) BREAKING: Gets rid of `tc.com` portion of fake URL for `FakeS3::Object#public_url`
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fake_s3 (0.9)
4
+ fake_s3 (0.12.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- rake (10.5.0)
9
+ rake (13.0.1)
10
10
 
11
11
  PLATFORMS
12
12
  ruby
@@ -14,7 +14,7 @@ PLATFORMS
14
14
  DEPENDENCIES
15
15
  bundler (~> 1.9)
16
16
  fake_s3!
17
- rake (~> 10.0)
17
+ rake (~> 13.0)
18
18
 
19
19
  BUNDLED WITH
20
20
  1.17.2
data/README.md CHANGED
@@ -1,2 +1,13 @@
1
- # fake_s3
1
+ # fake_s3 gem
2
+
2
3
  This is a fake s3 ruby object that mirrors the s3 part of the aws_sdk gem. You can use it in tests.
4
+
5
+ ## Installing
6
+
7
+ Add to your gemfile:
8
+
9
+ `gem 'fake_s3'`
10
+
11
+ ## Releasing
12
+
13
+ `rake release`
data/fake_s3.gemspec CHANGED
@@ -17,10 +17,10 @@ Gem::Specification.new do |spec|
17
17
  # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.required_ruby_version = '~> 2.4'
20
+ spec.required_ruby_version = '>= 2.4'
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.9"
23
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rake", "~> 13.0"
24
24
 
25
25
  # spec.add_dependency 'colorize'
26
26
  end
@@ -11,14 +11,25 @@ module FakeS3
11
11
  @objects = {}
12
12
  end
13
13
 
14
- def objects(_ = {})
15
- @objects.keep_if(&:exists?)
14
+ def objects(opts = {})
15
+ @objects
16
+ .find_all do |key, obj|
17
+ obj.exists? && (!opts[:prefix] || key.starts_with?(opts[:prefix]))
18
+ end
19
+ .map {|_key, obj| obj }
16
20
  end
17
21
 
18
22
  def object(key)
19
23
  @objects[key] ||= FakeS3::Object.new(self, key, nil)
20
24
  end
21
25
 
26
+ def delete_objects(args)
27
+ args[:delete][:objects].each do |objects|
28
+ @objects.delete(objects[:key])
29
+ end
30
+ end
31
+
32
+ # this is a method for tests to see the contents of a fake bucket
22
33
  def keys_to_contents
23
34
  @objects.map_to_hash do |key, obj|
24
35
  [key, obj.get.body.read]
@@ -43,8 +43,16 @@ module FakeS3
43
43
  location.bucket.move_to(self, location)
44
44
  end
45
45
 
46
+ def delete
47
+ bucket.delete_objects(delete: {objects: [{key: key}]})
48
+ end
49
+
46
50
  def public_url
47
- "https://test.tc.com.s3.amazonaws.com/#{@key}"
51
+ "https://test.com.s3.amazonaws.com/#{@key}"
52
+ end
53
+
54
+ def presigned_url(method = :get, expires_in: 1.minute)
55
+ "https://test.com.s3.amazonaws.com/#{@key}?X-Amz-Credential=123&method=#{method}&expires_in=#{expires_in.to_s}"
48
56
  end
49
57
 
50
58
  class FakeObjectOutput
@@ -1,3 +1,3 @@
1
1
  module FakeS3
2
- VERSION = "0.9"
2
+ VERSION = "0.12.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fake_s3
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.9'
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Lightsmith
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-22 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
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: '10.0'
40
+ version: '13.0'
41
41
  description: Use this library for unit testing S3 on ruby
42
42
  email:
43
43
  - jeremy.lightsmith@gmail.com
@@ -46,6 +46,7 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - ".gitignore"
49
+ - CHANGELOG.md
49
50
  - Gemfile
50
51
  - Gemfile.lock
51
52
  - LICENSE
@@ -60,13 +61,13 @@ homepage: https://github.com/transparentclassroom/fake_s3
60
61
  licenses:
61
62
  - MIT
62
63
  metadata: {}
63
- post_install_message:
64
+ post_install_message:
64
65
  rdoc_options: []
65
66
  require_paths:
66
67
  - lib
67
68
  required_ruby_version: !ruby/object:Gem::Requirement
68
69
  requirements:
69
- - - "~>"
70
+ - - ">="
70
71
  - !ruby/object:Gem::Version
71
72
  version: '2.4'
72
73
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -75,8 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
76
  - !ruby/object:Gem::Version
76
77
  version: '0'
77
78
  requirements: []
78
- rubygems_version: 3.0.3
79
- signing_key:
79
+ rubygems_version: 3.3.7
80
+ signing_key:
80
81
  specification_version: 4
81
82
  summary: A fake library that mirrors the S3 part of aws-sdk for ruby
82
83
  test_files: []