activestorage-aliyun 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f817ca04a1433ea1f3b224ed89dfcd53802b2a15d2e2d35430724bb805ba8c26
4
- data.tar.gz: f64560d7102526397c87a0255267521c17d854b13ee212dcff54730b233f24f0
3
+ metadata.gz: b6de8c6a19e97cc39b456d90df755854de54dd4338b123c37d0276055056514f
4
+ data.tar.gz: 93f6427de6343b3d65be549c6d88676ed6141c17c66457f2a1848d200a2bfcf5
5
5
  SHA512:
6
- metadata.gz: 532f0a1b89d68bebf9e70f95ac645ff47db09a977f085d995d6ff30cf587089248ccc05736fbdc0998fd8586d1b2dc4324a2d4af0557dfe5c5bab16d57865358
7
- data.tar.gz: db1561aace0805c0e0b29adaa167d789de227e016d8afde47a81902004aad5606a1a2114d37f6a4e52d8e7fd9f5f41fa009fea0ce683cecc9ab4b0f2db163720
6
+ metadata.gz: ccb3cd37cd09c9dae72ee43fca32b5583900d184f12ea10b774d75f4b3b41df2139f34a308849e28a6820cb9f88e7f4de16a7fd30d4f4eb62dc1f4988ffc8187
7
+ data.tar.gz: 75de0836b30d849cd90397b0140b7e11ac01d0768effa5046f64d208d2027f32b06e61e3626568461f25aa0e020407866520019683ebd254294d4d6884586d0d
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ ## 0.5.1
2
+
3
+ - Set OSS Object `content-type` on uploading.
4
+
1
5
  ## 0.5.0
2
6
 
3
- - Implement download_chunk method for fix #10 upload a large file by directly.
7
+ - Implement download_chunk method for fix #10 upload a large file by directly.
4
8
 
5
9
  ## 0.4.1
6
10
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ActiveStorage Aliyun Service
2
2
 
3
- Wraps the Aliyun OSS as an Active Storage service.
3
+ Wraps the Aliyun OSS as an Active Storage service, use [Aliyun official Ruby SDK](https://github.com/aliyun/aliyun-oss-ruby-sdk) for upload.
4
4
 
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/activestorage-aliyun.svg)](https://badge.fury.io/rb/activestorage-aliyun) [![Build Status](https://travis-ci.org/huacnlee/activestorage-aliyun.svg)](https://travis-ci.org/huacnlee/activestorage-aliyun) [![Code Climate](https://codeclimate.com/github/huacnlee/activestorage-aliyun/badges/gpa.svg)](https://codeclimate.com/github/huacnlee/activestorage-aliyun) [![codecov.io](https://codecov.io/github/huacnlee/activestorage-aliyun/coverage.svg?branch=master)](https://codecov.io/github/huacnlee/activestorage-aliyun?branch=master)
@@ -24,7 +24,7 @@ $ bundle
24
24
 
25
25
  config/storage.yml
26
26
 
27
- ```rb
27
+ ```yml
28
28
  production:
29
29
  service: Aliyun
30
30
  access_key_id: "your-oss-access-key-id"
@@ -37,10 +37,23 @@ production:
37
37
  mode: "public"
38
38
  ```
39
39
 
40
+ ### Custom Domain
41
+
42
+ ```yml
43
+ production:
44
+ service: Aliyun
45
+ access_key_id: "your-oss-access-key-id"
46
+ access_key_secret: "your-oss-access-key-secret"
47
+ bucket: "bucket-name"
48
+ endpoint: "https://file.myhost.com"
49
+ # Enable cname to use custom domain
50
+ cname: true
51
+ ```
52
+
40
53
  ### Use for image url
41
54
 
42
55
  ```erb
43
- Orignial File URL:
56
+ Original File URL:
44
57
 
45
58
  <%= image_tag @photo.image.service_url %>
46
59
  ```
@@ -10,7 +10,8 @@ module ActiveStorage
10
10
 
11
11
  def upload(key, io, checksum: nil)
12
12
  instrument :upload, key: key, checksum: checksum do
13
- bucket.put_object(path_for(key)) do |stream|
13
+ content_type = Marcel::MimeType.for(io)
14
+ bucket.put_object(path_for(key), content_type: content_type) do |stream|
14
15
  stream << io.read
15
16
  end
16
17
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveStorageAliyun
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage-aliyun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.0.rc2
19
+ version: 5.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.0.rc2
26
+ version: 5.2.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aliyun-sdk
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -46,7 +46,6 @@ extra_rdoc_files: []
46
46
  files:
47
47
  - CHANGELOG.md
48
48
  - README.md
49
- - Rakefile
50
49
  - lib/active_storage/service/aliyun_service.rb
51
50
  - lib/active_storage_aliyun/railtie.rb
52
51
  - lib/active_storage_aliyun/version.rb
@@ -71,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
70
  version: '0'
72
71
  requirements: []
73
72
  rubyforge_project:
74
- rubygems_version: 2.7.6
73
+ rubygems_version: 2.7.8
75
74
  signing_key:
76
75
  specification_version: 4
77
76
  summary: Wraps the Aliyun OSS as an Active Storage service
data/Rakefile DELETED
@@ -1,27 +0,0 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'ActiveStorage Aliyun Service'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- require 'bundler/gem_tasks'
18
-
19
- require 'rake/testtask'
20
-
21
- Rake::TestTask.new(:test) do |t|
22
- t.libs << 'test'
23
- t.pattern = 'test/**/*_test.rb'
24
- t.verbose = false
25
- end
26
-
27
- task default: :test