pdf_cover 0.2.0 → 0.2.1

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
2
  SHA1:
3
- metadata.gz: 50f84966f940de9a7a2c76e5befb83f5365b3e94
4
- data.tar.gz: 4813cc9fbec831e8951fb6d11cf74ab172372f17
3
+ metadata.gz: 56c2ce0741ca0d75dcb1cd586655eae5ec4285e2
4
+ data.tar.gz: 6a6aa4f821413ded3863f5e272b9085c4ed4d6aa
5
5
  SHA512:
6
- metadata.gz: a10fe4bba5600588ad392490a034b97c40e375e86d8f9818562c8c89544b4499ac0c48721a6b72a9407dee97090b7c877a4183cdd7f66b97a6dda4eda5022f7b
7
- data.tar.gz: 2d308c23e2cdc4f5f12892d03fdacac234a84c3103171521d29ebf206019e335466263b670b1c9a92ffc34b724544e731fb0650bb091926ec6d30e0980e65467
6
+ metadata.gz: 1a78c49d60bba97c3b98250dbea241fc10c0f467d8f2bd13f1d452c0f87f1f9aa9368784cadf97af3c656148b457d2ab1358c3c1d8ee3e1c55a257f36be7a12d
7
+ data.tar.gz: df5e38b44a36efab9bc46d3f7c0d28a993f39d3fc36f86f494e8368f17c372eb74988a0c21c998adaa5ca0210a003f8d25fa29fce7ad4a5fdef3b33a0fba1656
@@ -3,9 +3,10 @@ require "open3"
3
3
  module PdfCover
4
4
  class Converter
5
5
  # NOTE: Update the generate_jpegs.sh script when changing these values
6
- DEFAULT_FORMAT = "jpeg"
6
+ DEFAULT_FORMAT = "jpeg".freeze
7
7
  DEFAULT_QUALITY = 85
8
8
  DEFAULT_RESOLUTION = 300
9
+ DEFAULT_ANTIALIASING = 4
9
10
 
10
11
  COMMAND_EXECUTION_SUCCESS_CODE = 0
11
12
  COMMAND_NOT_FOUND_CODE = 127 # @see http://www.tldp.org/LDP/abs/html/exitcodes.html
@@ -59,6 +60,8 @@ module PdfCover
59
60
  %W(-sOutputFile='#{destination_path}' -dNOPAUSE
60
61
  -sDEVICE='#{device}' -dJPEGQ=#{@quality}
61
62
  -dFirstPage=1 -dLastPage=1
63
+ -dTextAlphaBits=#{@antialiasing}
64
+ -dGraphicsAlphaBits=#{@antialiasing}
62
65
  -r#{@resolution} -q '#{source}'
63
66
  -c quit
64
67
  ).join(" ")
@@ -86,14 +89,20 @@ module PdfCover
86
89
  @format = options.fetch(:format, DEFAULT_FORMAT)
87
90
  @quality = options.fetch(:quality, DEFAULT_QUALITY).to_i
88
91
  @resolution = options.fetch(:resolution, DEFAULT_RESOLUTION).to_i
92
+ @antialiasing = options.fetch(:antialiasing, DEFAULT_ANTIALIASING).to_i
89
93
 
90
- fail InvalidOption.new(:format, @format) unless %w(jpg jpeg png).include?(@format)
91
- fail InvalidOption.new(:quality, @quality) unless @quality.between?(1, 100)
92
- fail InvalidOption.new(:resolution, @resolution) unless @resolution > 1
94
+ validate_options
93
95
  end
94
96
 
95
97
  def file_path
96
98
  @file_path ||= File.expand_path(@file.path)
97
99
  end
100
+
101
+ def validate_options
102
+ fail InvalidOption.new(:format, @format) unless %w(jpg jpeg png).include?(@format)
103
+ fail InvalidOption.new(:quality, @quality) unless @quality.between?(1, 100)
104
+ fail InvalidOption.new(:resolution, @resolution) unless @resolution > 1
105
+ fail InvalidOption.new(:antialiasing, @antialiasing) unless @antialiasing >= 1 && @antialiasing <= 4
106
+ end
98
107
  end
99
108
  end
@@ -1,3 +1,3 @@
1
1
  module PdfCover
2
- VERSION = "0.2.0".freeze
2
+ VERSION = "0.2.1".freeze
3
3
  end
data/pdf_cover.gemspec CHANGED
@@ -22,12 +22,14 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
+ spec.add_development_dependency "activesupport", "~> 4.2"
26
+
25
27
  spec.add_development_dependency "awesome_print"
26
28
  spec.add_development_dependency "bundler", "~> 1.11"
27
29
  spec.add_development_dependency "rake", "~> 10.0"
28
30
  spec.add_development_dependency "simplecov"
29
31
  spec.add_development_dependency "rspec", "~> 3.0"
30
- spec.add_development_dependency "rubocop", "~> 0.34.1"
32
+ spec.add_development_dependency "rubocop", "~> 0.37.2"
31
33
  spec.add_development_dependency "sqlite3"
32
34
 
33
35
  spec.add_development_dependency "byebug"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf_cover
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan González
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-13 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: awesome_print
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +100,14 @@ dependencies:
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: 0.34.1
103
+ version: 0.37.2
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: 0.34.1
110
+ version: 0.37.2
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: sqlite3
99
113
  requirement: !ruby/object:Gem::Requirement