carrierwave-qiniu 0.1.8.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -2
- data/carrierwave-qiniu.gemspec +1 -1
- data/lib/carrierwave-qiniu/version.rb +1 -1
- data/spec/spec_helper.rb +21 -2
- data/spec/upload_spec.rb +16 -4
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e43e7e5fdcf0da4e9de0d0925050ec9d7a459b27
|
4
|
+
data.tar.gz: e6453512b87881c5547619c17b6657c8ce54f1e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa856dc9e7a97f5c2c080c1170a9d8126cce7868052a58892313799bb50c7fd922d5e0402c8a066ebe3e71eaf7e4be72917a0413b9a0c2c6a93b8cfef9b7facc
|
7
|
+
data.tar.gz: b15d06236154333a3e1ae389412db9e0c7c1ce5d5bdc1040b6c1260968d494318c15e957905e056e5f156af23dc7da120f50bbb42cd42dcdf6c8bb548ac8747e
|
data/.rspec
ADDED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#source 'https://rubygems.org'
|
2
|
-
source '
|
2
|
+
source 'https://ruby.taobao.org'
|
3
3
|
|
4
4
|
# Specify your gem's dependencies in carrierwave-qiniu.gemspec
|
5
5
|
gemspec
|
6
6
|
|
7
7
|
group :test do
|
8
|
-
gem 'rails', '>=
|
8
|
+
gem 'rails', '>=4.2.5'
|
9
9
|
gem 'sqlite3', '>=1.3.6'
|
10
10
|
gem 'carrierwave', '>=0.6.2'
|
11
11
|
gem 'mini_magick', '>=3.4'
|
data/carrierwave-qiniu.gemspec
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require "rubygems"
|
3
|
-
require "rspec"
|
4
|
-
require "rspec/autorun"
|
5
3
|
require "rails"
|
6
4
|
require "active_record"
|
7
5
|
require "carrierwave"
|
8
6
|
require "carrierwave/orm/activerecord"
|
9
7
|
require 'dotenv'
|
8
|
+
require 'mini_magick'
|
10
9
|
|
11
10
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
12
11
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),"..","lib"))
|
13
12
|
|
14
13
|
require "carrierwave-qiniu"
|
15
14
|
|
15
|
+
|
16
16
|
module Rails
|
17
17
|
class <<self
|
18
18
|
def root
|
@@ -21,10 +21,23 @@ module Rails
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
|
25
|
+
the_gem = Gem::Specification.find_by_name("carrierwave")
|
26
|
+
the_gem_root = the_gem.gem_dir
|
27
|
+
the_gem_lib = the_gem_root + "/lib"
|
28
|
+
the_gem_locale = the_gem_lib + "/carrierwave/locale/en.yml"
|
29
|
+
I18n.load_path << the_gem_locale
|
30
|
+
|
31
|
+
|
24
32
|
Dotenv.load
|
25
33
|
|
26
34
|
ActiveRecord::Migration.verbose = false
|
27
35
|
|
36
|
+
if [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR] == [4, 2]
|
37
|
+
ActiveRecord::Base.raise_in_transactional_callbacks = true
|
38
|
+
end
|
39
|
+
|
40
|
+
|
28
41
|
# 测试的时候载入环境变量
|
29
42
|
# 或者在根目录下新建 `.env` 文件,包含 <key>=<value>
|
30
43
|
::CarrierWave.configure do |config|
|
@@ -42,3 +55,9 @@ end
|
|
42
55
|
def load_file(fname)
|
43
56
|
File.open([Rails.root,fname].join("/"))
|
44
57
|
end
|
58
|
+
|
59
|
+
|
60
|
+
RSpec.configure do |config|
|
61
|
+
|
62
|
+
end
|
63
|
+
|
data/spec/upload_spec.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# thanks for https://github.com/nowa/carrierwave-upyun/blob/master/spec/upload_spec.rb
|
3
|
-
|
4
3
|
require File.dirname(__FILE__) + '/spec_helper'
|
5
4
|
require "open-uri"
|
6
5
|
|
@@ -21,7 +20,15 @@ describe "CarrierWave Qiniu" do
|
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
23
|
+
require 'carrierwave/processing/mini_magick'
|
24
24
|
class PhotoUploader < CarrierWave::Uploader::Base
|
25
|
+
include CarrierWave::MiniMagick
|
26
|
+
|
27
|
+
self.qiniu_can_overwrite = true
|
28
|
+
|
29
|
+
version :thumb do
|
30
|
+
process :resize_to_fill => [200, 200]
|
31
|
+
end
|
25
32
|
|
26
33
|
def store_dir
|
27
34
|
"carrierwave-qiniu-spec"
|
@@ -56,7 +63,6 @@ describe "CarrierWave Qiniu" do
|
|
56
63
|
mount_uploader :image, PhotoUploader
|
57
64
|
end
|
58
65
|
|
59
|
-
|
60
66
|
before :all do
|
61
67
|
setup_db
|
62
68
|
end
|
@@ -71,15 +77,21 @@ describe "CarrierWave Qiniu" do
|
|
71
77
|
photo = Photo.new(:image => f)
|
72
78
|
photo.save
|
73
79
|
|
80
|
+
puts photo.errors.full_messages if photo.errors.count > 0
|
81
|
+
|
74
82
|
photo.errors.count.should == 0
|
75
83
|
|
76
|
-
puts ""
|
77
84
|
puts 'The image was uploaded to:'
|
78
85
|
puts photo.image.url
|
79
86
|
|
80
87
|
open(photo.image.url).should_not be_nil
|
81
88
|
|
82
|
-
|
89
|
+
|
90
|
+
puts "The thumb image:"
|
91
|
+
puts photo.image.url(:thumb)
|
92
|
+
|
93
|
+
open(photo.image.thumb.url).should_not be_nil
|
94
|
+
|
83
95
|
end
|
84
96
|
end
|
85
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carrierwave-qiniu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marble Wu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 6.
|
33
|
+
version: 6.5.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 6.
|
40
|
+
version: 6.5.1
|
41
41
|
description: Qiniu Storage support for CarrierWave
|
42
42
|
email:
|
43
43
|
- huobazi@gmail.com
|
@@ -46,6 +46,7 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- ".gitignore"
|
49
|
+
- ".rspec"
|
49
50
|
- CHANGELOG.md
|
50
51
|
- Gemfile
|
51
52
|
- LICENSE
|