Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip-qiniu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip-qiniu
Commits
665e8850
Commit
665e8850
authored
Jan 06, 2015
by
liubin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upgrade to new version of Ruby SDK
parent
b5005154
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
lib/paperclip/storage/qiniu.rb
+8
-8
paperclip-qiniu.gemspec
+1
-1
No files found.
lib/paperclip/storage/qiniu.rb
View file @
665e8850
...
...
@@ -5,9 +5,9 @@ module Paperclip
module
Qiniu
def
self
.
extended
base
begin
require
'qiniu
-rs
'
require
'qiniu'
rescue
LoadError
=>
e
e
.
message
<<
" (You may need to install the qiniu
-rs
gem)"
e
.
message
<<
" (You may need to install the qiniu gem)"
raise
e
end
unless
defined?
(
::
Qiniu
)
...
...
@@ -25,7 +25,7 @@ module Paperclip
def
exists?
(
style
=
default_style
)
init
!!::
Qiniu
::
RS
.
stat
(
bucket
,
path
(
style
))
!!::
Qiniu
.
stat
(
bucket
,
path
(
style
))
end
def
flush_writes
...
...
@@ -48,7 +48,7 @@ module Paperclip
def
flush_deletes
init
for
path
in
@queued_for_delete
do
::
Qiniu
::
RS
.
delete
(
bucket
,
path
)
::
Qiniu
.
delete
(
bucket
,
path
)
end
@queued_for_delete
=
[]
end
...
...
@@ -58,7 +58,7 @@ module Paperclip
if
@options
[
:qiniu_host
]
"
#{
dynamic_fog_host_for_style
(
style
)
}
/
#{
path
(
style
)
}
"
else
res
=
::
Qiniu
::
RS
.
get
(
bucket
,
path
(
style
))
res
=
::
Qiniu
.
get
(
bucket
,
path
(
style
))
if
res
res
[
"url"
]
else
...
...
@@ -71,19 +71,19 @@ module Paperclip
def
init
return
if
@inited
::
Qiniu
::
RS
.
establish_connection!
@options
[
:qiniu_credentials
]
::
Qiniu
.
establish_connection!
@options
[
:qiniu_credentials
]
inited
=
true
end
def
upload
(
file
,
path
)
upload_token
=
::
Qiniu
::
RS
.
generate_upload_token
:scope
=>
bucket
upload_token
=
::
Qiniu
.
generate_upload_token
:scope
=>
bucket
opts
=
{
:uptoken
=>
upload_token
,
:file
=>
file
.
path
,
:key
=>
path
,
:bucket
=>
bucket
,
:mime_type
=>
file
.
content_type
,
:enable_crc32_check
=>
true
}
unless
::
Qiniu
::
RS
.
upload_file
(
opts
)
unless
::
Qiniu
.
upload_file
(
opts
)
raise
Paperclip
::
Qiniu
::
UploadFailed
end
end
...
...
paperclip-qiniu.gemspec
View file @
665e8850
...
...
@@ -15,6 +15,6 @@ Gem::Specification.new do |gem|
gem
.
require_paths
=
[
"lib"
]
gem
.
version
=
Paperclip
::
Qiniu
::
VERSION
gem
.
add_dependency
'
paperclip
'
gem
.
add_dependency
'
qiniu
-rs
'
,
'~> 3.0
'
gem
.
add_dependency
'
qiniu
'
,
'~> 6.4.1
'
gem
.
add_development_dependency
'
rspec
'
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment