paperclip-gcs 0.2.0 → 0.3.1

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
- SHA1:
3
- metadata.gz: a8cc76504b6ff42aee53039edc3a52197d4c74ff
4
- data.tar.gz: 8d125159df6af16fa17c142f0bf341a94fffd90c
2
+ SHA256:
3
+ metadata.gz: 9401a2869fe785ab10d07de65a786849eb8f7954a799a14519e4177bea89a17b
4
+ data.tar.gz: 2afb841d3f6238b775273349e4f949c0647d9657c4b6eeaf9c9bc975bd398172
5
5
  SHA512:
6
- metadata.gz: d5624e98d042a9db18b602ae4642d0f875f6f1b00a1b1b56c7283975c5ad7506bd668c0692ef8174eb8776cf560c0059a7128dcf665ce85ad1c2a6d4befa4f03
7
- data.tar.gz: 7b027d3345b4dfe74ccfa7a6bf5875e7702925a5032feaf1a7ec60111ceb2bad1de4d4829bee88b93ce592baf2b00b83e7b670595cb8ad6aa307284fbb5da4e1
6
+ metadata.gz: 72c6e8472cabdc9ed99418bb63de24d1e55f2905eb90f3d71ef87e8aad51c6826b6f39141a08aa3068d2dd5a3c1cf0dce785301e9aadcb1819818469a11834f1
7
+ data.tar.gz: 445cde3dcfef1ba45bc60ac13483b85276eeea01d136dd0f1339cd8f51cf6cb0708b538f68f2ac64e13c09409e8b4c08ea7640257ea11316f13a07dc23ef0182
data/Gemfile CHANGED
@@ -1,4 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in paperclip-gcs.gemspec
4
6
  gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -184,6 +184,14 @@ gcs_storage_class: :multi_regional
184
184
 
185
185
  The Cache-Control metadata allows you to control whether and for how long browser and Internet caches are allowed to cache your objects.
186
186
 
187
+ ### gcs_content_disposition
188
+
189
+ The Content-Disposition metadata allows you to specify the presentation of the object in the browser.
190
+
191
+ ### gcs_content_type
192
+
193
+ The Content-Type metadata allows you to specify the content type of the object. By default it will use the file content type.
194
+
187
195
  ### Interpolates
188
196
 
189
197
  #### :gcs_alias_url
@@ -1,5 +1,5 @@
1
1
  module Paperclip
2
2
  module Gcs
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -1,3 +1,5 @@
1
+ require "singleton"
2
+
1
3
  module Paperclip
2
4
  module Storage
3
5
  module Gcs
@@ -23,6 +23,8 @@ module Paperclip
23
23
  @gcs_permissions = normalize_style(@options[:gcs_permissions])
24
24
  @gcs_storage_class = normalize_style(@options[:gcs_storage_class])
25
25
  @gcs_cache_control = normalize_style(@options[:gcs_cache_control])
26
+ @gcs_content_type = normalize_style(@options[:gcs_content_type])
27
+ @gcs_content_disposition = normalize_style(@options[:gcs_content_disposition])
26
28
 
27
29
  unless @options[:url].to_s.match(%r{\A:gcs_(alias|path|domain)_url\z}) || @options[:url] == ":asset_host".freeze
28
30
  @options[:path] = path_option.gsub(/:url/, @options[:url]).sub(%r{\A:rails_root/public/system}, "".freeze)
@@ -70,7 +72,8 @@ module Paperclip
70
72
  log("saving #{path(style)}")
71
73
 
72
74
  opts = {
73
- content_type: file.content_type,
75
+ content_type: gcs_content_type(file, style),
76
+ content_disposition: gcs_content_disposition(style),
74
77
  cache_control: gcs_cache_control(style),
75
78
  encryption_key: gcs_encryption_key,
76
79
  acl: gcs_permissions(style),
@@ -141,6 +144,14 @@ module Paperclip
141
144
  unwrap_proc(@gcs_permissions[style] || @gcs_permissions[:default], self, style)
142
145
  end
143
146
 
147
+ def gcs_content_type(file, style = default_style)
148
+ unwrap_proc(@gcs_content_type[style] || @gcs_content_type[:default], self, style) || file.content_type
149
+ end
150
+
151
+ def gcs_content_disposition(style = default_style)
152
+ unwrap_proc(@gcs_content_disposition[style] || @gcs_content_disposition[:default], self, style)
153
+ end
154
+
144
155
  def gcs_storage_class(style = default_style)
145
156
  unwrap_proc(@gcs_storage_class[style] || @gcs_storage_class[:default], self, style)
146
157
  end
@@ -19,10 +19,6 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency "paperclip", ">= 4.0"
22
+ spec.add_runtime_dependency "kt-paperclip", ">= 4.0"
23
23
  spec.add_runtime_dependency "google-cloud-storage", "~> 1.0"
24
-
25
- spec.add_development_dependency "bundler", "~> 1.15"
26
- spec.add_development_dependency "rake", "~> 10.0"
27
- spec.add_development_dependency "minitest", "~> 5.0"
28
24
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paperclip-gcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daichi HIRATA
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-14 00:00:00.000000000 Z
11
+ date: 2022-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: paperclip
14
+ name: kt-paperclip
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -38,48 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
- - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '1.15'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '1.15'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '10.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '10.0'
69
- - !ruby/object:Gem::Dependency
70
- name: minitest
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '5.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '5.0'
83
41
  description: Extends Paperclip with Google Cloud Storage
84
42
  email:
85
43
  - daichirata@gmail.com
@@ -90,6 +48,7 @@ files:
90
48
  - ".gitignore"
91
49
  - ".travis.yml"
92
50
  - Gemfile
51
+ - LICENSE
93
52
  - README.md
94
53
  - Rakefile
95
54
  - bin/console
@@ -104,7 +63,7 @@ files:
104
63
  homepage: https://github.com/daichirata/paperclip-gcs
105
64
  licenses: []
106
65
  metadata: {}
107
- post_install_message:
66
+ post_install_message:
108
67
  rdoc_options: []
109
68
  require_paths:
110
69
  - lib
@@ -119,9 +78,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
78
  - !ruby/object:Gem::Version
120
79
  version: '0'
121
80
  requirements: []
122
- rubyforge_project:
123
- rubygems_version: 2.6.11
124
- signing_key:
81
+ rubygems_version: 3.3.7
82
+ signing_key:
125
83
  specification_version: 4
126
84
  summary: Extends Paperclip with Google Cloud Storage
127
85
  test_files: []