Skip to content

Commit

Permalink
Merge pull request #31 from huacnlee/master
Browse files Browse the repository at this point in the history
Faraday 代替 rest-client, 精简代码
  • Loading branch information
huacnlee committed May 23, 2015
2 parents 6a230ec + 2148a68 commit 9b37265
Show file tree
Hide file tree
Showing 11 changed files with 211 additions and 246 deletions.
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
--colour
--format nested
19 changes: 19 additions & 0 deletions CHANGELOGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## 0.2.0

- 改用 Faraday 代替 rest-client,来发送 HTTP 请求;
- 精简代码;
- 移除 `upyun_bucket_domain` 配置信息,请用 `upyun_bucket_host` 代替;

## 0.1.8

- 修复 upyun_bucket_domain 选项处理错误;
- 修复不含 'http://' 前缀的值处理出错的问题;

## 0.1.7

- SSL Host 配置支持;
- Fix issue 16 并减少连接; #18

## 0.1.6

- 改进 Upyun 初始化,将少连接的过程;
14 changes: 6 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
source "http://ruby.taobao.org/"
source 'https://rubygems.org'

gemspec

group :test do
gem "rails", "~> 3.2.13"
gem 'sqlite3'
gem 'mini_magick'
gem 'rspec','~> 2.6.0'
end
gem "rake"
gem 'rails', '4.2.0'
gem 'sqlite3'
gem 'mini_magick'
gem 'rspec'
201 changes: 111 additions & 90 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,115 +1,136 @@
PATH
remote: .
specs:
carrierwave-upyun (0.1.6)
carrierwave-upyun (0.2.0)
carrierwave (>= 0.5.7)
rest-client (>= 1.6.7)
faraday (>= 0.8.0)

GEM
remote: http://ruby.taobao.org/
remote: https://rubygems.org/
specs:
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
actionmailer (4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.0)
actionview (= 4.2.0)
activesupport (= 4.2.0)
rack (~> 1.6.0)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
actionview (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
arel (3.0.2)
builder (3.0.4)
carrierwave (0.8.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.1)
activejob (4.2.0)
activesupport (= 4.2.0)
globalid (>= 0.3.0)
activemodel (4.2.0)
activesupport (= 4.2.0)
builder (~> 3.1)
activerecord (4.2.0)
activemodel (= 4.2.0)
activesupport (= 4.2.0)
arel (~> 6.0)
activesupport (4.2.0)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.0)
builder (3.2.2)
carrierwave (0.10.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
diff-lcs (1.1.3)
json (>= 1.7)
mime-types (>= 1.16)
diff-lcs (1.2.5)
erubis (2.7.0)
hike (1.2.2)
i18n (0.6.1)
journey (1.0.4)
json (1.7.7)
mail (2.5.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.23)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
globalid (0.3.5)
activesupport (>= 4.1.0)
i18n (0.7.0)
json (1.8.2)
loofah (2.0.1)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.5)
mini_magick (3.3)
subexec (~> 0.1.0)
multi_json (1.7.2)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
mini_portile (0.6.2)
minitest (5.6.1)
multipart-post (2.0.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
rack (1.6.0)
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
bundler (~> 1.0)
railties (= 3.2.13)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rails (4.2.0)
actionmailer (= 4.2.0)
actionpack (= 4.2.0)
actionview (= 4.2.0)
activejob (= 4.2.0)
activemodel (= 4.2.0)
activerecord (= 4.2.0)
activesupport (= 4.2.0)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.0)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2)
loofah (~> 2.0)
railties (4.2.0)
actionpack (= 4.2.0)
activesupport (= 4.2.0)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.6)
rdoc (3.12.2)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
thor (>= 0.18.1, < 2.0)
rake (0.9.2.2)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.3)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
sprockets (3.0.3)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.7)
sprockets-rails (2.2.4)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0)
sqlite3 (1.3.10)
subexec (0.1.0)
thor (0.18.1)
tilt (1.3.7)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.37)
thor (0.19.1)
thread_safe (0.3.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
carrierwave-upyun!
mini_magick
rails (~> 3.2.13)
rspec (~> 2.6.0)
rails (= 4.2.0)
rake
rspec
sqlite3
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# CarrierWave for [Upyun](http://upyun.com)
# CarrierWave for [UpYun (又拍云存储)](http://upyun.com)

This gem adds support for [Upyun.com](http://www.upyun.com) to [CarrierWave](https://github.com/jnicklas/carrierwave/)

## Installation

gem install carrierwave-upyun

## Or using Bundler, in `Gemfile`
## Installation

gem 'rest-client'
gem 'carrierwave-upyun'
```ruby
gem 'carrierwave'
gem 'carrierwave-upyun'
```

## Configuration

Expand Down
11 changes: 5 additions & 6 deletions carrierwave-upyun.gemspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- encoding: utf-8 -*-
# coding: utf-8
$:.push File.expand_path("../lib", __FILE__)

Gem::Specification.new do |s|
s.name = "carrierwave-upyun"
s.version = "0.1.8"
s.version = "0.2.0"
s.platform = Gem::Platform::RUBY
s.authors = ["Nowa Zhu"]
s.email = ["nowazhu@gmail.com"]
s.authors = ["Nowa Zhu", "Jason Lee"]
s.email = ["nowazhu@gmail.com", "huacnlee@gmail.com"]
s.homepage = "https://github.com/nowa/carrierwave-upyun"
s.summary = %q{UpYun Storage support for CarrierWave}
s.description = %q{UpYun Storage support for CarrierWave}
Expand All @@ -16,6 +16,5 @@ Gem::Specification.new do |s|
s.require_paths = ["lib"]

s.add_dependency "carrierwave", [">= 0.5.7"]
s.add_dependency "rest-client", [">= 1.6.7"]
s.add_development_dependency "rspec", ["~> 2.6"]
s.add_dependency "faraday", [">= 0.8.0"]
end
3 changes: 2 additions & 1 deletion lib/carrierwave-upyun.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require "carrierwave/storage/upyun"
require "carrierwave/upyun/configuration"

CarrierWave.configure do |config|
config.storage_engines.merge!({:upyun => "CarrierWave::Storage::UpYun"})
config.storage_engines.merge!({upyun: "CarrierWave::Storage::UpYun"})
end

CarrierWave::Uploader::Base.send(:include, CarrierWave::UpYun::Configuration)
Loading

0 comments on commit 9b37265

Please sign in to comment.