attachment_saver 1.5.1 → 1.6.0

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
- SHA1:
3
- metadata.gz: f6490e7e2047044a90f1e1173bde73a2f8d35a74
4
- data.tar.gz: 0ca89b3a3ee2ef6ab30edbda1ca24dc33cf733bc
2
+ SHA256:
3
+ metadata.gz: 88bee0b1c6ab4d3d068770c288a4f724cf7c6486570b59b00141cfce744a3596
4
+ data.tar.gz: 0db2e591edefa6b2c9b1fb1ac3466bd76c8432acd885dd6c6387fa7441f6a749
5
5
  SHA512:
6
- metadata.gz: c4e7a26570502f01844906d7c2d2bdd258b80cc4abaf41f44fffeb358875b87b6600de35f98e74757ace80f93a4e23f34fad1142a9544ac4c844cbb8dfbd43f6
7
- data.tar.gz: ad2e45480b8c97d37878bb4f98a60d3a6899b865519bea7c510f8a6f1a9c264393f183f0b30bc63dfdf0c7a6740dba4371fa8dd42319200f754b416cdc13d981
6
+ metadata.gz: d837872c933bcc2fc557ddc210d05d1a0d46fe27f0f4c2b484cab5b6c47b836eb0dfbb6e3e00dfb24d32df51eb96520890dc92d0f20da9870924c61851db2e3e
7
+ data.tar.gz: 19577ea9e1c123a5b265943911d3f1c1a601a962fb6f5e5c79853a3bdf7ac3045f99257d59860e306815c3a5ea046fe489d577353d72b641fc0079118d8ed06a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- attachment_saver (1.5.1)
4
+ attachment_saver (1.6.0)
5
5
  activerecord
6
6
  mimemagic
7
7
 
@@ -10,48 +10,47 @@ GEM
10
10
  specs:
11
11
  RubyInline (3.12.4)
12
12
  ZenTest (~> 4.3)
13
- ZenTest (4.11.1)
14
- activemodel (5.2.0.beta2)
15
- activesupport (= 5.2.0.beta2)
16
- activerecord (5.2.0.beta2)
17
- activemodel (= 5.2.0.beta2)
18
- activesupport (= 5.2.0.beta2)
13
+ ZenTest (4.11.2)
14
+ activemodel (5.2.3)
15
+ activesupport (= 5.2.3)
16
+ activerecord (5.2.3)
17
+ activemodel (= 5.2.3)
18
+ activesupport (= 5.2.3)
19
19
  arel (>= 9.0)
20
- activesupport (5.2.0.beta2)
20
+ activesupport (5.2.3)
21
21
  concurrent-ruby (~> 1.0, >= 1.0.2)
22
- i18n (~> 0.7)
22
+ i18n (>= 0.7, < 2)
23
23
  minitest (~> 5.1)
24
24
  tzinfo (~> 1.1)
25
25
  arel (9.0.0)
26
- concurrent-ruby (1.0.5)
27
- gdk_pixbuf2 (3.2.1)
28
- gio2 (= 3.2.1)
29
- gio2 (3.2.1)
30
- glib2 (= 3.2.1)
31
- gobject-introspection (= 3.2.1)
32
- glib2 (3.2.1)
26
+ concurrent-ruby (1.1.5)
27
+ gdk_pixbuf2 (3.3.6)
28
+ gio2 (= 3.3.6)
29
+ gio2 (3.3.6)
30
+ gobject-introspection (= 3.3.6)
31
+ glib2 (3.3.6)
33
32
  native-package-installer (>= 1.0.3)
34
- pkg-config (>= 1.2.2)
35
- gobject-introspection (3.2.1)
36
- glib2 (= 3.2.1)
37
- i18n (0.9.1)
33
+ pkg-config (>= 1.3.5)
34
+ gobject-introspection (3.3.6)
35
+ glib2 (= 3.3.6)
36
+ i18n (1.6.0)
38
37
  concurrent-ruby (~> 1.0)
39
38
  image_science (1.3.0)
40
39
  RubyInline (~> 3.9)
41
- image_size (1.5.0)
40
+ image_size (2.0.2)
42
41
  metaclass (0.0.4)
43
- mimemagic (0.3.2)
44
- mini_magick (4.8.0)
45
- minitest (5.11.0)
46
- mocha (1.3.0)
42
+ mimemagic (0.3.3)
43
+ mini_magick (4.9.5)
44
+ minitest (5.11.3)
45
+ mocha (1.9.0)
47
46
  metaclass (~> 0.0.1)
48
- native-package-installer (1.0.6)
49
- pkg-config (1.2.9)
50
- rake (12.3.0)
51
- rmagick (2.16.0)
52
- sqlite3 (1.3.13)
47
+ native-package-installer (1.0.7)
48
+ pkg-config (1.3.7)
49
+ rake (12.3.3)
50
+ rmagick (4.0.0)
51
+ sqlite3 (1.4.1)
53
52
  thread_safe (0.3.6)
54
- tzinfo (1.2.4)
53
+ tzinfo (1.2.5)
55
54
  thread_safe (~> 0.1)
56
55
 
57
56
  PLATFORMS
@@ -70,4 +69,4 @@ DEPENDENCIES
70
69
  sqlite3
71
70
 
72
71
  BUNDLED WITH
73
- 1.16.1
72
+ 1.16.4
@@ -1,3 +1,3 @@
1
1
  module AttachmentSaver
2
- VERSION = '1.5.1'
2
+ VERSION = '1.6.0'
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require 'gdk_pixbuf2'
2
- require 'misc/extended_tempfile'
3
2
  require 'processors/image'
4
3
 
5
4
  class GdkPixbufProcessorError < ImageProcessorError; end
@@ -67,7 +66,7 @@ module AttachmentSaver
67
66
  end
68
67
 
69
68
  # we leverage tempfiles as discussed in the uploaded_file method
70
- temp = ExtendedTempfile.new("asgtemp", tempfile_directory, derived_extension)
69
+ temp = Tempfile.new(["asgtemp", ".#{derived_extension}"], tempfile_directory)
71
70
  temp.binmode
72
71
  temp.close
73
72
  derived_image.save(temp.path, format)
@@ -98,7 +97,8 @@ module AttachmentSaver
98
97
  end
99
98
 
100
99
  def crop_to(new_width, new_height, &block) # crops to the center
101
- image = new_subpixbuf((width - new_width)/2, (height - new_height)/2, new_width, new_height)
100
+ method = respond_to?(:subpixbuf) ? :subpixbuf : :new_subpixbuf
101
+ image = send(method, (width - new_width)/2, (height - new_height)/2, new_width, new_height)
102
102
  image.extend Operations
103
103
  image.format = format
104
104
  image.file_extension = file_extension
@@ -1,6 +1,5 @@
1
1
  require 'image_science'
2
2
  require 'misc/image_science_extensions'
3
- require 'misc/extended_tempfile'
4
3
  require 'processors/image'
5
4
 
6
5
  class ImageScienceProcessorError < ImageProcessorError; end
@@ -51,7 +50,7 @@ module AttachmentSaver
51
50
  end
52
51
 
53
52
  # we leverage tempfiles as discussed in the uploaded_file method
54
- temp = ExtendedTempfile.new("asitemp", tempfile_directory, derived_extension)
53
+ temp = Tempfile.new(["asitemp", ".#{derived_extension}"], tempfile_directory)
55
54
  temp.binmode
56
55
  temp.close
57
56
  derived_image.save(temp.path)
@@ -1,5 +1,4 @@
1
1
  require 'image_size'
2
- require 'misc/extended_tempfile'
3
2
  require 'processors/image'
4
3
 
5
4
  class ImageSizeProcessorError < ImageProcessorError; end
@@ -1,6 +1,5 @@
1
1
  require 'mini_magick'
2
2
  require 'misc/mini_magick_extensions'
3
- require 'misc/extended_tempfile'
4
3
  require 'processors/image'
5
4
 
6
5
  class MiniMagickProcessorError < ImageProcessorError; end
@@ -53,7 +52,7 @@ module AttachmentSaver
53
52
  derived_extension = derived_image.file_type_extension
54
53
 
55
54
  # we leverage tempfiles as discussed in the uploaded_file method
56
- temp = ExtendedTempfile.new("asmtemp", tempfile_directory, derived_extension)
55
+ temp = Tempfile.new(["asmtemp", ".#{derived_extension}"], tempfile_directory)
57
56
  temp.binmode
58
57
  temp.close
59
58
  derived_image.write(temp.path)
@@ -3,7 +3,6 @@ begin
3
3
  rescue LoadError
4
4
  require 'RMagick'
5
5
  end
6
- require 'misc/extended_tempfile'
7
6
  require 'processors/image'
8
7
 
9
8
  class RMagickProcessorError < ImageProcessorError; end
@@ -48,7 +47,7 @@ module AttachmentSaver
48
47
  derived_extension = derived_image.file_type_extension
49
48
 
50
49
  # we leverage tempfiles as discussed in the uploaded_file method
51
- temp = ExtendedTempfile.new("asrtemp", tempfile_directory, derived_extension)
50
+ temp = Tempfile.new(["asrtemp", ".#{derived_extension}"], tempfile_directory)
52
51
  temp.binmode
53
52
  temp.close
54
53
  derived_image.write(temp.path)
@@ -1,5 +1,5 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
- require 'mocha/test_unit'
2
+ require 'mocha/minitest'
3
3
  require 'datastores/file_system'
4
4
 
5
5
  class FileSystemDatastoreTest < ActiveSupport::TestCase
@@ -1,5 +1,5 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
- require 'mocha/test_unit'
2
+ require 'mocha/minitest'
3
3
  require 'processors/image'
4
4
  require File.expand_path(File.join(File.dirname(__FILE__), 'image_operations'))
5
5
 
@@ -43,19 +43,24 @@ class ImageProcessorTest < ActiveSupport::TestCase
43
43
  model_without_upload.expects(:examine_image).times(0)
44
44
  model_without_upload.before_validate_attachment
45
45
 
46
- model_with_upload = SomeModel.new('application/octet-stream')
47
- model_with_upload.expects(:uploaded_file).at_least(:once).returns(StringIO.new('dummy'))
48
- model_with_upload.expects(:examine_image).times(1)
49
- model_with_upload.before_validate_attachment
50
-
51
- model_with_non_image_upload = SomeModel.new('text/plain')
52
- model_with_non_image_upload.expects(:uploaded_file).at_least(:once).returns(StringIO.new('dummy'))
53
- model_with_non_image_upload.expects(:examine_image).times(1).raises(ImageProcessorError)
54
- model_with_non_image_upload.before_validate_attachment
55
- assert_equal 'text/plain', model_with_non_image_upload.content_type
56
-
46
+ model_with_upload_with_non_image_magic = SomeModel.new('application/octet-stream')
47
+ model_with_upload_with_non_image_magic.expects(:uploaded_file).at_least_once.returns(StringIO.new('dummy'))
48
+ model_with_upload_with_non_image_magic.expects(:examine_image).times(0)
49
+ model_with_upload_with_non_image_magic.before_validate_attachment
50
+
51
+ model_with_upload_with_image_magic = SomeModel.new('application/octet-stream')
52
+ model_with_upload_with_image_magic.expects(:uploaded_file).at_least_once.returns(StringIO.new(File.read(ImageFixtures.fixture_path('test.jpg'))))
53
+ model_with_upload_with_image_magic.expects(:examine_image).times(1)
54
+ model_with_upload_with_image_magic.before_validate_attachment
55
+
56
+ model_with_invalid_upload_with_image_magic = SomeModel.new('text/plain')
57
+ model_with_invalid_upload_with_image_magic.expects(:uploaded_file).at_least_once.returns(StringIO.new(File.read(ImageFixtures.fixture_path('test.jpg'))))
58
+ model_with_invalid_upload_with_image_magic.expects(:examine_image).times(1).raises(ImageProcessorError)
59
+ model_with_invalid_upload_with_image_magic.before_validate_attachment
60
+ assert_equal 'text/plain', model_with_invalid_upload_with_image_magic.content_type
61
+
57
62
  model_with_mislabelled_non_image_upload = SomeModel.new('image/png')
58
- model_with_mislabelled_non_image_upload.expects(:uploaded_file).at_least(:once).returns(StringIO.new('dummy'))
63
+ model_with_mislabelled_non_image_upload.expects(:uploaded_file).at_least_once.returns(StringIO.new(File.read(ImageFixtures.fixture_path('test.jpg'))))
59
64
  model_with_mislabelled_non_image_upload.expects(:examine_image).times(1).raises(ImageProcessorError)
60
65
  model_with_mislabelled_non_image_upload.before_validate_attachment
61
66
  assert_equal 'application/octet-stream', model_with_mislabelled_non_image_upload.content_type
@@ -1,5 +1,5 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_helper'))
2
- require 'mocha/test_unit'
2
+ require 'mocha/minitest'
3
3
  require 'datastores/in_column'
4
4
 
5
5
  class InColumnDatastoreTest < ActiveSupport::TestCase
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attachment_saver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Bryant
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-12 00:00:00.000000000 Z
11
+ date: 2019-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  version: '0'
235
235
  requirements: []
236
236
  rubyforge_project:
237
- rubygems_version: 2.5.2
237
+ rubygems_version: 2.7.6
238
238
  signing_key:
239
239
  specification_version: 4
240
240
  summary: Saves attachments in files, models, or columns.
@@ -265,4 +265,3 @@ test_files:
265
265
  - test/rmagick_processor_test.rb
266
266
  - test/schema.rb
267
267
  - test/test_helper.rb
268
- has_rdoc: false