carrierwave-base64 2.10.0 → 2.11.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: dcc0254f7258899a78ff178e32c60221aea32cf3551a1dc0702ff1675645024b
4
- data.tar.gz: dc0f4f9de01fe428086ac3a3289ae808e53c2a0f80713cee51b8ef177ad542d4
3
+ metadata.gz: 4b2f2aa6a1eb39ec42dd3cc71e85a56a8f838181d81e568965a2ced1557585ed
4
+ data.tar.gz: 525afd0612b8e5a29801cb8a7c94ab3abb23b0add71710fc1e164a61718dac35
5
5
  SHA512:
6
- metadata.gz: 7e9df88c09c107a39403c969dedd523e7bcd9a152bdcb548ee3250ea63b4e8498b80a33a52903f66530f4ba95bc61c3b63081de7c08e64f62779613cc9ff486c
7
- data.tar.gz: d104d6d00b5ee4b3772dd696f9136c0d3335aa460d3fd8543fa484050c22817a1189b21d731a748960f14fbf550c5b060f8e353c137017cda5377be19811a215
6
+ metadata.gz: 758a65bf080107ea0a79192f4aeb929e1754d3a568cb3c3fc55eee281a4b817da808c5866aee4953e36c2396c4880e29749c12158f57245a416d833c812f77f6
7
+ data.tar.gz: 2d05d217b7a3141bcfaf3e4d038e32bd0c00d18848ae054362dc3aa8a0c3109c6d317ed72559a9be6a48ac3ca34f4bcec2dccab5382bc06144ec0b563fc3fb40
@@ -0,0 +1,36 @@
1
+ version: 2.1
2
+
3
+ orbs:
4
+ ruby: circleci/ruby@2.1.1
5
+
6
+ jobs:
7
+ build:
8
+ parameters:
9
+ ruby_version:
10
+ type: string
11
+
12
+ docker:
13
+ - image: cimg/ruby:<< parameters.ruby_version >>
14
+
15
+ steps:
16
+ - checkout
17
+ - run:
18
+ name: Install dependencies
19
+ command: |
20
+ gem install bundler
21
+ bundle install
22
+ - run:
23
+ name: Tests
24
+ command: bundle exec rspec
25
+ - run:
26
+ name: Lint
27
+ command: bundle exec rubocop
28
+
29
+ workflows:
30
+ workflow:
31
+ jobs:
32
+ - build:
33
+ matrix:
34
+ name: build-<< matrix.ruby_version >>
35
+ parameters:
36
+ ruby_version: ["2.7", "3.0", "3.1", "3.2", "3.3"]
data/.rubocop.yml CHANGED
@@ -14,3 +14,6 @@ Style/SafeNavigation:
14
14
 
15
15
  Lint/SendWithMixinArgument:
16
16
  Enabled: false
17
+
18
+ Gemspec/RequiredRubyVersion:
19
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # carrierwave-base64 changelog
2
2
 
3
+ ## 2.11.0
4
+
5
+ - Add ability to remove upload by assigning nil value to the field
6
+
3
7
  ## 2.10.0
4
8
 
5
9
  - Allow `mount_base64_uploader` to take a block as an argument (#83, @shuuuuun)
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Carrierwave::Base64
2
2
 
3
+ [![CircleCI](https://dl.circleci.com/status-badge/img/gh/y9v/carrierwave-base64/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/y9v/carrierwave-base64/tree/master)
3
4
  [![Gem Version](https://badge.fury.io/rb/carrierwave-base64.svg)](http://badge.fury.io/rb/carrierwave-base64)
4
- [![Build Status](https://travis-ci.org/y9v/carrierwave-base64.svg?branch=master)](https://travis-ci.org/y9v/carrierwave-base64)
5
5
  [![Code Climate](https://codeclimate.com/github/y9v/carrierwave-base64/badges/gpa.svg)](https://codeclimate.com/github/y9v/carrierwave-base64)
6
6
 
7
7
  Upload files encoded as base64 to carrierwave.
@@ -20,18 +20,18 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ['lib']
21
21
 
22
22
  spec.add_dependency 'carrierwave', '>= 2.2.1'
23
- spec.add_dependency 'mime-types', '~> 3.0'
24
23
  spec.add_dependency 'marcel', '~> 1.0.0'
24
+ spec.add_dependency 'mime-types', '~> 3.0'
25
25
 
26
- spec.add_development_dependency 'bundler', '~> 2.1'
27
- spec.add_development_dependency 'carrierwave-mongoid'
26
+ spec.add_development_dependency 'bundler'
27
+ spec.add_development_dependency 'carrierwave-mongoid', '~> 1.4.0'
28
28
  spec.add_development_dependency 'mongoid'
29
29
  spec.add_development_dependency 'pry'
30
- spec.add_development_dependency 'rails', '~> 5'
31
- spec.add_development_dependency 'rake', '~> 12.3.3'
32
- spec.add_development_dependency 'rspec', '~> 2.14'
30
+ spec.add_development_dependency 'rails'
31
+ spec.add_development_dependency 'rake'
32
+ spec.add_development_dependency 'rspec'
33
33
  spec.add_development_dependency 'rubocop'
34
34
  spec.add_development_dependency 'sham_rack'
35
- spec.add_development_dependency 'sqlite3'
35
+ spec.add_development_dependency 'sqlite3', '~> 1.7.3'
36
36
  spec.add_development_dependency 'yard'
37
37
  end
@@ -43,14 +43,14 @@ module Carrierwave
43
43
  def define_writer(klass, attr, options)
44
44
  klass.send(:define_method, "#{attr}=") do |data|
45
45
  # rubocop:disable Lint/NonLocalExitFromIterator
46
- return if data.to_s.empty? || data == send(attr).to_s
47
-
46
+ return if data == send(attr).to_s
48
47
  # rubocop:enable Lint/NonLocalExitFromIterator
49
48
 
50
49
  send("#{attr}_will_change!") if respond_to?("#{attr}_will_change!")
51
50
 
52
- return super(data) unless data.is_a?(String) &&
53
- data.strip.start_with?('data')
51
+ return send("remove_#{attr}=", true) if data.to_s.strip == ''
52
+
53
+ return super(data) unless data.is_a?(String) && data.strip.start_with?('data')
54
54
 
55
55
  super Carrierwave::Base64::Base64StringIO.new(
56
56
  data.strip,
@@ -1,5 +1,5 @@
1
1
  module Carrierwave
2
2
  module Base64
3
- VERSION = '2.10.0'.freeze
3
+ VERSION = '2.11.0'.freeze
4
4
  end
5
5
  end
data/spec/adapter_spec.rb CHANGED
@@ -40,9 +40,7 @@ RSpec.describe Carrierwave::Base64::Adapter do
40
40
 
41
41
  context 'models with file_name options for the uploader' do
42
42
  subject do
43
- User.mount_base64_uploader(
44
- :image, uploader, file_name: ->(u) { u.username }
45
- )
43
+ User.mount_base64_uploader(:image, uploader, file_name: :username.to_proc)
46
44
  User.new(username: 'batman')
47
45
  end
48
46
 
@@ -63,9 +61,7 @@ RSpec.describe Carrierwave::Base64::Adapter do
63
61
  context 'when file_name is a proc' do
64
62
  it 'does NOT issue a deprecation warning' do
65
63
  expect do
66
- User.mount_base64_uploader(
67
- :image, uploader, file_name: ->(u) { u.username }
68
- )
64
+ User.mount_base64_uploader(:image, uploader, file_name: :username.to_proc)
69
65
  end.not_to warn('Deprecation')
70
66
  end
71
67
  end
@@ -149,6 +145,12 @@ RSpec.describe Carrierwave::Base64::Adapter do
149
145
  subject.save!
150
146
  expect(subject.image.file).to be_nil
151
147
  end
148
+
149
+ it 'removes files when setting the attribute to nil' do
150
+ subject.image = nil
151
+ subject.save!
152
+ expect(subject.image.file).to be_nil
153
+ end
152
154
  end
153
155
  end
154
156
 
@@ -23,7 +23,7 @@ RSpec.describe Carrierwave::Base64::Base64StringIO do
23
23
  end
24
24
 
25
25
  it 'calls a function that returns the file_name' do
26
- method = ->(u) { u.username }
26
+ method = :username.to_proc
27
27
  base64_string_io = described_class.new(
28
28
  data, method.curry[User.new(username: 'batman')]
29
29
  )
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
- require 'pry'
5
4
  require 'sham_rack'
6
5
 
7
6
  require 'rails'
@@ -7,11 +7,11 @@ RSpec::Matchers.define :warn do |message|
7
7
  "warn \"#{message}\""
8
8
  end
9
9
 
10
- failure_message_for_should do
10
+ failure_message do
11
11
  "expected to #{description}"
12
12
  end
13
13
 
14
- failure_message_for_should_not do
14
+ failure_message_when_negated do
15
15
  "expected to not #{description}"
16
16
  end
17
17
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-base64
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Lebedev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-30 00:00:00.000000000 Z
11
+ date: 2024-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave
@@ -25,61 +25,61 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.2.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: mime-types
28
+ name: marcel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.0'
33
+ version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.0'
40
+ version: 1.0.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: marcel
42
+ name: mime-types
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.0.0
47
+ version: '3.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0
54
+ version: '3.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '2.1'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '2.1'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: carrierwave-mongoid
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 1.4.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 1.4.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: mongoid
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -112,44 +112,44 @@ dependencies:
112
112
  name: rails
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '5'
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '5'
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rake
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 12.3.3
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: 12.3.3
138
+ version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: '2.14'
145
+ version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: '2.14'
152
+ version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rubocop
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -182,16 +182,16 @@ dependencies:
182
182
  name: sqlite3
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">="
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '0'
187
+ version: 1.7.3
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ">="
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '0'
194
+ version: 1.7.3
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: yard
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -214,10 +214,10 @@ executables: []
214
214
  extensions: []
215
215
  extra_rdoc_files: []
216
216
  files:
217
+ - ".circleci/config.yml"
217
218
  - ".gitignore"
218
219
  - ".rspec"
219
220
  - ".rubocop.yml"
220
- - ".travis.yml"
221
221
  - CHANGELOG.md
222
222
  - Gemfile
223
223
  - LICENSE.txt
@@ -236,7 +236,7 @@ files:
236
236
  - spec/fixtures/base64_image.fixture
237
237
  - spec/fixtures/test.docx
238
238
  - spec/fixtures/test.jpeg
239
- - spec/fixtures/test.mp3
239
+ - spec/fixtures/test.mpga
240
240
  - spec/fixtures/test.pdf
241
241
  - spec/fixtures/test.png
242
242
  - spec/spec_helper.rb
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  - !ruby/object:Gem::Version
263
263
  version: '0'
264
264
  requirements: []
265
- rubygems_version: 3.1.4
265
+ rubygems_version: 3.5.17
266
266
  signing_key:
267
267
  specification_version: 4
268
268
  summary: Upload images encoded as base64 to carrierwave.
@@ -272,7 +272,7 @@ test_files:
272
272
  - spec/fixtures/base64_image.fixture
273
273
  - spec/fixtures/test.docx
274
274
  - spec/fixtures/test.jpeg
275
- - spec/fixtures/test.mp3
275
+ - spec/fixtures/test.mpga
276
276
  - spec/fixtures/test.pdf
277
277
  - spec/fixtures/test.png
278
278
  - spec/spec_helper.rb
data/.travis.yml DELETED
@@ -1,27 +0,0 @@
1
- language: ruby
2
-
3
- rvm:
4
- - 2.4.9
5
- - 2.5.7
6
- - 2.6.5
7
- - 2.7.0
8
- - ruby-head
9
- - jruby-head
10
-
11
- matrix:
12
- allow_failures:
13
- - rvm: ruby-head
14
- - rvm: jruby-head
15
-
16
- gemfile:
17
- - Gemfile
18
-
19
- sudo: false
20
-
21
- before_install:
22
- - gem update --system
23
- - gem update bundler
24
-
25
- script:
26
- - bundle exec rspec
27
- - bundle exec rubocop
File without changes