carrierwave-aliyun 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d76d49aaf688f569f6ad24269872e9ff3a773590d63533c472e5fe570bc673ab
4
- data.tar.gz: 4a6d40ae6c492edb56fd5804ee7b69ff89cddbc88143f95dc7b2aa5bd8a6a898
3
+ metadata.gz: f6d5d5c0acc30b46d90292f4a90c05e90667bdbf40ec97b279342aa215a4f2ff
4
+ data.tar.gz: f3b67cdf10f5800c250dafce535a6df95951c6c967e825f18fc3a656fa35268f
5
5
  SHA512:
6
- metadata.gz: 478a675dbb9dd3eaea1049c6a33dd892c5ff1458c615c1dff4d0eb6c4eb6a61cb8227bb7fb8d327679fed4cc29c24890ee1fb59399e431b2d845d2afa9960170
7
- data.tar.gz: 935fc2b025cb985d5133b198d7aa82e3baec7e7328bea7b33152b2dd90efc753df3c94a407fa102f9bb88465b41cd35e0b953728b49f0956ed24f8ab15ac1e0e
6
+ metadata.gz: 4d0ba7b297d56905fdb8d24697e02e7ba56f89c0ea91ea7f73784746f404d2a7de2d0161c1a9b9b70c6e66050247ecc0828ce2396bccfa25ab24bd49ba11499c
7
+ data.tar.gz: 9a6ee10ee4fb3299e9ef3170f1b4e41bc32d5137ee601295b2fed394cc060148f371835519db6af16bc5e6bf0f3be6164b4462b7fba202929505fe0d21562bf6
@@ -1,3 +1,7 @@
1
+ ## 1.1.0
2
+
3
+ - 支持 CarrierWave 2.0;
4
+
1
5
  ## 1.0.0
2
6
 
3
7
  - 采用 Aliyun 官方的 SDK 来访问 OSS;
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CarrierWave
4
4
  module Aliyun
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
@@ -17,6 +17,29 @@ module CarrierWave
17
17
  def retrieve!(identifier)
18
18
  AliyunFile.new(uploader, self, uploader.store_path(identifier))
19
19
  end
20
+
21
+ def cache!(file)
22
+ f = AliyunFile.new(uploader, self, uploader.store_path)
23
+ headers = {
24
+ content_type: file.content_type,
25
+ content_disposition: uploader.try(:content_disposition)
26
+ }
27
+
28
+ f.store(::File.open(file.file), headers)
29
+ f
30
+ end
31
+
32
+ def retrieve_from_cache!(identifier)
33
+ AliyunFile.new(uploader, self, uploader.store_path(identifier))
34
+ end
35
+
36
+ def delete_dir!(path)
37
+ # do nothing, because there's no such things as 'empty directory'
38
+ end
39
+
40
+ def clean_cache!(_seconds)
41
+ raise 'use Object Lifecycle Management to clean the cache'
42
+ end
20
43
  end
21
44
  end
22
45
  end
@@ -47,8 +47,12 @@ module CarrierWave
47
47
  headers[:content_type] = new_content_type
48
48
  end
49
49
 
50
- def store(file, headers = {})
51
- bucket.put(@path, file, headers)
50
+ def store(new_file, headers = {})
51
+ if new_file.is_a?(self.class)
52
+ new_file.move_to(path)
53
+ else
54
+ bucket.put(@path, new_file, headers)
55
+ end
52
56
  end
53
57
 
54
58
  def headers
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: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-23 00:00:00.000000000 Z
11
+ date: 2019-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.5.7
19
+ version: '1'
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: 0.5.7
26
+ version: '1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aliyun-sdk
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -72,8 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubyforge_project:
76
- rubygems_version: 2.7.9
75
+ rubygems_version: 3.0.3
77
76
  signing_key:
78
77
  specification_version: 4
79
78
  summary: Aliyun OSS support for Carrierwave