carrierwave-aliyun-oss 0.4.4 → 0.4.5
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 +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/lib/carrierwave/aliyun/version.rb +1 -1
- data/lib/carrierwave/storage/aliyun.rb +6 -6
- data/spec/aliyun_spec.rb +8 -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: 1e944bbf10b763ffcef990f1300a43fa4a0a3675
|
4
|
+
data.tar.gz: bb657e7782d233b03610a74a48fdc2187a94d9ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e91ba61740efdb211001e24679ea84b68518f347ae61eaa571fc6d3928c7ec9ab0cc9779a1df2d1672f1db9613de720039d5dac1497204d06be43726d2897c9
|
7
|
+
data.tar.gz: 2efb5ec1f6c01193405d7e53f8371d08a15c43cd23ceb491c2a7e09fa0511e1b380931f542091b2755f78387430930f1730e4c45faf961391902decba66c5e8f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
carrierwave-aliyun (0.4.4)
|
4
|
+
carrierwave-aliyun-oss (0.4.4)
|
5
5
|
aliyun-sdk (>= 0.4.0)
|
6
6
|
carrierwave (>= 0.5.7)
|
7
7
|
|
@@ -144,7 +144,7 @@ PLATFORMS
|
|
144
144
|
ruby
|
145
145
|
|
146
146
|
DEPENDENCIES
|
147
|
-
carrierwave-aliyun!
|
147
|
+
carrierwave-aliyun-oss!
|
148
148
|
mini_magick
|
149
149
|
rails (= 4.2.0)
|
150
150
|
rake
|
data/README.md
CHANGED
@@ -45,11 +45,10 @@ module CarrierWave
|
|
45
45
|
# 读取文件
|
46
46
|
# params:
|
47
47
|
# - path - remote 存储路径
|
48
|
-
# returns:
|
49
|
-
|
50
|
-
def get(path)
|
48
|
+
# returns: Aliyun::OSS::Object
|
49
|
+
def get(path, &block)
|
51
50
|
path.sub!(PATH_PREFIX, '')
|
52
|
-
private_client.get_object(path){ |content| content }
|
51
|
+
private_client.get_object(path){ |content| yield content if block_given?}
|
53
52
|
end
|
54
53
|
|
55
54
|
# 删除 Remote 的文件
|
@@ -158,9 +157,10 @@ module CarrierWave
|
|
158
157
|
# [String] contents of the file
|
159
158
|
#
|
160
159
|
def read
|
161
|
-
|
160
|
+
body = ""
|
161
|
+
object = oss_connection.get(@path){|chunk| body = chunk}
|
162
162
|
@headers = object.headers
|
163
|
-
|
163
|
+
body
|
164
164
|
end
|
165
165
|
|
166
166
|
##
|
data/spec/aliyun_spec.rb
CHANGED
@@ -23,6 +23,14 @@ describe "Aliyun" do
|
|
23
23
|
expect(res.code).to eq "200"
|
24
24
|
end
|
25
25
|
|
26
|
+
it "should get" do
|
27
|
+
content = ""
|
28
|
+
obj = @connection.get("a/a.jpg"){|chunk| content = chunk}
|
29
|
+
expect(content.length).to be >0
|
30
|
+
expect(obj.size).to be >0
|
31
|
+
expect(obj.headers).not_to be_empty
|
32
|
+
end
|
33
|
+
|
26
34
|
it "should put with / prefix" do
|
27
35
|
url = @connection.put("/a/a.jpg",load_file("foo.jpg"))
|
28
36
|
res = Net::HTTP.get_response(URI.parse(url))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-aliyun-oss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|