mini_paperclip 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/{ruby.yml → ci.yml} +4 -1
- data/README.md +1 -0
- data/lib/mini_paperclip.rb +1 -0
- data/lib/mini_paperclip/attachment.rb +10 -0
- data/lib/mini_paperclip/class_methods.rb +1 -1
- data/lib/mini_paperclip/config.rb +1 -0
- data/lib/mini_paperclip/storage/filesystem.rb +1 -0
- data/lib/mini_paperclip/storage/s3.rb +1 -0
- data/lib/mini_paperclip/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 909b57103a53df47bb30daf06f36b572d9dfe274cba465e9a21ba9fae57d7e2b
|
4
|
+
data.tar.gz: d1420ac6ca79918f0f424aa9f3216e92876e5109e8116c3221995cd903d49b1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc30ba93963b6380a814552dcbfe556122fb6315ec7a3825aed595ac04c77838f38aeb65852fb922db6ff8fbed699243c1006d23316881622d989402d6487fbd
|
7
|
+
data.tar.gz: 5f764c680865d71fa9c211566e2354d00a0ba2cf712292ff02ef69da1c39b7a7888ed25186f2e0f00d211eb245eaf3cb3875d6cd4c79ac2ac2f8cac9c9152b5b
|
@@ -37,5 +37,8 @@ jobs:
|
|
37
37
|
ruby-version: ${{ matrix.ruby }}
|
38
38
|
- name: Install dependencies
|
39
39
|
run: bundle install --gemfile=${{ matrix.gemfile }}
|
40
|
-
- name: Run tests
|
40
|
+
- name: Run tests and Print coverage
|
41
|
+
env:
|
42
|
+
COVERAGE: 1
|
43
|
+
LOGLEVEL: info
|
41
44
|
run: bundle exec --gemfile=${{ matrix.gemfile }} rake
|
data/README.md
CHANGED
@@ -71,6 +71,7 @@ MiniPaperclip.config.tap do |config|
|
|
71
71
|
config.s3_acl # s3 object acl
|
72
72
|
config.s3_cache_control # Set this value to Cache-Control header when put-object
|
73
73
|
config.interpolates # minimum templates using by `String#gsub!`
|
74
|
+
config.keep_old_files # Delete old attached file if it's false (default false)
|
74
75
|
config.read_timeout # timeout when attachment set url
|
75
76
|
config.logger # You can set logger object.
|
76
77
|
end
|
data/lib/mini_paperclip.rb
CHANGED
@@ -61,6 +61,10 @@ module MiniPaperclip
|
|
61
61
|
@waiting_write_file = nil
|
62
62
|
@meta_content_type = nil
|
63
63
|
|
64
|
+
if present?
|
65
|
+
push_delete_files
|
66
|
+
end
|
67
|
+
|
64
68
|
if file.nil?
|
65
69
|
assign_nil
|
66
70
|
elsif file.instance_of?(Attachment)
|
@@ -116,6 +120,12 @@ module MiniPaperclip
|
|
116
120
|
@storage.write(style, temp)
|
117
121
|
end
|
118
122
|
end
|
123
|
+
|
124
|
+
# should delete after write for copy
|
125
|
+
if !@config.keep_old_files
|
126
|
+
do_delete_files
|
127
|
+
end
|
128
|
+
|
119
129
|
ensure
|
120
130
|
if @waiting_write_file.respond_to?(:close!)
|
121
131
|
@waiting_write_file.close!
|
@@ -8,7 +8,7 @@ module MiniPaperclip
|
|
8
8
|
instance_variable_set("@#{attachment_name}", Attachment.new(self, attachment_name, option_config))
|
9
9
|
end
|
10
10
|
define_method("#{attachment_name}=") do |file|
|
11
|
-
a =
|
11
|
+
a = public_send(attachment_name)
|
12
12
|
a.assign(file)
|
13
13
|
instance_variable_set("@#{attachment_name}", a)
|
14
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_paperclip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ksss
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|
@@ -101,7 +101,7 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
- ".github/workflows/
|
104
|
+
- ".github/workflows/ci.yml"
|
105
105
|
- ".gitignore"
|
106
106
|
- ".rspec"
|
107
107
|
- CODE_OF_CONDUCT.md
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
161
|
requirements: []
|
162
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.1.4
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: MiniPaperclip is a mini paperclip
|