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
89fb0c2b
Commit
89fb0c2b
authored
Feb 05, 2015
by
LI Daobing
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3 from liubin/liubin/upgrade-ruby-sdk
upgrade to new version of Ruby SDK
parents
a6b0ab8d
fe80d4c5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
10 deletions
+16
-10
README.md
+6
-0
lib/paperclip-qiniu/version.rb
+1
-1
lib/paperclip/storage/qiniu.rb
+8
-8
paperclip-qiniu.gemspec
+1
-1
No files found.
README.md
View file @
89fb0c2b
...
...
@@ -15,6 +15,8 @@ example site: http://paperclip-qiniu-example.herokuapp.com/
```
ruby
gem
'paperclip'
gem
'paperclip-qiniu'
# or get the latest version
# gem 'paperclip-qiniu', :git => "git://github.com/lidaobing/paperclip-qiniu"
```
*
create
`config/initializers/paperclip.rb`
...
...
@@ -64,6 +66,10 @@ support options: `thumbnail`, `gravity`, `crop`, `quality`, `rotate`, `format`,
## CHANGELOG
### 0.1.1 (2015-01-06)
*
upgrade Ruby SDK from
`qiniu-rs`
to
`6.4.1`
### 0.1.0 (2012-09-06)
*
add view helper: qiniu_image_tag, qiniu_image_path
...
...
lib/paperclip-qiniu/version.rb
View file @
89fb0c2b
module
Paperclip
module
Qiniu
VERSION
=
"0.1.
0
"
VERSION
=
"0.1.
1
"
end
end
lib/paperclip/storage/qiniu.rb
View file @
89fb0c2b
...
...
@@ -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 @
89fb0c2b
...
...
@@ -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