tori 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/lib/tori/backend/chain.rb +2 -0
- data/lib/tori/backend/s3.rb +7 -7
- data/lib/tori/file.rb +5 -0
- data/lib/tori/version.rb +1 -1
- data/test/test_tori_backend_s3.rb +1 -0
- data/test/test_tori_file.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0860a5b2a95c5bd92c5064c468688493ae765511
|
4
|
+
data.tar.gz: 97a4aced93b66300b731705a45df60fbb1b1be1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f606846b2e54e652f5fbba5143e8823ad798cc20c8870b6cdcaaba1f68b8001d22535d9824d9e2d327d09c1f8a35a20c83c3abd5b5409595b1b105c750b9ddec
|
7
|
+
data.tar.gz: 10bf3e48938ae58055cdf189865502b18a4158c1d53a9059324b64a59a9335ab485e0cd8c772e93436bd47d8e03a25e9823a17913565d46ec644a00ffd980012
|
data/.travis.yml
CHANGED
data/lib/tori/backend/chain.rb
CHANGED
data/lib/tori/backend/s3.rb
CHANGED
@@ -97,19 +97,19 @@ module Tori
|
|
97
97
|
end
|
98
98
|
alias exists? exist?
|
99
99
|
|
100
|
-
def read(filename)
|
101
|
-
body(filename).read
|
100
|
+
def read(filename, **opts)
|
101
|
+
body(filename, **opts).read
|
102
102
|
end
|
103
103
|
|
104
|
-
def
|
105
|
-
|
104
|
+
def body(filename, **opts)
|
105
|
+
get(filename, **opts)[:body]
|
106
106
|
end
|
107
107
|
|
108
|
-
def
|
109
|
-
|
108
|
+
def get(filename, **opts)
|
109
|
+
get_object(key: filename, **opts)
|
110
110
|
end
|
111
111
|
|
112
|
-
def put(filename, body, opts
|
112
|
+
def put(filename, body, **opts)
|
113
113
|
put_object key: filename, body: body, **opts
|
114
114
|
end
|
115
115
|
|
data/lib/tori/file.rb
CHANGED
@@ -28,6 +28,7 @@ module Tori
|
|
28
28
|
end
|
29
29
|
alias to_s name
|
30
30
|
|
31
|
+
attr_reader :from
|
31
32
|
def from?
|
32
33
|
!@from.nil?
|
33
34
|
end
|
@@ -53,6 +54,10 @@ module Tori
|
|
53
54
|
@backend || Tori.config.backend
|
54
55
|
end
|
55
56
|
|
57
|
+
def backend=(new_backend)
|
58
|
+
@backend = new_backend
|
59
|
+
end
|
60
|
+
|
56
61
|
private
|
57
62
|
|
58
63
|
def respond_to_missing?(sym, include_private)
|
data/lib/tori/version.rb
CHANGED
data/test/test_tori_file.rb
CHANGED
@@ -42,6 +42,10 @@ class TestToriFile < Test::Unit::TestCase
|
|
42
42
|
assert { false == Tori::File.new("nothing_file").exist? }
|
43
43
|
end
|
44
44
|
|
45
|
+
test "#from" do
|
46
|
+
assert { __FILE__ == Tori::File.new(__FILE__, from: From.new).from }
|
47
|
+
end
|
48
|
+
|
45
49
|
test "#from?" do
|
46
50
|
assert { false == Tori::File.new(__FILE__).from? }
|
47
51
|
assert { true == Tori::File.new(__FILE__, from: From.new).from? }
|
@@ -53,6 +57,17 @@ class TestToriFile < Test::Unit::TestCase
|
|
53
57
|
assert { true == File.exist?("test/tmp/copy") }
|
54
58
|
end
|
55
59
|
|
60
|
+
test "backend" do
|
61
|
+
assert { Tori.config.backend == Tori::File.new(nil).backend }
|
62
|
+
end
|
63
|
+
|
64
|
+
test "backend=" do
|
65
|
+
o = Object.new
|
66
|
+
t = Tori::File.new(nil)
|
67
|
+
assert { o == (t.backend = (o)) }
|
68
|
+
assert { o == t.backend }
|
69
|
+
end
|
70
|
+
|
56
71
|
test "write with closed file" do
|
57
72
|
tori_file = nil
|
58
73
|
path = nil
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tori
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|