defog 0.7.0 → 0.7.1
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.
- data/README.rdoc +4 -3
- data/lib/defog/fog_wrapper.rb +2 -0
- data/lib/defog/version.rb +1 -1
- data/spec/file_spec.rb +13 -5
- data/spec/handle_spec.rb +0 -1
- data/spec/proxy_spec.rb +9 -9
- metadata +58 -18
data/README.rdoc
CHANGED
@@ -219,14 +219,15 @@ Defog is currently known to work on:
|
|
219
219
|
* Fog Storage: :local, :AWS
|
220
220
|
|
221
221
|
The above storage providers are what the author uses. Please fork and add
|
222
|
-
others! (There's just a very small amount of provider-specific code in
|
223
|
-
file
|
224
|
-
|
222
|
+
others! (There's just a very small amount of provider-specific code in
|
223
|
+
one file, https://github.com/ronen/defog/blob/master/lib/defog/fog_wrapper.rb,
|
224
|
+
plus appropriate rspec examples.)
|
225
225
|
|
226
226
|
== History
|
227
227
|
|
228
228
|
Release Notes:
|
229
229
|
|
230
|
+
* 0.7.1 - Add key info to message if there's an exception when getting file
|
230
231
|
* 0.7.0 - Add :query option to Handle#url
|
231
232
|
* 0.6.1 - Bug fix (caching)
|
232
233
|
* 0.6.0 - Add logging
|
data/lib/defog/fog_wrapper.rb
CHANGED
data/lib/defog/version.rb
CHANGED
data/spec/file_spec.rb
CHANGED
@@ -11,7 +11,7 @@ shared_examples "get proxy" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should raise error if remote doesn't exist" do
|
14
|
-
expect { @proxy.file("nonesuch", @mode) }.
|
14
|
+
expect { @proxy.file("nonesuch", @mode) }.to raise_error(Defog::Error::NoCloudFile)
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should overwrite existing proxy if it's not valid " do
|
@@ -31,6 +31,14 @@ shared_examples "get proxy" do
|
|
31
31
|
should_not_log /Download/
|
32
32
|
handle.open(@mode)
|
33
33
|
end
|
34
|
+
|
35
|
+
it "should include key info in exception messages" do
|
36
|
+
create_remote("error me")
|
37
|
+
File.any_instance.should_receive(:write) { raise Encoding::UndefinedConversionError, "dummy" }
|
38
|
+
expect {
|
39
|
+
@proxy.file(key, "r")
|
40
|
+
}.to raise_error Encoding::UndefinedConversionError, /#{key}/
|
41
|
+
end
|
34
42
|
end
|
35
43
|
|
36
44
|
shared_examples "read" do
|
@@ -106,7 +114,7 @@ shared_examples "create" do
|
|
106
114
|
file.write("ignore me")
|
107
115
|
proxy_path.unlink
|
108
116
|
end
|
109
|
-
expect {remote_body}.
|
117
|
+
expect {remote_body}.to raise_error
|
110
118
|
end
|
111
119
|
|
112
120
|
it "should not create remote if :synchronize => false" do
|
@@ -114,7 +122,7 @@ shared_examples "create" do
|
|
114
122
|
file = @proxy.file(key, @mode)
|
115
123
|
create_proxy("ignore me")
|
116
124
|
file.close(:synchronize => false)
|
117
|
-
expect {remote_body}.
|
125
|
+
expect {remote_body}.to raise_error
|
118
126
|
end
|
119
127
|
|
120
128
|
it "should create remote asynchronously if :synchronize => async" do
|
@@ -122,7 +130,7 @@ shared_examples "create" do
|
|
122
130
|
file = @proxy.file(key, @mode)
|
123
131
|
create_proxy("upload me in thread")
|
124
132
|
Thread.should_receive(:new) { |&block|
|
125
|
-
expect {remote_body}.
|
133
|
+
expect {remote_body}.to raise_error
|
126
134
|
block.call
|
127
135
|
}
|
128
136
|
file.close(:synchronize => :async)
|
@@ -250,7 +258,7 @@ shared_examples "a proxy file" do |proxyargs|
|
|
250
258
|
end
|
251
259
|
|
252
260
|
it "should raise error on bad mode" do
|
253
|
-
expect { @proxy.file(key, "xyz") }.
|
261
|
+
expect { @proxy.file(key, "xyz") }.to raise_error(ArgumentError)
|
254
262
|
end
|
255
263
|
|
256
264
|
it "should have a nice to_s" do
|
data/spec/handle_spec.rb
CHANGED
@@ -123,7 +123,6 @@ describe Defog::Handle do
|
|
123
123
|
t = Time.now + 10*60
|
124
124
|
#Fog::Storage::AWS::File.any_instance.should_receive(:url).with(t, "response-content-disposition" => "attachment")
|
125
125
|
url = @proxy.file(key).url(:expiry => t, :query => {"response-content-disposition" => "attachment"})
|
126
|
-
puts url
|
127
126
|
url.should include "response-content-disposition=attachment"
|
128
127
|
end
|
129
128
|
|
data/spec/proxy_spec.rb
CHANGED
@@ -138,19 +138,19 @@ shared_examples "a proxy" do |args|
|
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should fail normally when trying to proxy a file that doesn't exist" do
|
141
|
-
expect { @proxy.file("nonesuch", "r") }.
|
141
|
+
expect { @proxy.file("nonesuch", "r") }.to raise_error(Defog::Error::NoCloudFile)
|
142
142
|
end
|
143
143
|
|
144
144
|
it "should raise an error trying to proxy a file larger than the cache" do
|
145
145
|
create_remote("x" * 101)
|
146
|
-
expect { @proxy.file(key, "r") }.
|
146
|
+
expect { @proxy.file(key, "r") }.to raise_error(Defog::Error::CacheFull)
|
147
147
|
proxy_path.should_not be_exist
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should not count existing proxy in total" do
|
151
151
|
create_proxy("y" * 70)
|
152
152
|
create_remote("x" * 70)
|
153
|
-
expect { @proxy.file(key, "r") do end }.
|
153
|
+
expect { @proxy.file(key, "r") do end }.to_not raise_error(Defog::Error::CacheFull)
|
154
154
|
proxy_path.should be_exist
|
155
155
|
proxy_path.read.should == remote_body
|
156
156
|
end
|
@@ -160,7 +160,7 @@ shared_examples "a proxy" do |args|
|
|
160
160
|
create_other_proxy("b", 30)
|
161
161
|
create_other_proxy("c", 40)
|
162
162
|
create_remote("x" * 80)
|
163
|
-
expect { @proxy.file(key, "r") do end }.
|
163
|
+
expect { @proxy.file(key, "r") do end }.to_not raise_error(Defog::Error::CacheFull)
|
164
164
|
proxy_path.should be_exist
|
165
165
|
other_proxy_path("a").should be_exist
|
166
166
|
other_proxy_path("b").should_not be_exist
|
@@ -171,7 +171,7 @@ shared_examples "a proxy" do |args|
|
|
171
171
|
create_other_proxy("a", 10)
|
172
172
|
create_other_proxy("b", 30)
|
173
173
|
create_other_proxy("c", 40)
|
174
|
-
expect { @proxy.file(key, "w", :size_hint => 80) do end }.
|
174
|
+
expect { @proxy.file(key, "w", :size_hint => 80) do end }.to_not raise_error(Defog::Error::CacheFull)
|
175
175
|
proxy_path.should be_exist
|
176
176
|
other_proxy_path("a").should be_exist
|
177
177
|
other_proxy_path("b").should_not be_exist
|
@@ -186,7 +186,7 @@ shared_examples "a proxy" do |args|
|
|
186
186
|
@proxy.file(other_key("R"), "r") do
|
187
187
|
@proxy.file(other_key("S"), "w") do
|
188
188
|
create_other_proxy("S", 30)
|
189
|
-
expect { @proxy.file(key, "r") do end }.
|
189
|
+
expect { @proxy.file(key, "r") do end }.to_not raise_error(Defog::Error::CacheFull)
|
190
190
|
proxy_path.should be_exist
|
191
191
|
other_proxy_path("R").should be_exist
|
192
192
|
other_proxy_path("S").should be_exist
|
@@ -201,7 +201,7 @@ shared_examples "a proxy" do |args|
|
|
201
201
|
create_remote("z" * 60)
|
202
202
|
@proxy.file(other_key("R"), "r") do end
|
203
203
|
other_proxy_path("R").should be_exist
|
204
|
-
expect { @proxy.file(key, "r") do end }.
|
204
|
+
expect { @proxy.file(key, "r") do end }.to_not raise_error(Defog::Error::CacheFull)
|
205
205
|
proxy_path.should be_exist
|
206
206
|
other_proxy_path("R").should_not be_exist
|
207
207
|
end
|
@@ -214,7 +214,7 @@ shared_examples "a proxy" do |args|
|
|
214
214
|
create_remote("z" * 50)
|
215
215
|
@proxy.file(other_key("R"), "r") do
|
216
216
|
@proxy.file(other_key("S"), "r") do
|
217
|
-
expect { @proxy.file(key, "r") do end }.
|
217
|
+
expect { @proxy.file(key, "r") do end }.to raise_error(Defog::Error::CacheFull)
|
218
218
|
proxy_path.should_not be_exist
|
219
219
|
other_proxy_path("a").should be_exist
|
220
220
|
other_proxy_path("b").should be_exist
|
@@ -300,7 +300,7 @@ describe Defog::Proxy do
|
|
300
300
|
end
|
301
301
|
|
302
302
|
it "should raise error on bad provider" do
|
303
|
-
expect { Defog::Proxy.new(:provider => :nonesuch) }.
|
303
|
+
expect { Defog::Proxy.new(:provider => :nonesuch) }.to raise_error(ArgumentError)
|
304
304
|
end
|
305
305
|
|
306
306
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: hash_keyword_args
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: fastandand
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: rake
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: rspec
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: simplecov
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: simplecov-gem-adapter
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ! '>='
|
@@ -87,7 +117,12 @@ dependencies:
|
|
87
117
|
version: '0'
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
91
126
|
description: Wrapper to fog gem, proxying access to cloud files as local files.
|
92
127
|
email:
|
93
128
|
- ronen@barzel.org
|
@@ -127,15 +162,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
162
|
- - ! '>='
|
128
163
|
- !ruby/object:Gem::Version
|
129
164
|
version: '0'
|
165
|
+
segments:
|
166
|
+
- 0
|
167
|
+
hash: -4067277694003183593
|
130
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
169
|
none: false
|
132
170
|
requirements:
|
133
171
|
- - ! '>='
|
134
172
|
- !ruby/object:Gem::Version
|
135
173
|
version: '0'
|
174
|
+
segments:
|
175
|
+
- 0
|
176
|
+
hash: -4067277694003183593
|
136
177
|
requirements: []
|
137
178
|
rubyforge_project:
|
138
|
-
rubygems_version: 1.8.
|
179
|
+
rubygems_version: 1.8.24
|
139
180
|
signing_key:
|
140
181
|
specification_version: 3
|
141
182
|
summary: Wrapper to fog gem, proxying access to cloud files as local files. Access
|
@@ -146,4 +187,3 @@ test_files:
|
|
146
187
|
- spec/proxy_spec.rb
|
147
188
|
- spec/spec_helper.rb
|
148
189
|
- spec/support/helpers.rb
|
149
|
-
has_rdoc:
|