remote_files 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/remote_files/abstract_store.rb +4 -0
- data/lib/remote_files/configuration.rb +17 -4
- data/lib/remote_files/file.rb +4 -0
- data/lib/remote_files/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bdd6a2996936339581664a79c8258c779f3b8f5
|
4
|
+
data.tar.gz: 71736655623982c8fa949a8a3b4a9b0ac8ecf151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5fa60188f842e9f88acee6708dd2e445e93a1fd1529d29137c3d229b0ce7a41e4b178d437074e842c94e90408022fbb932f3a031b38aae317c61f659dd15126
|
7
|
+
data.tar.gz: e98f60b4c50a47a7173f7de996708d29bba301ba881950a06f30930268a7ab9f891090b1be50a4b483d36bb61990bf73e8e01c7e308377efd4679fb02fad3230
|
@@ -54,6 +54,8 @@ module RemoteFiles
|
|
54
54
|
store = (options[:class] || FogStore).new(store_identifier)
|
55
55
|
block.call(store) if block_given?
|
56
56
|
|
57
|
+
store[:read_only] = options[:read_only] if options.key?(:read_only)
|
58
|
+
|
57
59
|
if options[:primary]
|
58
60
|
@stores.unshift(store)
|
59
61
|
else
|
@@ -69,9 +71,18 @@ module RemoteFiles
|
|
69
71
|
|
70
72
|
def stores
|
71
73
|
raise "You need to configure add stores to the #{name} RemoteFiles configuration" unless configured?
|
74
|
+
|
72
75
|
@stores
|
73
76
|
end
|
74
77
|
|
78
|
+
def read_only_stores
|
79
|
+
stores.select {|s| s.read_only?}
|
80
|
+
end
|
81
|
+
|
82
|
+
def read_write_stores
|
83
|
+
stores.reject {|s| s.read_only?}
|
84
|
+
end
|
85
|
+
|
75
86
|
def lookup_store(store_identifier)
|
76
87
|
@stores_map[store_identifier.to_sym]
|
77
88
|
end
|
@@ -85,7 +96,7 @@ module RemoteFiles
|
|
85
96
|
|
86
97
|
exception = nil
|
87
98
|
|
88
|
-
|
99
|
+
read_write_stores.each do |store|
|
89
100
|
begin
|
90
101
|
stored = store.store!(file)
|
91
102
|
file.stored_in << store.identifier
|
@@ -115,8 +126,8 @@ module RemoteFiles
|
|
115
126
|
|
116
127
|
def delete_now!(file)
|
117
128
|
exceptions = []
|
118
|
-
file.
|
119
|
-
|
129
|
+
stores = file.read_write_stores
|
130
|
+
stores.each do |store|
|
120
131
|
begin
|
121
132
|
store.delete!(file.identifier)
|
122
133
|
rescue NotFoundError => e
|
@@ -124,7 +135,7 @@ module RemoteFiles
|
|
124
135
|
end
|
125
136
|
end
|
126
137
|
|
127
|
-
if exceptions.size ==
|
138
|
+
if exceptions.size == stores.size # they all failed
|
128
139
|
raise exceptions.first
|
129
140
|
end
|
130
141
|
|
@@ -133,6 +144,8 @@ module RemoteFiles
|
|
133
144
|
|
134
145
|
def synchronize!(file)
|
135
146
|
file.missing_stores.each do |store|
|
147
|
+
next if store.read_only?
|
148
|
+
|
136
149
|
store.store!(file)
|
137
150
|
file.stored_in << store.identifier
|
138
151
|
end
|
data/lib/remote_files/file.rb
CHANGED
data/lib/remote_files/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remote_files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mick Staugaard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.15'
|
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
26
|
version: '1.15'
|
27
27
|
description: A library for uploading files to multiple remote storage backends like
|
@@ -53,12 +53,12 @@ require_paths:
|
|
53
53
|
- lib
|
54
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
@@ -70,3 +70,4 @@ summary: The purpose of the library is to implement a simple interface for uploa
|
|
70
70
|
files to multiple backends and to keep the backends in sync, so that your app will
|
71
71
|
keep working when one backend is down.
|
72
72
|
test_files: []
|
73
|
+
has_rdoc:
|