carrierwave-qiniu 0.0.3 → 0.0.4
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 +7 -0
- data/lib/carrierwave/storage/qiniu.rb +10 -5
- data/lib/carrierwave-qiniu/version.rb +1 -1
- metadata +11 -17
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 1fb6ebb601711adff2fdb9c44b76c3d62a4c5284
|
|
4
|
+
data.tar.gz: 9c263d0c9768a297ea7afdcc3234b1873196b77d
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 6c1f846aea22f2469daed303f30be0d6dd2cf465be81b0f59db30cc5e97449e2874f0cabfc7349d40a0c38f988b4188b943e82ea13405fc16ff35e8f0a049b37
|
|
7
|
+
data.tar.gz: 46948103e00aa7a62f1fe3f34af672a72128bbc3afda35c9e1c0496785d518830c1bf02a9a7d0a7d8992884c82b11aae82cca475cf547284f6f7734c321facc2
|
|
@@ -21,6 +21,8 @@ module CarrierWave
|
|
|
21
21
|
@qiniu_bucket = options[:qiniu_bucket]
|
|
22
22
|
@qiniu_access_key = options[:qiniu_access_key]
|
|
23
23
|
@qiniu_secret_key = options[:qiniu_secret_key]
|
|
24
|
+
@qiniu_block_size = options[:qiniu_block_size] || 1024*1024*4
|
|
25
|
+
@qiniu_protocal = options[:qiniu_protocal] || "http"
|
|
24
26
|
init
|
|
25
27
|
end
|
|
26
28
|
|
|
@@ -43,7 +45,7 @@ module CarrierWave
|
|
|
43
45
|
|
|
44
46
|
def delete(key)
|
|
45
47
|
begin
|
|
46
|
-
Qiniu::RS.delete(@qiniu_bucket, key)
|
|
48
|
+
::Qiniu::RS.delete(@qiniu_bucket, key)
|
|
47
49
|
rescue Exception => e
|
|
48
50
|
nil
|
|
49
51
|
end
|
|
@@ -51,7 +53,7 @@ module CarrierWave
|
|
|
51
53
|
|
|
52
54
|
def get_public_url(key)
|
|
53
55
|
if @qiniu_bucket_domain and @qiniu_bucket_domain.size > 0
|
|
54
|
-
"
|
|
56
|
+
"#{@qiniu_protocal}://#{@qiniu_bucket_domain}/#{key}"
|
|
55
57
|
else
|
|
56
58
|
res = ::Qiniu::RS.get(@qiniu_bucket, key)
|
|
57
59
|
if res
|
|
@@ -71,7 +73,8 @@ module CarrierWave
|
|
|
71
73
|
def init_qiniu_rs_connection
|
|
72
74
|
return if @qiniu_rs_connection_inited
|
|
73
75
|
::Qiniu::RS.establish_connection! :access_key => @qiniu_access_key,
|
|
74
|
-
:secret_key => @qiniu_secret_key
|
|
76
|
+
:secret_key => @qiniu_secret_key,
|
|
77
|
+
:block_size => @qiniu_block_size
|
|
75
78
|
|
|
76
79
|
@qiniu_rs_connection_inited = true
|
|
77
80
|
end
|
|
@@ -94,7 +97,7 @@ module CarrierWave
|
|
|
94
97
|
|
|
95
98
|
def url
|
|
96
99
|
if @uploader.qiniu_bucket_domain and @uploader.qiniu_bucket_domain.size > 0
|
|
97
|
-
"
|
|
100
|
+
"#{@uploader.qiniu_protocal}://#{@uploader.qiniu_bucket_domain}/#{@path}"
|
|
98
101
|
else
|
|
99
102
|
qiniu_connection.get_public_url(@path)
|
|
100
103
|
end
|
|
@@ -118,7 +121,9 @@ module CarrierWave
|
|
|
118
121
|
:qiniu_access_key => @uploader.qiniu_access_key,
|
|
119
122
|
:qiniu_secret_key => @uploader.qiniu_secret_key,
|
|
120
123
|
:qiniu_bucket => @uploader.qiniu_bucket,
|
|
121
|
-
:qiniu_bucket_domain => @uploader.qiniu_bucket_domain
|
|
124
|
+
:qiniu_bucket_domain => @uploader.qiniu_bucket_domain,
|
|
125
|
+
:qiniu_block_size => @uploader.qiniu_block_size,
|
|
126
|
+
:qiniu_protocal => @uploader.qiniu_protocal
|
|
122
127
|
}
|
|
123
128
|
@qiniu_connection ||= Connection.new config
|
|
124
129
|
end
|
metadata
CHANGED
|
@@ -1,48 +1,43 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: carrierwave-qiniu
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.0.4
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- huobazi
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2013-05-16 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: carrierwave
|
|
16
|
-
prerelease: false
|
|
17
15
|
requirement: !ruby/object:Gem::Requirement
|
|
18
16
|
requirements:
|
|
19
|
-
- -
|
|
17
|
+
- - '>='
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
19
|
version: '0'
|
|
22
|
-
none: false
|
|
23
20
|
type: :development
|
|
21
|
+
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
23
|
requirements:
|
|
26
|
-
- -
|
|
24
|
+
- - '>='
|
|
27
25
|
- !ruby/object:Gem::Version
|
|
28
26
|
version: '0'
|
|
29
|
-
none: false
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: qiniu-rs
|
|
32
|
-
prerelease: false
|
|
33
29
|
requirement: !ruby/object:Gem::Requirement
|
|
34
30
|
requirements:
|
|
35
31
|
- - ~>
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
33
|
version: 3.0.3
|
|
38
|
-
none: false
|
|
39
34
|
type: :development
|
|
35
|
+
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
37
|
requirements:
|
|
42
38
|
- - ~>
|
|
43
39
|
- !ruby/object:Gem::Version
|
|
44
40
|
version: 3.0.3
|
|
45
|
-
none: false
|
|
46
41
|
description: Qiniu Storage support for CarrierWave
|
|
47
42
|
email:
|
|
48
43
|
- huobazi@gmail.com
|
|
@@ -65,27 +60,26 @@ files:
|
|
|
65
60
|
- spec/upload_spec.rb
|
|
66
61
|
homepage: https://github.com/huobazi/carrierwave-qiniu
|
|
67
62
|
licenses: []
|
|
63
|
+
metadata: {}
|
|
68
64
|
post_install_message:
|
|
69
65
|
rdoc_options: []
|
|
70
66
|
require_paths:
|
|
71
67
|
- lib
|
|
72
68
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
69
|
requirements:
|
|
74
|
-
- -
|
|
70
|
+
- - '>='
|
|
75
71
|
- !ruby/object:Gem::Version
|
|
76
72
|
version: '0'
|
|
77
|
-
none: false
|
|
78
73
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
74
|
requirements:
|
|
80
|
-
- -
|
|
75
|
+
- - '>='
|
|
81
76
|
- !ruby/object:Gem::Version
|
|
82
77
|
version: '0'
|
|
83
|
-
none: false
|
|
84
78
|
requirements: []
|
|
85
79
|
rubyforge_project:
|
|
86
|
-
rubygems_version:
|
|
80
|
+
rubygems_version: 2.0.2
|
|
87
81
|
signing_key:
|
|
88
|
-
specification_version:
|
|
82
|
+
specification_version: 4
|
|
89
83
|
summary: Qiniu Storage support for CarrierWave
|
|
90
84
|
test_files:
|
|
91
85
|
- spec/ruby-china.png
|