remote_files 3.0.2 → 3.3.0
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 +5 -5
- data/lib/remote_files/file.rb +7 -3
- data/lib/remote_files/fog_store.rb +18 -5
- data/lib/remote_files/version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f2bdd40ed1be30e3649f6089e603134e8cbc4bf8445d8b355f769b4ce29c2b25
|
4
|
+
data.tar.gz: 9a4d13593c4022eff78130eaf61d61e83a6bd8cfaae164636dfd81fca95fd7d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 648b24549307387c950a8ef5f72b0df42f6274eb53889b8c207e0aaba40618bbe1d1bbb43192baf6b037d43c885d492739994ee204a4e65e041321c4640e5d92
|
7
|
+
data.tar.gz: 8ad800c0ddd17a85e4631d6b38e960287c278127b88ec349cb2df890e37442e3fba4239e1219b6b54d66b6cebaf328bb92571607a6e3fd9817e2ef0dbc0ee7c0
|
data/lib/remote_files/file.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module RemoteFiles
|
2
2
|
class File
|
3
|
-
attr_reader :content, :content_type, :identifier, :stored_in, :configuration
|
3
|
+
attr_reader :content, :content_type, :identifier, :stored_in, :configuration, :populate_stored_in
|
4
4
|
|
5
5
|
def initialize(identifier, options = {})
|
6
|
-
known_keys = [:identifier, :stored_in, :content_type, :configuration, :content]
|
6
|
+
known_keys = [:identifier, :stored_in, :content_type, :configuration, :content, :populate_stored_in]
|
7
7
|
known_keys.each do |key|
|
8
8
|
options[key] ||= options.delete(key.to_s)
|
9
9
|
end
|
@@ -14,6 +14,7 @@ module RemoteFiles
|
|
14
14
|
@content_type = options[:content_type]
|
15
15
|
@configuration = RemoteFiles::CONFIGURATIONS[(options[:configuration] || :default).to_sym]
|
16
16
|
@logger = options[:logger]
|
17
|
+
@populate_stored_in = options[:populate_stored_in]
|
17
18
|
@options = options
|
18
19
|
end
|
19
20
|
|
@@ -34,7 +35,8 @@ module RemoteFiles
|
|
34
35
|
:identifier => identifier,
|
35
36
|
:stored_in => stored_in,
|
36
37
|
:content_type => content_type,
|
37
|
-
:configuration => configuration.name
|
38
|
+
:configuration => configuration.name,
|
39
|
+
:populate_stored_in => populate_stored_in
|
38
40
|
)
|
39
41
|
end
|
40
42
|
|
@@ -79,6 +81,8 @@ module RemoteFiles
|
|
79
81
|
next unless file
|
80
82
|
@content = file.content
|
81
83
|
@content_type = file.content_type
|
84
|
+
# :populate_stored_in is a boolean
|
85
|
+
@stored_in = file.stored_in if @populate_stored_in
|
82
86
|
return true
|
83
87
|
rescue Error => e
|
84
88
|
end
|
@@ -48,16 +48,22 @@ module RemoteFiles
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def delete!(identifier)
|
51
|
-
|
51
|
+
if identifier.to_s.chomp.empty?
|
52
|
+
message = "Empty identifier is not supported"
|
53
|
+
raise RemoteFiles::Error, message
|
54
|
+
end
|
55
|
+
|
56
|
+
connection.delete_object(directory_name, identifier)
|
52
57
|
rescue Fog::Errors::NotFound, Excon::Errors::NotFound
|
53
58
|
raise NotFoundError, $!.message, $!.backtrace
|
54
59
|
end
|
55
60
|
|
56
61
|
def connection
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
opts = options.dup
|
63
|
+
opts.delete(:directory)
|
64
|
+
opts.delete(:public)
|
65
|
+
opts[:connection_options] ||= default_connection_options
|
66
|
+
@connection ||= Fog::Storage.new(opts)
|
61
67
|
end
|
62
68
|
|
63
69
|
def directory_name
|
@@ -70,6 +76,13 @@ module RemoteFiles
|
|
70
76
|
|
71
77
|
protected
|
72
78
|
|
79
|
+
def default_connection_options
|
80
|
+
{
|
81
|
+
retry_limit: 0,
|
82
|
+
retry_interval: 0
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
73
86
|
def aws_host
|
74
87
|
case options[:region]
|
75
88
|
when nil, 'us-east-1'
|
data/lib/remote_files/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remote_files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mick Staugaard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-aws
|
@@ -59,7 +59,7 @@ files:
|
|
59
59
|
- lib/remote_files/version.rb
|
60
60
|
homepage: https://github.com/zendesk/remote_files
|
61
61
|
licenses:
|
62
|
-
- Apache
|
62
|
+
- Apache-2.0
|
63
63
|
metadata: {}
|
64
64
|
post_install_message:
|
65
65
|
rdoc_options: []
|
@@ -76,8 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
|
80
|
-
rubygems_version: 2.5.1
|
79
|
+
rubygems_version: 3.0.3.1
|
81
80
|
signing_key:
|
82
81
|
specification_version: 4
|
83
82
|
summary: The purpose of the library is to implement a simple interface for uploading
|