wisepdf 1.0.1 → 1.0.2

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.
Files changed (5) hide show
  1. data/Gemfile.lock +32 -32
  2. data/VERSION +1 -1
  3. data/lib/wisepdf/writer.rb +9 -19
  4. data/wisepdf.gemspec +2 -2
  5. metadata +15 -15
data/Gemfile.lock CHANGED
@@ -1,31 +1,31 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actionmailer (3.2.2)
5
- actionpack (= 3.2.2)
6
- mail (~> 2.4.0)
7
- actionpack (3.2.2)
8
- activemodel (= 3.2.2)
9
- activesupport (= 3.2.2)
4
+ actionmailer (3.2.3)
5
+ actionpack (= 3.2.3)
6
+ mail (~> 2.4.4)
7
+ actionpack (3.2.3)
8
+ activemodel (= 3.2.3)
9
+ activesupport (= 3.2.3)
10
10
  builder (~> 3.0.0)
11
11
  erubis (~> 2.7.0)
12
12
  journey (~> 1.0.1)
13
13
  rack (~> 1.4.0)
14
- rack-cache (~> 1.1)
14
+ rack-cache (~> 1.2)
15
15
  rack-test (~> 0.6.1)
16
16
  sprockets (~> 2.1.2)
17
- activemodel (3.2.2)
18
- activesupport (= 3.2.2)
17
+ activemodel (3.2.3)
18
+ activesupport (= 3.2.3)
19
19
  builder (~> 3.0.0)
20
- activerecord (3.2.2)
21
- activemodel (= 3.2.2)
22
- activesupport (= 3.2.2)
20
+ activerecord (3.2.3)
21
+ activemodel (= 3.2.3)
22
+ activesupport (= 3.2.3)
23
23
  arel (~> 3.0.2)
24
24
  tzinfo (~> 0.3.29)
25
- activeresource (3.2.2)
26
- activemodel (= 3.2.2)
27
- activesupport (= 3.2.2)
28
- activesupport (3.2.2)
25
+ activeresource (3.2.3)
26
+ activemodel (= 3.2.3)
27
+ activesupport (= 3.2.3)
28
+ activesupport (3.2.3)
29
29
  i18n (~> 0.6)
30
30
  multi_json (~> 1.0)
31
31
  arel (3.0.2)
@@ -39,13 +39,13 @@ GEM
39
39
  git (>= 1.2.5)
40
40
  rake
41
41
  journey (1.0.3)
42
- json (1.6.5)
43
- mail (2.4.3)
42
+ json (1.6.6)
43
+ mail (2.4.4)
44
44
  i18n (>= 0.4.0)
45
45
  mime-types (~> 1.16)
46
46
  treetop (~> 1.4.8)
47
- mime-types (1.17.2)
48
- multi_json (1.1.0)
47
+ mime-types (1.18)
48
+ multi_json (1.3.2)
49
49
  polyglot (0.3.3)
50
50
  rack (1.4.1)
51
51
  rack-cache (1.2)
@@ -54,17 +54,17 @@ GEM
54
54
  rack
55
55
  rack-test (0.6.1)
56
56
  rack (>= 1.0)
57
- rails (3.2.2)
58
- actionmailer (= 3.2.2)
59
- actionpack (= 3.2.2)
60
- activerecord (= 3.2.2)
61
- activeresource (= 3.2.2)
62
- activesupport (= 3.2.2)
57
+ rails (3.2.3)
58
+ actionmailer (= 3.2.3)
59
+ actionpack (= 3.2.3)
60
+ activerecord (= 3.2.3)
61
+ activeresource (= 3.2.3)
62
+ activesupport (= 3.2.3)
63
63
  bundler (~> 1.0)
64
- railties (= 3.2.2)
65
- railties (3.2.2)
66
- actionpack (= 3.2.2)
67
- activesupport (= 3.2.2)
64
+ railties (= 3.2.3)
65
+ railties (3.2.3)
66
+ actionpack (= 3.2.3)
67
+ activesupport (= 3.2.3)
68
68
  rack-ssl (~> 1.3.2)
69
69
  rake (>= 0.8.7)
70
70
  rdoc (~> 3.4)
@@ -81,13 +81,13 @@ GEM
81
81
  hike (~> 1.2)
82
82
  rack (~> 1.0)
83
83
  tilt (~> 1.1, != 1.3.0)
84
- sqlite3 (1.3.5)
84
+ sqlite3 (1.3.6)
85
85
  thor (0.14.6)
86
86
  tilt (1.3.3)
87
87
  treetop (1.4.10)
88
88
  polyglot
89
89
  polyglot (>= 0.3.1)
90
- tzinfo (0.3.32)
90
+ tzinfo (0.3.33)
91
91
  wkhtmltopdf-binary (0.9.5.3)
92
92
 
93
93
  PLATFORMS
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -1,16 +1,6 @@
1
- # wkhtml2pdf Ruby interface
2
- # http://code.google.com/p/wkhtmltopdf/
3
-
4
- require 'logger'
5
- require 'digest/md5'
6
- require 'rbconfig'
7
- require RbConfig::CONFIG['target_os'] == 'mingw32' && !(RUBY_VERSION =~ /1.9/) ? 'win32/open3' : 'open3'
8
1
  require 'active_support/core_ext/class/attribute_accessors'
9
2
  require 'active_support/core_ext/object/blank'
10
3
 
11
- # require 'wicked_pdf_railtie'
12
- require 'tempfile'
13
-
14
4
  module Wisepdf
15
5
  class Writer
16
6
  def initialize(path=nil)
@@ -20,17 +10,17 @@ module Wisepdf
20
10
  def to_pdf(string, options={})
21
11
  command = "\"#{self.wkhtmltopdf}\" #{parse_options(options)} #{'-q ' unless Wisepdf::Configuration.windows?}- - " # -q for no errors on stdout
22
12
  print_command(command) if Wisepdf::Configuration.development?
23
- pdf, err = Open3.popen3(command) do |stdin, stdout, stderr|
24
- stdin.binmode
25
- stdout.binmode
26
- stderr.binmode
27
- stdin.write(string)
28
- stdin.close
29
- [stdout.read, stderr.read]
13
+
14
+
15
+ result = IO.popen(command, "wb+") do |pdf|
16
+ pdf.puts(string)
17
+ pdf.close_write
18
+ pdf.gets(nil)
30
19
  end
31
- raise Wisepdf::WriteError if pdf && pdf.rstrip.length == 0
32
20
 
33
- return pdf
21
+ raise Wisepdf::WriteError if result && result.rstrip.length == 0
22
+
23
+ return result
34
24
  end
35
25
 
36
26
  def wkhtmltopdf
data/wisepdf.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "wisepdf"
8
- s.version = "1.0.1"
8
+ s.version = "1.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Igor Alexandrov"]
12
- s.date = "2012-03-28"
12
+ s.date = "2012-04-26"
13
13
  s.description = "wisepdf uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML. In other words, rather than dealing with a PDF generation DSL of some sort, you simply write an HTML view as you would normally, and let pdf take care of the hard stuff."
14
14
  s.email = "igor.alexandrov@gmail.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wisepdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-28 00:00:00.000000000 Z
12
+ date: 2012-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70198037665340 !ruby/object:Gem::Requirement
16
+ requirement: &70107111067040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70198037665340
24
+ version_requirements: *70107111067040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &70198037662120 !ruby/object:Gem::Requirement
27
+ requirement: &70107111066300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70198037662120
35
+ version_requirements: *70107111066300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: wkhtmltopdf-binary
38
- requirement: &70198037672040 !ruby/object:Gem::Requirement
38
+ requirement: &70107111065720 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70198037672040
46
+ version_requirements: *70107111065720
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: shoulda
49
- requirement: &70198037686120 !ruby/object:Gem::Requirement
49
+ requirement: &70107111065200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70198037686120
57
+ version_requirements: *70107111065200
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &70198037697280 !ruby/object:Gem::Requirement
60
+ requirement: &70107111064660 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70198037697280
68
+ version_requirements: *70107111064660
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
- requirement: &70198037693300 !ruby/object:Gem::Requirement
71
+ requirement: &70107111083360 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 1.6.4
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70198037693300
79
+ version_requirements: *70107111083360
80
80
  description: wisepdf uses the shell utility wkhtmltopdf to serve a PDF file to a user
81
81
  from HTML. In other words, rather than dealing with a PDF generation DSL of some
82
82
  sort, you simply write an HTML view as you would normally, and let pdf take care
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  segments:
174
174
  - 0
175
- hash: -909150649677185423
175
+ hash: -2728051864180077466
176
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  none: false
178
178
  requirements: