carrierwave-upyun 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{CHANGELOGS.md → CHANGELOG.md} +5 -1
- data/README.md +1 -2
- metadata +75 -19
- data/.gitignore +0 -3
- data/.rspec +0 -1
- data/Gemfile +0 -8
- data/Gemfile.lock +0 -136
- data/carrierwave-upyun.gemspec +0 -20
- data/spec/foo.gif +0 -0
- data/spec/foo.jpg +0 -0
- data/spec/spec_helper.rb +0 -35
- data/spec/upload_spec.rb +0 -78
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55e609d0b0ef057e2fd07f28447fe63c4e6f8dce
|
4
|
+
data.tar.gz: 6661c00af66616dfbd560059b8008f9a8dd3ef7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1766433175d28dae3b9c5050d8d29a362d4339b29d4b0344daa2326cd0515a787d69f9de13027a56665230487f515e0439e6303e0aed50076ff0b472b43f0e8f
|
7
|
+
data.tar.gz: 792513795c24d0ac738614336065a003dc13a35af912b4d8f6a85710dd3ca864114e2918995a758bd186f1600a8e202d0d00702c00ad4f75f908d1cc5d835c0b
|
data/README.md
CHANGED
@@ -3,8 +3,7 @@
|
|
3
3
|
This gem adds support for [upyun.com](http://www.upyun.com) to [CarrierWave](https://github.com/jnicklas/carrierwave/)
|
4
4
|
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/carrierwave-upyun.svg)](https://rubygems.org/gems/carrierwave-upyun) [![Build Status](https://travis-ci.org/nowa/carrierwave-upyun.svg?branch=master)](https://travis-ci.org/nowa/carrierwave-upyun) [![Code Climate](https://codeclimate.com/github/nowa/carrierwave-upyun/badges/gpa.svg)](https://codeclimate.com/github/nowa/carrierwave-upyun)
|
8
7
|
|
9
8
|
## Installation
|
10
9
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-upyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nowa Zhu
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: carrierwave
|
@@ -39,6 +39,76 @@ dependencies:
|
|
39
39
|
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 0.8.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: sqlite3
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: activerecord
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: sqlite3-ruby
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: mini_magick
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rspec
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
42
112
|
description: UpYun Storage support for CarrierWave
|
43
113
|
email:
|
44
114
|
- nowazhu@gmail.com
|
@@ -47,20 +117,11 @@ executables: []
|
|
47
117
|
extensions: []
|
48
118
|
extra_rdoc_files: []
|
49
119
|
files:
|
50
|
-
-
|
51
|
-
- ".rspec"
|
52
|
-
- CHANGELOGS.md
|
53
|
-
- Gemfile
|
54
|
-
- Gemfile.lock
|
120
|
+
- CHANGELOG.md
|
55
121
|
- README.md
|
56
|
-
- carrierwave-upyun.gemspec
|
57
122
|
- lib/carrierwave-upyun.rb
|
58
123
|
- lib/carrierwave/storage/upyun.rb
|
59
124
|
- lib/carrierwave/upyun/configuration.rb
|
60
|
-
- spec/foo.gif
|
61
|
-
- spec/foo.jpg
|
62
|
-
- spec/spec_helper.rb
|
63
|
-
- spec/upload_spec.rb
|
64
125
|
homepage: https://github.com/nowa/carrierwave-upyun
|
65
126
|
licenses: []
|
66
127
|
metadata: {}
|
@@ -80,13 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
141
|
version: '0'
|
81
142
|
requirements: []
|
82
143
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.5.2
|
84
145
|
signing_key:
|
85
146
|
specification_version: 4
|
86
147
|
summary: UpYun Storage support for CarrierWave
|
87
|
-
test_files:
|
88
|
-
- spec/foo.gif
|
89
|
-
- spec/foo.jpg
|
90
|
-
- spec/spec_helper.rb
|
91
|
-
- spec/upload_spec.rb
|
92
|
-
has_rdoc:
|
148
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,136 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
carrierwave-upyun (0.2.0)
|
5
|
-
carrierwave (>= 0.5.7)
|
6
|
-
faraday (>= 0.8.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
actionmailer (4.2.0)
|
12
|
-
actionpack (= 4.2.0)
|
13
|
-
actionview (= 4.2.0)
|
14
|
-
activejob (= 4.2.0)
|
15
|
-
mail (~> 2.5, >= 2.5.4)
|
16
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
17
|
-
actionpack (4.2.0)
|
18
|
-
actionview (= 4.2.0)
|
19
|
-
activesupport (= 4.2.0)
|
20
|
-
rack (~> 1.6.0)
|
21
|
-
rack-test (~> 0.6.2)
|
22
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
23
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
24
|
-
actionview (4.2.0)
|
25
|
-
activesupport (= 4.2.0)
|
26
|
-
builder (~> 3.1)
|
27
|
-
erubis (~> 2.7.0)
|
28
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
29
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
30
|
-
activejob (4.2.0)
|
31
|
-
activesupport (= 4.2.0)
|
32
|
-
globalid (>= 0.3.0)
|
33
|
-
activemodel (4.2.0)
|
34
|
-
activesupport (= 4.2.0)
|
35
|
-
builder (~> 3.1)
|
36
|
-
activerecord (4.2.0)
|
37
|
-
activemodel (= 4.2.0)
|
38
|
-
activesupport (= 4.2.0)
|
39
|
-
arel (~> 6.0)
|
40
|
-
activesupport (4.2.0)
|
41
|
-
i18n (~> 0.7)
|
42
|
-
json (~> 1.7, >= 1.7.7)
|
43
|
-
minitest (~> 5.1)
|
44
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
45
|
-
tzinfo (~> 1.1)
|
46
|
-
arel (6.0.0)
|
47
|
-
builder (3.2.2)
|
48
|
-
carrierwave (0.10.0)
|
49
|
-
activemodel (>= 3.2.0)
|
50
|
-
activesupport (>= 3.2.0)
|
51
|
-
json (>= 1.7)
|
52
|
-
mime-types (>= 1.16)
|
53
|
-
diff-lcs (1.2.5)
|
54
|
-
erubis (2.7.0)
|
55
|
-
faraday (0.9.1)
|
56
|
-
multipart-post (>= 1.2, < 3)
|
57
|
-
globalid (0.3.5)
|
58
|
-
activesupport (>= 4.1.0)
|
59
|
-
i18n (0.7.0)
|
60
|
-
json (1.8.2)
|
61
|
-
loofah (2.0.1)
|
62
|
-
nokogiri (>= 1.5.9)
|
63
|
-
mail (2.6.3)
|
64
|
-
mime-types (>= 1.16, < 3)
|
65
|
-
mime-types (2.5)
|
66
|
-
mini_magick (3.3)
|
67
|
-
subexec (~> 0.1.0)
|
68
|
-
mini_portile (0.6.2)
|
69
|
-
minitest (5.6.1)
|
70
|
-
multipart-post (2.0.0)
|
71
|
-
nokogiri (1.6.6.2)
|
72
|
-
mini_portile (~> 0.6.0)
|
73
|
-
rack (1.6.0)
|
74
|
-
rack-test (0.6.3)
|
75
|
-
rack (>= 1.0)
|
76
|
-
rails (4.2.0)
|
77
|
-
actionmailer (= 4.2.0)
|
78
|
-
actionpack (= 4.2.0)
|
79
|
-
actionview (= 4.2.0)
|
80
|
-
activejob (= 4.2.0)
|
81
|
-
activemodel (= 4.2.0)
|
82
|
-
activerecord (= 4.2.0)
|
83
|
-
activesupport (= 4.2.0)
|
84
|
-
bundler (>= 1.3.0, < 2.0)
|
85
|
-
railties (= 4.2.0)
|
86
|
-
sprockets-rails
|
87
|
-
rails-deprecated_sanitizer (1.0.3)
|
88
|
-
activesupport (>= 4.2.0.alpha)
|
89
|
-
rails-dom-testing (1.0.6)
|
90
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
91
|
-
nokogiri (~> 1.6.0)
|
92
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
93
|
-
rails-html-sanitizer (1.0.2)
|
94
|
-
loofah (~> 2.0)
|
95
|
-
railties (4.2.0)
|
96
|
-
actionpack (= 4.2.0)
|
97
|
-
activesupport (= 4.2.0)
|
98
|
-
rake (>= 0.8.7)
|
99
|
-
thor (>= 0.18.1, < 2.0)
|
100
|
-
rake (0.9.2.2)
|
101
|
-
rspec (3.2.0)
|
102
|
-
rspec-core (~> 3.2.0)
|
103
|
-
rspec-expectations (~> 3.2.0)
|
104
|
-
rspec-mocks (~> 3.2.0)
|
105
|
-
rspec-core (3.2.3)
|
106
|
-
rspec-support (~> 3.2.0)
|
107
|
-
rspec-expectations (3.2.1)
|
108
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
109
|
-
rspec-support (~> 3.2.0)
|
110
|
-
rspec-mocks (3.2.1)
|
111
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
112
|
-
rspec-support (~> 3.2.0)
|
113
|
-
rspec-support (3.2.2)
|
114
|
-
sprockets (3.0.3)
|
115
|
-
rack (~> 1.0)
|
116
|
-
sprockets-rails (2.2.4)
|
117
|
-
actionpack (>= 3.0)
|
118
|
-
activesupport (>= 3.0)
|
119
|
-
sprockets (>= 2.8, < 4.0)
|
120
|
-
sqlite3 (1.3.10)
|
121
|
-
subexec (0.1.0)
|
122
|
-
thor (0.19.1)
|
123
|
-
thread_safe (0.3.5)
|
124
|
-
tzinfo (1.2.2)
|
125
|
-
thread_safe (~> 0.1)
|
126
|
-
|
127
|
-
PLATFORMS
|
128
|
-
ruby
|
129
|
-
|
130
|
-
DEPENDENCIES
|
131
|
-
carrierwave-upyun!
|
132
|
-
mini_magick
|
133
|
-
rails (= 4.2.0)
|
134
|
-
rake
|
135
|
-
rspec
|
136
|
-
sqlite3
|
data/carrierwave-upyun.gemspec
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = "carrierwave-upyun"
|
6
|
-
s.version = "0.2.1"
|
7
|
-
s.platform = Gem::Platform::RUBY
|
8
|
-
s.authors = ["Nowa Zhu", "Jason Lee"]
|
9
|
-
s.email = ["nowazhu@gmail.com", "huacnlee@gmail.com"]
|
10
|
-
s.homepage = "https://github.com/nowa/carrierwave-upyun"
|
11
|
-
s.summary = %q{UpYun Storage support for CarrierWave}
|
12
|
-
s.description = %q{UpYun Storage support for CarrierWave}
|
13
|
-
s.files = `git ls-files`.split("\n")
|
14
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
|
18
|
-
s.add_dependency "carrierwave", [">= 0.5.7"]
|
19
|
-
s.add_dependency "faraday", [">= 0.8.0"]
|
20
|
-
end
|
data/spec/foo.gif
DELETED
Binary file
|
data/spec/foo.jpg
DELETED
Binary file
|
data/spec/spec_helper.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rspec'
|
3
|
-
require 'rails'
|
4
|
-
require 'active_record'
|
5
|
-
require "carrierwave"
|
6
|
-
require 'carrierwave/orm/activerecord'
|
7
|
-
require 'carrierwave/processing/mini_magick'
|
8
|
-
|
9
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
10
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
11
|
-
|
12
|
-
require "carrierwave-upyun"
|
13
|
-
|
14
|
-
module Rails
|
15
|
-
class <<self
|
16
|
-
def root
|
17
|
-
[File.expand_path(__FILE__).split('/')[0..-3].join('/'),"spec"].join("/")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
ActiveRecord::Migration.verbose = false
|
23
|
-
|
24
|
-
# 测试的时候需要修改这个地方
|
25
|
-
CarrierWave.configure do |config|
|
26
|
-
config.storage = :upyun
|
27
|
-
config.upyun_username = ENV['upyun_username'] || "test"
|
28
|
-
config.upyun_password = ENV['upyun_password'] || '123123'
|
29
|
-
config.upyun_bucket = ENV['upyun_bucket'] || "ruby-china-files-dev"
|
30
|
-
config.upyun_bucket_host = ENV['upyun_bucket_host'] || "http://ruby-china-files-dev.b0.upaiyun.com"
|
31
|
-
end
|
32
|
-
|
33
|
-
def load_file(fname)
|
34
|
-
File.open([Rails.root,fname].join("/"))
|
35
|
-
end
|
data/spec/upload_spec.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
|
3
|
-
require "open-uri"
|
4
|
-
ActiveRecord::Base.raise_in_transactional_callbacks = true
|
5
|
-
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
|
6
|
-
|
7
|
-
describe "Upload" do
|
8
|
-
def setup_db
|
9
|
-
ActiveRecord::Schema.define(:version => 1) do
|
10
|
-
create_table :photos do |t|
|
11
|
-
t.column :image, :string
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def drop_db
|
17
|
-
ActiveRecord::Base.connection.tables.each do |table|
|
18
|
-
ActiveRecord::Base.connection.drop_table(table)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class PhotoUploader < CarrierWave::Uploader::Base
|
23
|
-
include CarrierWave::MiniMagick
|
24
|
-
|
25
|
-
version :small do
|
26
|
-
process :resize_to_fill => [120, 120]
|
27
|
-
end
|
28
|
-
|
29
|
-
def store_dir
|
30
|
-
"photos"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
class Photo < ActiveRecord::Base
|
35
|
-
mount_uploader :image, PhotoUploader
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
before :all do
|
40
|
-
setup_db
|
41
|
-
end
|
42
|
-
|
43
|
-
after :all do
|
44
|
-
drop_db
|
45
|
-
end
|
46
|
-
|
47
|
-
context "Upload Image" do
|
48
|
-
it "does upload image" do
|
49
|
-
f = load_file("foo.jpg")
|
50
|
-
puts Benchmark.measure {
|
51
|
-
@photo = Photo.create(image: f)
|
52
|
-
}
|
53
|
-
expect(@photo.errors.count).to eq 0
|
54
|
-
puts "Uploaded: #{@photo.image.url}"
|
55
|
-
|
56
|
-
res = open(@photo.image.url)
|
57
|
-
|
58
|
-
expect(res).not_to be_nil
|
59
|
-
expect(res.size).to eq f.size
|
60
|
-
|
61
|
-
small_res = open(@photo.image.small.url)
|
62
|
-
expect(small_res).not_to be_nil
|
63
|
-
|
64
|
-
f1 = load_file("foo.gif")
|
65
|
-
p1 = Photo.create(image: f1)
|
66
|
-
res = open(p1.image.url)
|
67
|
-
expect(res.size).to eq f1.size
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'CarrierWave::SanitizedFile' do
|
72
|
-
it 'should have responed_to identifier' do
|
73
|
-
f = CarrierWave::Storage::UpYun::File.new(nil, nil, nil)
|
74
|
-
expect(f).to respond_to(:identifier)
|
75
|
-
expect(f).to respond_to(:filename)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|