prawnto_2 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -16,7 +16,7 @@ This is my attempt to merge the various forks of the prawnto gem, and <b>update
16
16
 
17
17
  In your <code>Gemfile</code>:
18
18
 
19
- gem "prawnto_2", "0.2.0.beta6", :require => "prawnto"
19
+ gem "prawnto_2", :require => "prawnto"
20
20
 
21
21
  Then run:
22
22
 
@@ -58,7 +58,7 @@ If you need something more complicated, you may want to consider using the <code
58
58
 
59
59
  === From Model (or anywhere else)
60
60
 
61
- Experimental!!!
61
+ <b>Experimental!!! Will be changed</b>
62
62
 
63
63
  Sometimes you need to be able to render a PDF from anywhere (Background process saving to the File, combining PDFs, etc), but you still want access to your helpers. This feature instantiates the most basic controller, and renders the template to a string for you to use. (more info coming to wiki soon)
64
64
 
@@ -74,11 +74,11 @@ Sometimes you need to be able to render a PDF from anywhere (Background process
74
74
 
75
75
  ---
76
76
 
77
- == Tips
77
+ == Tips & Tricks
78
78
 
79
79
  While layouts and partials aren't yet supported, helper methods can be called from within the PDF views. To help keep PDF's DRY, I would recommend creating a <code>PdfHelper</code> class for complex functionality. Don't forget to add this helper to your emailer if you generate PDF's as attachments.
80
80
 
81
- == Contributing & Reporting Issues
81
+ = Contributing & Reporting Issues
82
82
 
83
83
  Obviously, all code contributions are greatly appreciated. We also need help with testing and the wiki.
84
84
 
@@ -89,4 +89,4 @@ While I can't promise the most speedy response, I do plan to continue to maintai
89
89
 
90
90
  Copyright on Updates - Copyright (c) 2011 OctopusApp Inc. ({getjobber.com}[http://getjobber.com]), released under the MIT license
91
91
 
92
- Original Copyright - Copyright (c) 2008 cracklabs.com, released under the MIT license
92
+ Original Copyright - Copyright (c) 2008 cracklabs.com, released under the MIT license
@@ -4,10 +4,20 @@ module Prawnto
4
4
  module TemplateHandlers
5
5
  class Base
6
6
  def self.call(template)
7
+ check_for_pdf_redefine(template.source)
8
+
7
9
  "_prawnto_compile_setup;" +
8
10
  "renderer = Prawnto::TemplateHandlers::Renderer.new(self);"+
9
11
  "renderer.to_pdf do; #{template.source}\nend;"
10
12
  end
13
+
14
+ private
15
+
16
+ def self.check_for_pdf_redefine(template_source)
17
+ if template_source =~ /pdf\s*=[^=]/
18
+ Rails.logger.debug "\nPrawnto Warning! It looks like you may be redefining 'pdf' in your .prawn template. This no longer works in Prawnto 2+. Please use the :prawnto method in your controller\n"
19
+ end
20
+ end
11
21
  end
12
22
  end
13
23
  end
data/prawnto.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "prawnto_2"
4
- s.version = '0.2.0'
4
+ s.version = '0.2.1'
5
5
  s.author = ["Forrest"]
6
6
  s.email = ["development@forrestzeisler.com"]
7
7
  s.date = Time.now.utc.strftime("%Y-%m-%d")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prawnto_2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
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-01-27 00:00:00.000000000Z
12
+ date: 2012-01-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70260867243920 !ruby/object:Gem::Requirement
16
+ requirement: &70122410568160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70260867243920
24
+ version_requirements: *70122410568160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: prawn
27
- requirement: &70260867243460 !ruby/object:Gem::Requirement
27
+ requirement: &70122410567660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 0.12.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70260867243460
35
+ version_requirements: *70122410567660
36
36
  description: Simple PDF generation using the prawn library.
37
37
  email:
38
38
  - development@forrestzeisler.com