From 9d4316650ddcf6ea3dc26b67384fdf09bfabcdfa Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Tue, 17 Mar 2015 13:38:54 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=92=88=E5=AF=B9=20rails=203.0=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=20gemfile=20=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 3 +++ Gemfile | 4 ++-- Gemfile.lock | 37 ++++++++++++++++++++++--------------- Gemfile_for_rails3 | 4 ++++ qiniu_for_rails3.gemspec | 29 +++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 17 deletions(-) create mode 100755 Gemfile_for_rails3 create mode 100755 qiniu_for_rails3.gemspec diff --git a/.travis.yml b/.travis.yml index 06fa124..12fa02e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,6 @@ rvm: before_script: - export QINIU_ACCESS_KEY=QWYn5TFQsLLU1pL5MFEmX3s5DmHdUThav9WyOWOm - export QINIU_SECRET_KEY=Bxckh6FA-Fbs9Yt3i3cbKVK22UPBmAOHJcL95pGz +gemfile: + - Gemfile + - Gemfile_for_rails3 diff --git a/Gemfile b/Gemfile index ec8c558..801040b 100755 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' -# Specify your gem's dependencies in qiniu-s3.gemspec -gemspec +# Specify your gem's dependencies in qiniu.gemspec +gemspec :name => 'qiniu' # platforms :jruby do # gem "jruby-openssl" diff --git a/Gemfile.lock b/Gemfile.lock index b40bc46..57a60bf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,28 +3,35 @@ PATH specs: qiniu (6.4.1) json (~> 1.7) - mime-types (~> 2.4.3) + mime-types (~> 1.19) rest-client (~> 1.6) ruby-hmac (~> 0.4) GEM remote: https://rubygems.org/ specs: - diff-lcs (1.1.3) + diff-lcs (1.2.5) fakeweb (1.3.0) - json (1.8.1) - mime-types (1.23) - rake (10.0.3) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (2.12.0) - rspec-core (~> 2.12.0) - rspec-expectations (~> 2.12.0) - rspec-mocks (~> 2.12.0) - rspec-core (2.12.2) - rspec-expectations (2.12.1) - diff-lcs (~> 1.1.3) - rspec-mocks (2.12.2) + json (1.8.2) + mime-types (1.25.1) + netrc (0.10.3) + rake (10.4.2) + rest-client (1.7.3) + mime-types (>= 1.16, < 3.0) + netrc (~> 0.7) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-core (3.2.2) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.0) + 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) ruby-hmac (0.4.0) PLATFORMS diff --git a/Gemfile_for_rails3 b/Gemfile_for_rails3 new file mode 100755 index 0000000..5f3c753 --- /dev/null +++ b/Gemfile_for_rails3 @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in qiniu_for_rails3.gemspec +gemspec :name => 'qiniu_for_rails3' diff --git a/qiniu_for_rails3.gemspec b/qiniu_for_rails3.gemspec new file mode 100755 index 0000000..2c1db4e --- /dev/null +++ b/qiniu_for_rails3.gemspec @@ -0,0 +1,29 @@ +# -*- encoding: utf-8 -*- + +require File.expand_path('../lib/qiniu/version', __FILE__) + +Gem::Specification.new do |gem| + gem.authors = ["why404","BluntBlade"] + gem.email = ["sdk@qiniu.com"] + gem.description = %q{Qiniu Resource (Cloud) Storage SDK for Ruby. See: http://developer.qiniu.com/docs/v6/sdk/ruby-sdk.html} + gem.summary = %q{Qiniu Resource (Cloud) Storage SDK for Ruby} + gem.homepage = "https://github.com/qiniu/ruby-sdk" + + gem.files = `git ls-files`.split($\) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.name = "qiniu" + gem.require_paths = ["lib"] + gem.version = Qiniu::Version.to_s + gem.license = "MIT" + + # specify any dependencies here; for example: + gem.add_development_dependency "rake", ">= 0.9" + gem.add_development_dependency "rspec", ">= 2.11" + gem.add_development_dependency "fakeweb", "~> 1.3" + gem.add_runtime_dependency "json", "~> 1.7" + gem.add_runtime_dependency "rest-client", "~> 1.6" + gem.add_runtime_dependency "mime-types", "~> 1.19" + gem.add_runtime_dependency "ruby-hmac", "~> 0.4" + gem.add_runtime_dependency "jruby-openssl", "~> 0.7" if RUBY_PLATFORM == "java" +end From ed6525a35eda933ffeee7d41509a621671bff1c0 Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Tue, 17 Mar 2015 14:17:15 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=BF=87=E4=BD=8E?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84=20gem=20=E5=8C=85=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E5=AE=89=E5=85=A8=E9=97=AE=E9=A2=98=E3=80=82OSVDB-117?= =?UTF-8?q?461=20/=20CVE-2013-0269?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qiniu.gemspec | 4 ++-- qiniu_for_rails3.gemspec | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qiniu.gemspec b/qiniu.gemspec index d51f268..017cce8 100755 --- a/qiniu.gemspec +++ b/qiniu.gemspec @@ -21,8 +21,8 @@ Gem::Specification.new do |gem| gem.add_development_dependency "rake", ">= 0.9" gem.add_development_dependency "rspec", ">= 2.11" gem.add_development_dependency "fakeweb", "~> 1.3" - gem.add_runtime_dependency "json", "~> 1.7" - gem.add_runtime_dependency "rest-client", "~> 1.6" + gem.add_runtime_dependency "json", "~> 1.8" + gem.add_runtime_dependency "rest-client", "~> 1.7.3" gem.add_runtime_dependency "mime-types", "~> 2.4.3" gem.add_runtime_dependency "ruby-hmac", "~> 0.4" gem.add_runtime_dependency "jruby-openssl", "~> 0.7" if RUBY_PLATFORM == "java" diff --git a/qiniu_for_rails3.gemspec b/qiniu_for_rails3.gemspec index 2c1db4e..f5197fb 100755 --- a/qiniu_for_rails3.gemspec +++ b/qiniu_for_rails3.gemspec @@ -21,8 +21,8 @@ Gem::Specification.new do |gem| gem.add_development_dependency "rake", ">= 0.9" gem.add_development_dependency "rspec", ">= 2.11" gem.add_development_dependency "fakeweb", "~> 1.3" - gem.add_runtime_dependency "json", "~> 1.7" - gem.add_runtime_dependency "rest-client", "~> 1.6" + gem.add_runtime_dependency "json", "~> 1.8" + gem.add_runtime_dependency "rest-client", "~> 1.7.3" gem.add_runtime_dependency "mime-types", "~> 1.19" gem.add_runtime_dependency "ruby-hmac", "~> 0.4" gem.add_runtime_dependency "jruby-openssl", "~> 0.7" if RUBY_PLATFORM == "java" From fbea6bd019c895ab62e897ce5464d2be960dcad0 Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Tue, 17 Mar 2015 16:43:06 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=8D=87=E7=BA=A7=20Gemfile.lock=20?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 57a60bf..1397204 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,9 +2,9 @@ PATH remote: . specs: qiniu (6.4.1) - json (~> 1.7) + json (~> 1.8) mime-types (~> 1.19) - rest-client (~> 1.6) + rest-client (~> 1.7.3) ruby-hmac (~> 0.4) GEM From 4a86397b3d8d9ba387ccc171a8ccaf7afb5fe84e Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Tue, 17 Mar 2015 17:34:38 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=20gemspec=20=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rspec | 2 +- .travis.yml | 2 +- Gemfile_for_rails3 | 4 ---- rails3/Gemfile | 4 ++++ qiniu_for_rails3.gemspec => rails3/qiniu.gemspec | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) delete mode 100755 Gemfile_for_rails3 create mode 100755 rails3/Gemfile rename qiniu_for_rails3.gemspec => rails3/qiniu.gemspec (95%) diff --git a/.rspec b/.rspec index 84b61ea..e8290ec 100755 --- a/.rspec +++ b/.rspec @@ -1 +1 @@ ---colour -f nested +--colour -f documentation diff --git a/.travis.yml b/.travis.yml index 12fa02e..65e1576 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,4 @@ before_script: - export QINIU_SECRET_KEY=Bxckh6FA-Fbs9Yt3i3cbKVK22UPBmAOHJcL95pGz gemfile: - Gemfile - - Gemfile_for_rails3 + - rails3/Gemfile diff --git a/Gemfile_for_rails3 b/Gemfile_for_rails3 deleted file mode 100755 index 5f3c753..0000000 --- a/Gemfile_for_rails3 +++ /dev/null @@ -1,4 +0,0 @@ -source 'https://rubygems.org' - -# Specify your gem's dependencies in qiniu_for_rails3.gemspec -gemspec :name => 'qiniu_for_rails3' diff --git a/rails3/Gemfile b/rails3/Gemfile new file mode 100755 index 0000000..75d9508 --- /dev/null +++ b/rails3/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in rails3/qiniu.gemspec +gemspec :name => 'rails3/qiniu' diff --git a/qiniu_for_rails3.gemspec b/rails3/qiniu.gemspec similarity index 95% rename from qiniu_for_rails3.gemspec rename to rails3/qiniu.gemspec index f5197fb..b8efae2 100755 --- a/qiniu_for_rails3.gemspec +++ b/rails3/qiniu.gemspec @@ -1,6 +1,6 @@ # -*- encoding: utf-8 -*- -require File.expand_path('../lib/qiniu/version', __FILE__) +require File.expand_path('../../lib/qiniu/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["why404","BluntBlade"] From 813f57241d485b19cf1c898d2d21439a1498e14c Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Tue, 17 Mar 2015 17:46:45 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=9B=B8=E5=AF=B9?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rails3/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rails3/Gemfile b/rails3/Gemfile index 75d9508..a38bb87 100755 --- a/rails3/Gemfile +++ b/rails3/Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' # Specify your gem's dependencies in rails3/qiniu.gemspec -gemspec :name => 'rails3/qiniu' +gemspec :name => 'qiniu' From fb9eb56bc07992451b9e1af2b4438f828b006fea Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Tue, 17 Mar 2015 21:01:37 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20Pub=20=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=9B=B8=E5=85=B3=20SDK=20=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/qiniu/misc.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/qiniu/misc.rb b/lib/qiniu/misc.rb index 6359bfa..69509b6 100755 --- a/lib/qiniu/misc.rb +++ b/lib/qiniu/misc.rb @@ -1,5 +1,7 @@ # -*- encoding: utf-8 -*- +require 'qiniu/http' + module Qiniu module Misc class << self From adb20cd81587d63c071df80aab087731143f85e5 Mon Sep 17 00:00:00 2001 From: Liang Tao Date: Tue, 17 Mar 2015 21:58:34 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/qiniu/qiniu_spec.rb | 64 ++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 38 deletions(-) diff --git a/spec/qiniu/qiniu_spec.rb b/spec/qiniu/qiniu_spec.rb index 6f3bdbc..7615790 100755 --- a/spec/qiniu/qiniu_spec.rb +++ b/spec/qiniu/qiniu_spec.rb @@ -34,7 +34,7 @@ module Qiniu context ".buckets" do it "should works" do result = Qiniu.buckets - result.should_not be_false + expect(result).to_not be_empty puts result.inspect end end @@ -42,7 +42,7 @@ module Qiniu context ".set_protected" do it "should works" do result = Qiniu.set_protected(@bucket, 1) - result.should_not be_false + expect(result).to eq(true) puts result.inspect end end @@ -50,7 +50,7 @@ module Qiniu context ".set_separator" do it "should works" do result = Qiniu.set_separator(@bucket, "-") - result.should_not be_false + expect(result).to eq(true) puts result.inspect end end @@ -58,7 +58,7 @@ module Qiniu context ".set_style" do it "should works" do result = Qiniu.set_style(@bucket, "small.jpg", "imageMogr/auto-orient/thumbnail/!120x120r/gravity/center/crop/!120x120/quality/80") - result.should_not be_false + expect(result).to eq(true) puts result.inspect end end @@ -66,7 +66,7 @@ module Qiniu context ".unset_style" do it "should works" do result = Qiniu.unset_style(@bucket, "small.jpg") - result.should_not be_false + expect(result).to eq(true) puts result.inspect end end @@ -82,7 +82,7 @@ module Qiniu :enable_crc32_check => true } result = Qiniu.upload_file(upload_opts) - result.should_not be_false + expect(result).to_not be_empty puts result.inspect end @@ -132,24 +132,22 @@ module Qiniu File.unlink(localfile) if File.exists?(localfile) #expect puts result1.inspect - result1.should_not be_false - result1.should_not be_empty + expect(result1).to_not be_empty #stat result2 = Qiniu.stat(@bucket, key) puts result2.inspect - result2.should_not be_false + expect(result2).to_not be_empty #delete result3 = Qiniu.delete(@bucket, key) puts result3.inspect - result3.should_not be_false + expect(result3).to eq(true) end end context ".stat" do it "should works" do result = Qiniu.stat(@bucket, @key) - result.should_not be_false - result.should_not be_empty + expect(result).to_not be_empty puts result.inspect end end @@ -157,8 +155,7 @@ module Qiniu context ".get" do it "should works" do result = Qiniu.get(@bucket, @key, "qiniu_spec.rb", 10) - result.should_not be_false - result.should_not be_empty + expect(result).to_not be_empty puts result.inspect end end @@ -166,8 +163,7 @@ module Qiniu context ".download" do it "should works" do result = Qiniu.download(@bucket, @key, "rs_spec.rb", 10) - result.should_not be_false - result.should_not be_empty + expect(result).to_not be_empty puts result.inspect end end @@ -175,8 +171,7 @@ module Qiniu context ".batch" do it "should works" do result = Qiniu.batch("stat", @bucket, [@key]) - result.should_not be_false - result.should_not be_empty + expect(result).to_not be_empty puts result.inspect end end @@ -184,8 +179,7 @@ module Qiniu context ".batch_stat" do it "should works" do result = Qiniu.batch_stat(@bucket, [@key]) - result.should_not be_false - result.should_not be_empty + expect(result).to_not be_empty puts result.inspect end end @@ -193,8 +187,7 @@ module Qiniu context ".batch_get" do it "should works" do result = Qiniu.batch_get(@bucket, [@key]) - result.should_not be_false - result.should_not be_empty + expect(result).to_not be_empty puts result.inspect end end @@ -202,8 +195,7 @@ module Qiniu context ".batch_download" do it "should works" do result = Qiniu.batch_download(@bucket, [@key]) - result.should_not be_false - result.should_not be_empty + expect(result).to_not be_empty puts result.inspect end end @@ -236,42 +228,40 @@ module Qiniu context ".move" do it "should works" do result = Qiniu.move(@bucket, @key, @bucket, @key2) - result.should_not be_false + expect(result).to eq(true) result2 = Qiniu.stat(@bucket, @key2) - result2.should_not be_false + expect(result2).to_not be_empty result3 = Qiniu.move(@bucket, @key2, @bucket, @key) - result3.should_not be_false + expect(result3).to eq(true) end end context ".copy" do it "should works" do result = Qiniu.copy(@bucket, @key, @bucket, @key2) - result.should_not be_false + expect(result).to eq(true) result3 = Qiniu.delete(@bucket, @key2) - result3.should_not be_false + expect(result3).to eq(true) end end context ".delete" do it "should works" do result = Qiniu.delete(@bucket, @key) - result.should_not be_false + expect(result).to eq(true) end end context ".image_info" do it "should works" do data = Qiniu.get(@test_image_bucket, @test_image_key) - data.should_not be_false - data.should_not be_empty + expect(data).to_not be_empty puts data.inspect result = Qiniu.image_info(data["url"]) - result.should_not be_false - result.should_not be_empty + expect(result).to_not be_empty puts result.inspect end end @@ -279,8 +269,7 @@ module Qiniu context ".image_mogrify_save_as" do it "should works" do data = Qiniu.get(@test_image_bucket, @test_image_key) - data.should_not be_false - data.should_not be_empty + expect(data).to_not be_empty puts data.inspect dest_key = "cropped-" + @test_image_key @@ -295,8 +284,7 @@ module Qiniu :auto_orient => true } result2 = Qiniu.image_mogrify_save_as(@test_image_bucket, dest_key, src_img_url, mogrify_options) - result2.should_not be_false - result2.should_not be_empty + expect(result2).to_not be_empty puts result2.inspect end end