bfs-gs 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bfs-gs.gemspec +1 -1
  3. data/lib/bfs/bucket/gs.rb +19 -19
  4. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be5e98f31d64019631ea9b0a2640680bbb62fcfca8f665d2f4469af641cf32c3
4
- data.tar.gz: dfe4b2550520ae8cdb3424b1195f270364a991c0897b203f8737bd70911152c7
3
+ metadata.gz: 9a2d8c79d6fb88844a374b8f776967c20fcd7477815e4868fb2cb0534886a142
4
+ data.tar.gz: 65c9d7dbeecc7be84d77423a6fdfc40848511809af145315b6bf21de3807a9d6
5
5
  SHA512:
6
- metadata.gz: e4718ac5bd08a18ce260d7bdfb061a4de1e77325bd9098cd3822d1ccee42b168bfc324ed88ab66251240fb23f1d1e902aa09726abd3bc2dfaa6dceeebec7d2c1
7
- data.tar.gz: 20dd5ac3740c4d6374c29e9177e60b6d17054562f1e8890200c2df0507f78fedc78e0028606cb9c54cac6b100ac44645418a37caaaf49951353c7d2b51050ffb
6
+ metadata.gz: 57b26012045b16b2dade58bd711c44dfd75cfede1bcba4a534386aab11ef2e44a9d3951e6f7f553594e7d0f3d0e44c05ee55d6243d632c1afe5f18e6eb2ac27e
7
+ data.tar.gz: 2e2eec782845273aebe39753d4424943b42519e70d39973ebd50969a5ddb4d320eca49fc70e241f37891deac5eb90ff8be50de19de7a3b654c1ff1758c61c922
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- spec/*`.split("\n")
17
17
  s.require_paths = ['lib']
18
- s.required_ruby_version = '>= 2.4.0'
18
+ s.required_ruby_version = '>= 2.5.0'
19
19
 
20
20
  s.add_dependency 'bfs', s.version
21
21
  s.add_dependency 'google-cloud-storage', '~> 1.18'
@@ -21,17 +21,17 @@ module BFS
21
21
  # @option opts [String] :acl set the default ACL.
22
22
  # @option opts [Google::Cloud::Storage] :client custom client.
23
23
  # @option opts [String] :encoding Custom encoding.
24
- def initialize(name, opts={})
24
+ def initialize(name, **opts)
25
25
  opts = opts.dup
26
26
  opts.keys.each do |key|
27
27
  val = opts.delete(key)
28
28
  opts[key.to_sym] = val unless val.nil?
29
29
  end
30
- super(opts)
30
+ super(**opts)
31
31
 
32
32
  @prefix = opts.delete(:prefix)
33
33
  acl = opts.delete(:acl)
34
- client = opts.delete(:client) || Google::Cloud::Storage.new(opts)
34
+ client = opts.delete(:client) || Google::Cloud::Storage.new(**opts)
35
35
 
36
36
  @name = name.to_s
37
37
  @bucket = client.bucket(@name)
@@ -39,13 +39,13 @@ module BFS
39
39
  end
40
40
 
41
41
  # Lists the contents of a bucket using a glob pattern
42
- def ls(pattern='**/*', opts={})
42
+ def ls(pattern = '**/*', **opts)
43
43
  prefix = pattern[%r{^[^\*\?\{\}\[\]]+/}]
44
44
  prefix = File.join(*[@prefix, prefix].compact) if @prefix
45
45
  opts = opts.merge(prefix: prefix) if prefix
46
46
 
47
47
  Enumerator.new do |y|
48
- @bucket.files(opts).all do |file|
48
+ @bucket.files(**opts).all do |file|
49
49
  name = trim_prefix(file.name)
50
50
  y << name if File.fnmatch?(pattern, name, File::FNM_PATHNAME)
51
51
  end
@@ -53,7 +53,7 @@ module BFS
53
53
  end
54
54
 
55
55
  # Info returns the object info
56
- def info(path, _opts={})
56
+ def info(path, **_opts)
57
57
  path = full_path(path)
58
58
  file = @bucket.file(path)
59
59
  raise BFS::FileNotFound, trim_prefix(path) unless file
@@ -63,13 +63,13 @@ module BFS
63
63
  end
64
64
 
65
65
  # Creates a new file and opens it for writing
66
- def create(path, opts={}, &block)
66
+ def create(path, **opts, &block)
67
67
  opts[:metadata] = norm_meta(opts[:metadata])
68
68
  path = full_path(path)
69
69
  enc = opts.delete(:encoding) || @encoding
70
70
  temp = BFS::TempWriter.new(path, encoding: enc) do |t|
71
71
  File.open(t, encoding: enc) do |file|
72
- @bucket.create_file(file, path, opts)
72
+ @bucket.create_file(file, path, **opts)
73
73
  end
74
74
  end
75
75
  return temp unless block
@@ -82,7 +82,7 @@ module BFS
82
82
  end
83
83
 
84
84
  # Opens an existing file for reading
85
- def open(path, opts={}, &block)
85
+ def open(path, **opts, &block)
86
86
  path = full_path(path)
87
87
  enc = opts.delete(:encoding) || @encoding
88
88
  file = @bucket.file(path)
@@ -96,19 +96,19 @@ module BFS
96
96
  end
97
97
 
98
98
  # Deletes a file.
99
- def rm(path, opts={})
99
+ def rm(path, **opts)
100
100
  path = full_path(path)
101
101
  file = @bucket.file(path)
102
- file&.delete(opts)
102
+ file&.delete(**opts)
103
103
  end
104
104
 
105
105
  # Copies a file.
106
- def cp(src, dst, opts={})
106
+ def cp(src, dst, **opts)
107
107
  src = full_path(src)
108
108
  file = @bucket.file(src)
109
109
  raise BFS::FileNotFound, trim_prefix(src) unless file
110
110
 
111
- file.copy(full_path(dst), opts)
111
+ file.copy(full_path(dst), **opts)
112
112
  end
113
113
  end
114
114
  end
@@ -120,10 +120,10 @@ BFS.register('gs') do |url|
120
120
  prefix = nil if prefix.empty?
121
121
 
122
122
  BFS::Bucket::GS.new url.host,
123
- prefix: prefix,
124
- project_id: params.key?('project_id') ? params['project_id'].first : nil,
125
- credentials: params.key?('credentials') ? params['credentials'].first : nil,
126
- acl: params.key?('acl') ? params['acl'].first : nil,
127
- timeout: params.key?('timeout') ? params['timeout'].first.to_i : nil,
128
- retries: params.key?('retries') ? params['retries'].first.to_i : nil
123
+ prefix: prefix,
124
+ project_id: params.key?('project_id') ? params['project_id'].first : nil,
125
+ credentials: params.key?('credentials') ? params['credentials'].first : nil,
126
+ acl: params.key?('acl') ? params['acl'].first : nil,
127
+ timeout: params.key?('timeout') ? params['timeout'].first.to_i : nil,
128
+ retries: params.key?('retries') ? params['retries'].first.to_i : nil
129
129
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bfs-gs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-19 00:00:00.000000000 Z
11
+ date: 2020-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bfs
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.6.0
19
+ version: 0.6.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.6.0
26
+ version: 0.6.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: google-cloud-storage
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -60,14 +60,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 2.4.0
63
+ version: 2.5.0
64
64
  required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.0.6
70
+ rubygems_version: 3.1.2
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: GS bucket adapter for bfs