From 62a2b7fde0577eea195ec1177be6861b27f4ed63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Gonz=C3=A1lez?= Date: Tue, 26 Nov 2019 16:35:35 +0100 Subject: [PATCH 1/5] Changes required by updated deps --- pdf_cover.gemspec | 4 ++-- spec/dummy/app/assets/config/manifest.js | 0 spec/dummy/config/environment.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 spec/dummy/app/assets/config/manifest.js diff --git a/pdf_cover.gemspec b/pdf_cover.gemspec index 64786c5..25c6e61 100644 --- a/pdf_cover.gemspec +++ b/pdf_cover.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_development_dependency "activesupport", ">= 4.2" + spec.add_development_dependency "activesupport", ">= 4.2", "< 6.0.0" spec.add_development_dependency "appraisal" @@ -32,7 +32,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "simplecov" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "rubocop", "~> 0.37.2" - spec.add_development_dependency "sqlite3" + spec.add_development_dependency "sqlite3", "~> 1.3.6" spec.add_development_dependency "byebug" spec.add_development_dependency "fivemat" diff --git a/spec/dummy/app/assets/config/manifest.js b/spec/dummy/app/assets/config/manifest.js new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/config/environment.rb b/spec/dummy/config/environment.rb index f908fa6..71e7c41 100644 --- a/spec/dummy/config/environment.rb +++ b/spec/dummy/config/environment.rb @@ -1,5 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) +require File.expand_path("../application", __FILE__) require "paperclip" require "carrierwave" From 019e0fd16b90405cfd4eb87082c231203a5f8f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Gonz=C3=A1lez?= Date: Tue, 26 Nov 2019 17:25:35 +0100 Subject: [PATCH 2/5] Remove old cop --- .rubocop.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index bb71aa5..4908489 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -16,11 +16,6 @@ AllCops: - 'db/migrate/*.rb' - 'spec/dummy/**/*' - # By default, the rails cops are not run. Override in project or home - # directory .rubocop.yml files, or by giving the -R/--rails option. - Rails: - Enabled: true - # Indent private/protected/public as deep as method definitions AccessModifierIndentation: Description: Check indentation of private/protected visibility modifiers. From 1295328834d2be393cb3ca82f3a2828c2e97ad52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Gonz=C3=A1lez?= Date: Tue, 26 Nov 2019 17:25:54 +0100 Subject: [PATCH 3/5] Enforce the content type when uploading to carrierwave --- lib/pdf_cover.rb | 5 +++++ spec/carrierwave/with_carrierwave_spec.rb | 2 ++ 2 files changed, 7 insertions(+) diff --git a/lib/pdf_cover.rb b/lib/pdf_cover.rb index ba89656..ada4a42 100644 --- a/lib/pdf_cover.rb +++ b/lib/pdf_cover.rb @@ -31,6 +31,7 @@ module CarrierWave # end def pdf_cover_attachment(options = {}) process pdf_cover: [options[:quality], options[:resolution]] + process enforce_content_type: "image/jpeg" define_method :full_filename do |for_file = model.logo.file| for_file.gsub(/pdf$/i, "jpeg") @@ -96,4 +97,8 @@ def pdf_cover(quality, resolution) converted_file = PdfCover::Converter.new(file, options).converted_file FileUtils.cp(converted_file, current_path) end + + def enforce_content_type(content_type) + file.content_type = content_type + end end diff --git a/spec/carrierwave/with_carrierwave_spec.rb b/spec/carrierwave/with_carrierwave_spec.rb index b32b536..ef6416e 100644 --- a/spec/carrierwave/with_carrierwave_spec.rb +++ b/spec/carrierwave/with_carrierwave_spec.rb @@ -8,6 +8,7 @@ let(:pdf_cover) { Magick::Image.read(pdf_cover_path).first } let(:pdf_cover_digest) { pdf_cover.signature } let(:pdf_cover_path) { subject.pdf.image.path } + let(:pdf_cover_content_type) { subject.pdf.image.content_type } let(:sample_image) { Magick::Image.read(sample_image_name).first } let(:sample_image_digest) { sample_image.signature } @@ -22,6 +23,7 @@ it "creates the pdf cover image" do expect(pdf_cover_path).to match(/.*jpeg$/) expect(pdf_cover_digest).to eq(sample_image_digest) + expect(pdf_cover_content_type).to eq("image/jpeg") end end From 53e39d3d8ba9b0cd4c4c59765db99dafb1c58365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Gonz=C3=A1lez?= Date: Tue, 26 Nov 2019 17:33:24 +0100 Subject: [PATCH 4/5] Bump gem version to 0.3.1 --- CHANGELOG.md | 20 ++++++++++++++++++++ lib/pdf_cover/version.rb | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 741ea89..3c07a68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [0.3.1] - 2019-11-26 +### Added +- Enforce JPEG content type for carrierwave [Pull Request](https://github.com/xing/pdf_cover/pull/10) + +## [0.2.4] - 2017-10-18 +### Added +- Handle quotes in windows when calling GS [Pull Request](https://github.com/xing/pdf_cover/pull/9) + +## [0.2.3] - 2017-08-21 +### Added +- Remove `dTextAlphaBits` parameter to GS [Pull Request](https://github.com/xing/pdf_cover/pull/8) + +## [0.2.3] - 2017-08-21 +### Added +- Remove `dTextAlphaBits` parameter to GS [Pull Request](https://github.com/xing/pdf_cover/pull/8) + +## [0.2.2] - 2017-07-05 +### Added +- Add support for rails 5 [Pull Request](https://github.com/xing/pdf_cover/pull/7) + ## [0.2.1] - 2016-10-24 ### Added - Add default antialias [Pull Request](https://github.com/xing/pdf_cover/pull/6) diff --git a/lib/pdf_cover/version.rb b/lib/pdf_cover/version.rb index f3a2eb0..d4cbc57 100644 --- a/lib/pdf_cover/version.rb +++ b/lib/pdf_cover/version.rb @@ -1,3 +1,3 @@ module PdfCover - VERSION = "0.2.4".freeze + VERSION = "0.3.1".freeze end From 158bebd4c5af611b5848825365152acda0356cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Gonz=C3=A1lez?= Date: Tue, 26 Nov 2019 17:41:58 +0100 Subject: [PATCH 5/5] Update version matrix to current ruby versions --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9940abf..49217ba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby rvm: - - 2.2.6 - - 2.3.4 + - 2.5.7 + - 2.6.5 gemfile: - gemfiles/4.2.gemfile - gemfiles/5.0.gemfile