carrierwave-aliyun 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +8 -10
- data/README.md +3 -1
- data/lib/carrierwave/aliyun/version.rb +1 -1
- data/lib/carrierwave/storage/aliyun.rb +6 -6
- data/spec/aliyun_spec.rb +8 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7e1a032a15f971ac7d1557dbae299ad9076d140
|
4
|
+
data.tar.gz: 85fe40058d6305cadb67a3a1c60485ad70abf25f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3723c0a1664b2f323f07100a85fba1de96636e6542c4b3ddeb57996c56e16e55633a36676d0c13455500139236c33283c9313f8facea5d195443234da6bb61a4
|
7
|
+
data.tar.gz: 2e936b1cf3a2eded52064bb2382acb6800390ca09fbe6f6845c69396738215aa953e783ed7b2e8684c1d634399ad30a6191bd5d8fb2516a5c6fd325258e215ac
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
source "http://ruby.taobao.org"
|
2
|
-
gem "rake"
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
3
|
+
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem 'rake'
|
7
|
+
gem 'rails', '4.2.0'
|
8
|
+
gem 'sqlite3-ruby', :require => 'sqlite3'
|
9
|
+
gem 'mini_magick'
|
10
|
+
gem 'rspec'
|
data/README.md
CHANGED
@@ -10,6 +10,8 @@ This gem adds support for [Aliyun OSS](http://oss.aliyun.com) to [CarrierWave](h
|
|
10
10
|
gem install carrierwave-aliyun
|
11
11
|
```
|
12
12
|
|
13
|
+
> NOTE: 此 Gem 是一个 CarrierWave 的组件,你需要配合 CarrierWave 一起使用。
|
14
|
+
|
13
15
|
## Using Bundler
|
14
16
|
|
15
17
|
```ruby
|
@@ -19,7 +21,7 @@ gem 'carrierwave-aliyun'
|
|
19
21
|
|
20
22
|
## Configuration
|
21
23
|
|
22
|
-
创建这么个脚本 `config/
|
24
|
+
创建这么个脚本 `config/initializers/carrierwave.rb` 填入下面的代码,并修改对应的配置:
|
23
25
|
|
24
26
|
```ruby
|
25
27
|
CarrierWave.configure do |config|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
require 'carrierwave'
|
3
3
|
require 'digest/md5'
|
4
4
|
require 'openssl'
|
5
|
-
require "rest-client"
|
6
5
|
require 'uri'
|
6
|
+
require "rest-client"
|
7
7
|
|
8
8
|
module CarrierWave
|
9
9
|
module Storage
|
@@ -11,10 +11,10 @@ module CarrierWave
|
|
11
11
|
|
12
12
|
class Connection
|
13
13
|
def initialize(options={})
|
14
|
-
@aliyun_access_id
|
15
|
-
@aliyun_access_key
|
16
|
-
@aliyun_bucket
|
17
|
-
@aliyun_area
|
14
|
+
@aliyun_access_id = options[:aliyun_access_id]
|
15
|
+
@aliyun_access_key = options[:aliyun_access_key]
|
16
|
+
@aliyun_bucket = options[:aliyun_bucket]
|
17
|
+
@aliyun_area = options[:aliyun_area] || 'cn-hangzhou'
|
18
18
|
@aliyun_upload_host = options[:aliyun_upload_host]
|
19
19
|
|
20
20
|
# Host for upload
|
@@ -139,7 +139,7 @@ module CarrierWave
|
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
142
|
-
class File
|
142
|
+
class File < CarrierWave::SanitizedFile
|
143
143
|
def initialize(uploader, base, path)
|
144
144
|
@uploader = uploader
|
145
145
|
@path = path
|
data/spec/aliyun_spec.rb
CHANGED
@@ -40,4 +40,12 @@ describe "Aliyun" do
|
|
40
40
|
url = @connection.put("a/a.jpg",load_file("foo.jpg"))
|
41
41
|
url.should == "http://foo.bar.com/a/a.jpg"
|
42
42
|
end
|
43
|
+
|
44
|
+
describe 'File' do
|
45
|
+
it 'should have respond_to identifier' do
|
46
|
+
f = CarrierWave::Storage::Aliyun::File.new(nil, nil, nil)
|
47
|
+
f.should respond_to(:identifier)
|
48
|
+
f.should respond_to(:filename)
|
49
|
+
end
|
50
|
+
end
|
43
51
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-aliyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.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: 2015-
|
11
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.4.
|
85
|
+
rubygems_version: 2.4.7
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Aliyun OSS support for Carrierwave
|