pdf_margins 0.2.2 → 0.2.3

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
  SHA1:
3
- metadata.gz: 619d5757d93a4628032b0b08bde7c113ff018e09
4
- data.tar.gz: 6eb31f07027078ab0781ff5d1af86feb80cc953a
3
+ metadata.gz: 627c8a5b2633419fa30dc4d9633ca4b5825f822b
4
+ data.tar.gz: 0489558643554e50cdbeaf5c18c78c0a62013e8e
5
5
  SHA512:
6
- metadata.gz: 3abcdd54d6ea558cb1bef046e0f8fbb3ea30cd32ec05aecf25779d9e3be6907827dbc6f58adfce17a27e2b0c3901273e19000d240d3816795375673edfecc429
7
- data.tar.gz: 3a2d41ebb1c00dff9953dbba82ef3de1c81a3c68bf8bc4a2cb547ba04a0b43c81ac11c52df931c24118a9841764958df01f0ef0df702bfa5ef9b2c600f52ad2b
6
+ metadata.gz: 950b461d6e613d583da0e7ae629bc6c04d792fa440ef77e0469e50c2925a2ed061c1927e3852e995f07514f6166582dc443155ccdbcb2624005e45ccbc241141
7
+ data.tar.gz: 646cb27222b39c19529abdf79915afff2a8f875c73fbba2efcfac0b242e0889279813ec99c2152554f2954ea792f000a61ea5bc47ec94a63443600969bd2258a
@@ -1,4 +1,5 @@
1
1
  require 'pdf/margins/issue'
2
+ require 'pdf/margins/errors'
2
3
  require 'chunky_png'
3
4
  require 'oily_png'
4
5
  require 'tmpdir'
@@ -33,7 +34,7 @@ module PDF
33
34
  begin
34
35
  # This produces greyscale PNGs - we throw the colour away because we
35
36
  # don't need it to check for margins.
36
- system("mudraw -g -b 0 -r #{RESOLUTION} -o #{temp_dir_path}/%d.png #{file_path}") || raise
37
+ system("mudraw -g -b 0 -r #{RESOLUTION} -o #{temp_dir_path}/%d.png #{file_path}") || raise(PDF::Margins::MuDrawCommandError)
37
38
 
38
39
  issues = []
39
40
 
@@ -0,0 +1,5 @@
1
+ module PDF
2
+ module Margins
3
+ class MuDrawCommandError < RuntimeError; end
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  module PDF
2
2
  module Margins
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.3"
4
4
  end
5
5
  end
@@ -86,4 +86,10 @@ class CheckerTest < Test::Unit::TestCase
86
86
  assert_equal [], checker.issues
87
87
  end
88
88
 
89
+ test "shelling out to mudraw fails" do
90
+ checker = PDF::Margins::Checker.new(pdf_path('bottom-margin-only.pdf'), 15, 15, 15, 15)
91
+ checker.expects(:system).returns(false)
92
+ assert_raises(PDF::Margins::MuDrawCommandError) { checker.issues }
93
+ end
94
+
89
95
  end
@@ -1,5 +1,6 @@
1
1
  require 'test/unit'
2
2
  require 'pdf/margins'
3
+ require 'mocha/setup'
3
4
 
4
5
  class Test::Unit::TestCase
5
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf_margins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Taylor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-15 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mocha
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 0.14.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 0.14.0
69
83
  description:
70
84
  email:
71
85
  - tom@newspaperclub.com
@@ -74,6 +88,7 @@ extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
76
90
  - lib/pdf/margins/checker.rb
91
+ - lib/pdf/margins/errors.rb
77
92
  - lib/pdf/margins/issue.rb
78
93
  - lib/pdf/margins/version.rb
79
94
  - lib/pdf/margins.rb