bfs-s3 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bfs/bucket/s3.rb +8 -12
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d45908f3dcc0517ee7beab0c08841a516c140069f2a4e3a6166ae0333ca2c5f0
4
- data.tar.gz: 2c845b22f0fb5776ba1e8be311f1de7cd0ff9caf5cd88d61f8b0782712810dc0
3
+ metadata.gz: 37e10fdc93aa067bed7a72b5bcbccbc8b05bebad755e1bdd5091f6ed03b78206
4
+ data.tar.gz: 6db5a4abb0b6b6825785eff4a18ca74e5bf6083c2a6ce3f0344e3ea28b7e0446
5
5
  SHA512:
6
- metadata.gz: 64de3e661d1bf09aa264ad045eaeeff4c5a86320ab90be4b96e4c46fb9675379babd0ebe24cf98c56552db05fa7dec2ae7530283b7f65fdb27c1819d929199ca
7
- data.tar.gz: 7a4707fbfed527b5e3f3ebd48887cbdd759c78bd28951647579a213d49ab418fb9db2e37584c28964a292c0dd180c9f3f73e3a5d6c6de1f087da0a4a63d6aadc
6
+ metadata.gz: 37ddc5cd5672316032a45fe30e99ee1a29b8e17b83c770542fd7998c2bf4c3f6046acb374e3440ae4ea646c88437dc7cf065b8d6f40b6456d81d56fa2d8786f4
7
+ data.tar.gz: c3744960bc91b119af9fe51c52429662b6d7e13aee85c4d373efc579e11492df599ddd0fbd35e1a5dd107cd870c2937add208db43ce9d6a96a8068b82e27f1f8
data/lib/bfs/bucket/s3.rb CHANGED
@@ -23,11 +23,6 @@ module BFS
23
23
  # @option opts [Aws::S3::Client] :client custom client, uses default_client by default
24
24
  # @option opts [String] :encoding Custom encoding.
25
25
  def initialize(name, **opts)
26
- opts = opts.dup
27
- opts.keys.each do |key|
28
- val = opts.delete(key)
29
- opts[key.to_sym] = val unless val.nil?
30
- end
31
26
  super(**opts)
32
27
 
33
28
  @name = name
@@ -67,7 +62,7 @@ module BFS
67
62
  info = @client.head_object(**opts)
68
63
  raise BFS::FileNotFound, path unless info
69
64
 
70
- BFS::FileInfo.new(path, info.content_length, info.last_modified, info.content_type, norm_meta(info.metadata))
65
+ BFS::FileInfo.new(path: path, size: info.content_length, mtime: info.last_modified, content_type: info.content_type, metadata: norm_meta(info.metadata))
71
66
  rescue Aws::S3::Errors::NoSuchKey, Aws::S3::Errors::NoSuchBucket, Aws::S3::Errors::NotFound
72
67
  raise BFS::FileNotFound, path
73
68
  end
@@ -79,9 +74,9 @@ module BFS
79
74
  # @option opts [String] :acl custom ACL override
80
75
  # @option opts [String] :server_side_encryption SSE override
81
76
  # @option opts [String] :storage_class storage class override
82
- def create(path, **opts, &block)
77
+ def create(path, encoding: nil, perm: nil, **opts, &block)
83
78
  path = full_path(path)
84
- enc = opts.delete(:encoding) || @encoding
79
+ enc = encoding || @encoding
85
80
  opts = opts.merge(
86
81
  bucket: name,
87
82
  key: path,
@@ -90,7 +85,7 @@ module BFS
90
85
  opts[:server_side_encryption] ||= @sse if @sse
91
86
  opts[:storage_class] ||= @storage_class if @storage_class
92
87
 
93
- temp = BFS::TempWriter.new(path, encoding: enc) do |t|
88
+ temp = BFS::TempWriter.new(path, encoding: enc, perm: perm) do |t|
94
89
  File.open(t, encoding: enc) do |file|
95
90
  @client.put_object(opts.merge(body: file))
96
91
  end
@@ -108,10 +103,11 @@ module BFS
108
103
  # @param [String] path
109
104
  # @param [Hash] opts options
110
105
  # @option opts [String] :encoding Custom encoding.
111
- def open(path, **opts, &block)
106
+ # @option opts [String] :tempdir Custom temp dir.
107
+ def open(path, encoding: nil, tempdir: nil, **opts, &block)
112
108
  path = full_path(path)
113
- enc = opts.delete(:encoding) || @encoding
114
- temp = Tempfile.new(File.basename(path), encoding: enc)
109
+ enc = encoding || @encoding
110
+ temp = Tempfile.new(File.basename(path), tempdir, encoding: enc)
115
111
  temp.close
116
112
 
117
113
  opts = opts.merge(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bfs-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-11 00:00:00.000000000 Z
11
+ date: 2020-02-12 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: 0.6.1
33
+ version: 0.6.2
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: 0.6.1
40
+ version: 0.6.2
41
41
  description: https://github.com/bsm/bfs.rb
42
42
  email: dimitrij@blacksquaremedia.com
43
43
  executables: []
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.1.2
70
+ rubygems_version: 3.0.6
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: S3 bucket adapter for bfs