prawn-rails 1.0.1 → 1.1.0

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -6
  3. data/README.md +11 -17
  4. data/lib/prawn-rails/document.rb +4 -6
  5. data/lib/prawn-rails/load_prawn_plugins.rb +11 -0
  6. data/lib/prawn-rails/rails_helper.rb +12 -6
  7. data/lib/prawn-rails/renderer.rb +3 -0
  8. data/lib/prawn-rails/version.rb +1 -1
  9. data/test/{dummy → dummy_app}/Rakefile +0 -0
  10. data/test/{dummy/db/test.sqlite3 → dummy_app/app/assets/javascripts/application.js} +0 -0
  11. data/test/dummy_app/app/assets/stylesheets/application.css +3 -0
  12. data/test/{dummy → dummy_app}/app/controllers/application_controller.rb +0 -0
  13. data/test/dummy_app/app/controllers/reports_controller.rb +18 -0
  14. data/test/{dummy → dummy_app}/app/views/layouts/application.html.erb +1 -1
  15. data/test/dummy_app/app/views/reports/sample.html.erb +1 -0
  16. data/test/{dummy/app/views/pdf/render_pdf.pdf.prawn → dummy_app/app/views/reports/sample.pdf.prawn} +13 -9
  17. data/test/dummy_app/app/views/reports/table.pdf.prawn +7 -0
  18. data/test/{dummy → dummy_app}/config.ru +0 -0
  19. data/test/{dummy → dummy_app}/config/application.rb +19 -1
  20. data/test/{dummy → dummy_app}/config/boot.rb +0 -0
  21. data/test/{dummy → dummy_app}/config/database.yml +0 -0
  22. data/test/{dummy → dummy_app}/config/environment.rb +0 -0
  23. data/test/{dummy → dummy_app}/config/environments/development.rb +0 -0
  24. data/test/{dummy → dummy_app}/config/environments/production.rb +0 -0
  25. data/test/{dummy → dummy_app}/config/environments/test.rb +0 -0
  26. data/test/{dummy → dummy_app}/config/initializers/backtrace_silencers.rb +0 -0
  27. data/test/{dummy → dummy_app}/config/initializers/inflections.rb +0 -0
  28. data/test/{dummy → dummy_app}/config/initializers/mime_types.rb +0 -0
  29. data/test/dummy_app/config/initializers/prawn-rails.rb +5 -0
  30. data/test/{dummy → dummy_app}/config/initializers/secret_token.rb +5 -1
  31. data/test/{dummy → dummy_app}/config/initializers/session_store.rb +1 -1
  32. data/test/{dummy → dummy_app}/config/initializers/wrap_parameters.rb +1 -1
  33. data/test/{dummy → dummy_app}/config/locales/en.yml +0 -0
  34. data/test/dummy_app/config/routes.rb +4 -0
  35. data/test/{dummy → dummy_app}/config/secrets.yml +0 -0
  36. data/test/{dummy → dummy_app}/db/schema.rb +1 -8
  37. data/test/{dummy/public/favicon.ico → dummy_app/db/test.sqlite3} +0 -0
  38. data/test/dummy_app/log/test.log +2921 -0
  39. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/-E/-EGHXi_ULbX3JP7NLAsVLUrIZgOg0HxdFnvlbmA7DCA.cache +1 -0
  40. data/test/{dummy/tmp/cache/assets/sprockets/v3.0/mQ/mQditvxd7m-nwTpkGVCOalFZesEjSbG8EOKqC3zq108.cache → dummy_app/tmp/cache/assets/sprockets/v3.0/3N/3NnKgR2TsTI1qCXKZpts0uJzp2dRJcoYp3nnFU6YE4o.cache} +1 -1
  41. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/4O/4O6Anm3R8aSIVfMhGtp5tZK3x17fcY1SbWoDN_6hb-o.cache +2 -0
  42. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/Bl/BlRucSL6BNAMZvHs4UVilikqNOKnbCHSGHIQRgtKvFQ.cache +1 -0
  43. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/E1/E18Q7xE2E1RWvLRrvvBEf0ahfumckOlJWqD7YiPqLAk.cache +0 -0
  44. data/test/{dummy/tmp/cache/assets/sprockets/v3.0/7k/7knv2O_3Eod2l8h0YSVe5xjnQsDlsXbJffQ1dKiSrEs.cache → dummy_app/tmp/cache/assets/sprockets/v3.0/LR/LRLaw7viwBb9Mi_VFZxGbKIooy8Fqf1aB_iOTETsMyc.cache} +1 -1
  45. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/Mj/MjwYGG9GkHD1fwwH2bg66EBYl3zCA_mqeDF9otey4-U.cache +3 -0
  46. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/QP/QPocswuHM6KXKYd99JclYrybZep_vYHyfZQ-nGJB5uU.cache +1 -0
  47. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/S9/S9TmgasHOyBiOSg3OOpu2mzuUwMxxUE3zyKrExqIryQ.cache +0 -0
  48. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/VK/VKv8TUCURhWXKU5qrG7ocs75FsysCWNtswhqtTi7Lfw.cache +0 -0
  49. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/dZ/dZLyjSvZKmLRvanBa3SmJ58gtb_fQaHMzS1A04p2x_4.cache +1 -0
  50. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/kA/kAfbx3YIMg0L2tevtZdwbRjKKy9xOmYlXJ7LapMXDME.cache +1 -0
  51. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/mn/mnaHTtsBvdmAbdqsorI0KqFoT2eQIhgDVER_He3q2HU.cache +1 -0
  52. data/test/dummy_app/tmp/cache/assets/sprockets/v3.0/rT/rTYHFXiH_g6ZVTgNXdVrDz3fihYKq9Diqso1lzP257o.cache +0 -0
  53. data/test/integration/prawn_rails_test.rb +64 -0
  54. data/test/prawn_rails_test.rb +11 -0
  55. data/test/test_helper.rb +1 -1
  56. metadata +97 -163
  57. data/lib/prawn-rails/extension.rb +0 -48
  58. data/test/dummy/app/assets/javascripts/application.js +0 -7
  59. data/test/dummy/app/assets/stylesheets/application.css +0 -7
  60. data/test/dummy/app/assets/stylesheets/scaffold.css +0 -56
  61. data/test/dummy/app/controllers/pdf_controller.rb +0 -9
  62. data/test/dummy/app/helpers/application_helper.rb +0 -2
  63. data/test/dummy/app/helpers/pdf_helper.rb +0 -2
  64. data/test/dummy/app/helpers/products_helper.rb +0 -2
  65. data/test/dummy/app/models/product.rb +0 -2
  66. data/test/dummy/app/views/pdf/render_pdf.html.erb +0 -2
  67. data/test/dummy/config/initializers/prawn-rails.rb +0 -4
  68. data/test/dummy/config/routes.rb +0 -62
  69. data/test/dummy/log/test.log +0 -390
  70. data/test/dummy/public/404.html +0 -26
  71. data/test/dummy/public/422.html +0 -26
  72. data/test/dummy/public/500.html +0 -26
  73. data/test/dummy/script/rails +0 -6
  74. data/test/dummy/test/functional/pdf_controller_test.rb +0 -21
  75. data/test/dummy/test/unit/helpers/pdf_helper_test.rb +0 -4
  76. data/test/dummy/test/unit/render_to_string_test.rb +0 -10
  77. data/test/dummy/tmp/cache/assets/sprockets/v3.0/3H/3HKwxPtsFtIWWB8h3a3IubpM4GcVjstICkerRFO439k.cache +0 -0
  78. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7M/7Mq76IhtBe2-VV2M2oHVxXAVG_QLm5SrCNxRggF8RPc.cache +0 -0
  79. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7z/7zCgQfsGmkfNRDRJbRNwZOHR1KjCn5eXK6kQ3MD3Q2I.cache +0 -1
  80. data/test/dummy/tmp/cache/assets/sprockets/v3.0/8k/8k3y_LCz9mDUxOJy9Q2XGrbzfTesQnWYC0cQP1TOvFs.cache +0 -1
  81. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Dm/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +0 -3
  82. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Fl/FlyzzCH6xseKijuu-xP3_W0V8-1cWLl95YXDNxYDUNo.cache +0 -1
  83. data/test/dummy/tmp/cache/assets/sprockets/v3.0/HC/HCD43uamHiSFgGxIxwnhpFVOmIxP1BnzNNvNivaWbpk.cache +0 -0
  84. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Lx/LxtjvSVJOouLYZBYfdC_AjDQkYKKKEs3M10Vum5cJEg.cache +0 -1
  85. data/test/dummy/tmp/cache/assets/sprockets/v3.0/PK/PKWLCqd6Zhyt0ja1qijEKFaHwfBpCAHEosX412uU-V8.cache +0 -3
  86. data/test/dummy/tmp/cache/assets/sprockets/v3.0/PS/PSRh_XH9lrFbchQbAFcC08Qv6_y-Bgv7sjtfpKR-OUM.cache +0 -1
  87. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Qo/QoWFwSTYT96pcyCl7-2W0dwnhAcu5C8LIcoBrcDyStI.cache +0 -1
  88. data/test/dummy/tmp/cache/assets/sprockets/v3.0/VD/VDc9sGDOOPm5eVmRJ2f2cRjTaKC11SnKHOpHHbyChl0.cache +0 -0
  89. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Ve/VeM604IZ64WdmC055DY5x0e5Hi8rcIAqhYJI5EcopDI.cache +0 -1
  90. data/test/dummy/tmp/cache/assets/sprockets/v3.0/X0/X0IS1nkiVmMS3U903Hrwc01kDe2ajHoeo61xuHfbM6c.cache +0 -1
  91. data/test/dummy/tmp/cache/assets/sprockets/v3.0/bB/bBZWYaOxRNh_QSoJcD-Mkvcz9KgvY-dG9fwXISEG4K8.cache +0 -0
  92. data/test/dummy/tmp/cache/assets/sprockets/v3.0/dY/dYpMqE0kCuH8r1W0qAG7zvVC38Hq4BT-1D--XGbeNXg.cache +0 -0
  93. data/test/dummy/tmp/cache/assets/sprockets/v3.0/jH/jHI2oSw0VjtEfiiHzdvIRzqjkX7EfibPviTfzvDJie0.cache +0 -0
  94. data/test/dummy/tmp/cache/assets/sprockets/v3.0/jl/jlvE-YiBY3zJbTaEnymfM6KKQ0VC4fh-ABin-DfZQH0.cache +0 -2
  95. data/test/dummy/tmp/cache/assets/sprockets/v3.0/lW/lWicvOny7LscyeGkw-SjCaJEc6iQO2xyCQzEoCOT9io.cache +0 -0
  96. data/test/dummy/tmp/cache/assets/sprockets/v3.0/mq/mqcnbDYKKUpY94uXsWbGbcRGZwaZNlC1pynK_1spLG8.cache +0 -1
  97. data/test/dummy/tmp/cache/assets/sprockets/v3.0/np/nppFP1_0FGLqnQh_ZUlGiPLii5Lqbpv4cXNPXvimFF4.cache +0 -1
  98. data/test/dummy/tmp/cache/assets/sprockets/v3.0/oU/oUvIYed-Tb8hZ7gKa7FPpyhkc6vqXdyiMHNRI89fMO0.cache +0 -0
  99. data/test/dummy/tmp/cache/assets/sprockets/v3.0/sG/sG274Dzr6XE-W7yJehcXagYHbLDgelrH4-7lrdytdI4.cache +0 -1
  100. data/test/dummy/tmp/cache/assets/sprockets/v3.0/tA/tAy3LvgiPR3JYEMcVE38njAzFe3XLQuc5fZueLWu5Yo.cache +0 -0
  101. data/test/dummy/tmp/cache/assets/sprockets/v3.0/uO/uOOMjW4h-byBJFu52K4-uCeQA35aLhrqzzfRswpey-s.cache +0 -1
  102. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vp/vpF3NlYVMkWc7PivIOC4SAKJ51RzYEXyTRKvfmsMGFg.cache +0 -1
  103. data/test/dummy/tmp/cache/assets/sprockets/v3.0/vv/vvP0dfbO8asNpteZs8hiM8s9YwP9qcQRAiF0Flm_2cw.cache +0 -1
  104. data/test/dummy/tmp/cache/assets/sprockets/v3.0/w3/w3opA7mSLePTdHCpuCBqduTsSbwUIgiPnFcb4oLM4g4.cache +0 -0
  105. data/test/dummy/tmp/cache/assets/sprockets/v3.0/we/wetuI3DMxRNUJ59_Ht2tI_UznmZ4Qo6YaFQaObX5Yeo.cache +0 -1
  106. data/test/dummy/tmp/cache/assets/sprockets/v3.0/wn/wnvJ74QIdj8tSD10cXmY9KyXCpaQIv0FfZJWw-EudW8.cache +0 -0
  107. data/test/dummy/tmp/cache/assets/sprockets/v3.0/xP/xPMfTXGxxCCgIip6XsG-paelKjnDzbpAYugLmUfykPs.cache +0 -0
  108. data/test/dummy/tmp/cache/assets/sprockets/v3.0/zT/zTsAvZfthhhPVIOWyDH3KWWRuZ8HnBYMveoWvD-u9_k.cache +0 -1
  109. data/test/integration/navigation_test.rb +0 -9
  110. data/test/prawn-rails_test.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ba5a030e5ed002fe37dbc7639962f1cf925649c
4
- data.tar.gz: f2efee0ca9bc3c78882a1ed529bc4379a65c9bcb
3
+ metadata.gz: 750f17f633f0a7d1dbc8114142479708d88029db
4
+ data.tar.gz: ad0bfd62383c511bf82996dd64de18078450a03b
5
5
  SHA512:
6
- metadata.gz: 2d05c397717c70f5898062126854ecd21414730b16fdb95168cdb3908984d7997237cf4efd39311f73dc47145f19df04aef9d212b2b08612b23f8091e1a54625
7
- data.tar.gz: f1226cbf7cd6c3dc7736bcfd76e4537570e1c234b4b8d437e8d994000e0e3ce2b07e9207b779b59641af894629f28c96770f0db68ead2fc7936ac2f771a88515
6
+ metadata.gz: 9b76d0d73b1a168b9fdebe56766b5d4e743df421cc4f5cb2214f7647eb34fb75ecf8834d34f418d4839228e7cdc69a3b8a339bc085db322d31fbbbe8975c1675
7
+ data.tar.gz: 2c7c30748577994849c8c7c19dddc26fb05c69a7beb300a0a0635f7bc3e4c7ca912a96a4d02d0d86dbce0b9e9a98386f8fee13e94f80601f1b68cd5c5bccc87e
data/CHANGELOG.md CHANGED
@@ -1,15 +1,23 @@
1
1
  # Changelog
2
2
 
3
- * `v1.0.1` - UNRELEASED
3
+ * `Unreleased`
4
+ - Nothing yet
5
+
6
+ * `v1.1.0`
7
+ - [#29](https://github.com/cortiz/prawn-rails/pull/29) - Require all installed prawn extensions
8
+ - Removed unnecessary `html_strip` helper method. If you were using this feature, instead use Rails built in `strip_tags(html_str)` or `ActionView::Base.full_sanitizer.sanitize(html_str)`
9
+ - Add legitimate tests
10
+
11
+ * `v1.0.1`
4
12
  - Fix error when using `ActionController.render_to_string`
5
13
 
6
- * `v1.0.0` - January 21, 2017
14
+ * `v1.0.0`
7
15
  - Support `@filename`
8
16
  - Set PDF Title metadata based on `@filename` if not specified
9
17
  - Fix for Ruby 1.9.3+
10
18
  - Cleanup
11
19
 
12
- * `v0.1.1` - January 12, 2015
13
- * `v0.1.0` - October 7, 2014
14
- * `v0.0.2` - February 22, 2012
15
- * `v0.0.1` - February 21, 2012
20
+ * `v0.1.1`
21
+ * `v0.1.0`
22
+ * `v0.0.2`
23
+ * `v0.0.1`
data/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # Prawn-Rails [![Gem Version](https://badge.fury.io/rb/prawn-rails.svg)](http://badge.fury.io/rb/prawn-rails)
2
2
  <a href='http://ko-fi.com/A552JBK' target='_blank'><img height='32' style='border:0px;height:32px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=a' border='0' alt='Buy Me a Coffee' /></a>
3
3
 
4
- ## Install
4
+ # Install
5
5
  ```ruby
6
6
  gem 'prawn-rails'
7
7
  ```
8
8
 
9
9
  Note: `prawn` and `prawn-table` are dependencies of `prawn-rails` so there is no need to mention it in the projects Gemfile unless you want to use a specific version of either of those libraries.
10
10
 
11
- ## Usage
11
+ # Usage
12
12
  Create a view with `pdf` as format and `prawn` as handler so filename should look like `example.pdf.prawn`
13
13
 
14
14
  It provides a helper called `prawn_document` which builds a PrawnRails::Document with default options. You can override any options as you please. Example:
@@ -29,11 +29,7 @@ def show
29
29
  end
30
30
  ```
31
31
 
32
- ## Built-in Helpers
33
- * *html_strip(html)*:
34
- Removes the html tags from a string
35
-
36
- ## Default configuration
32
+ # Default configuration
37
33
 
38
34
  Add a `prawn-rails.rb` config to your Rails app under `config/initializers` like this
39
35
 
@@ -59,9 +55,9 @@ pdf.start_new_page
59
55
  pdf.start_new_page size: "A4", page_layout: :portrait
60
56
  ```
61
57
 
62
- ## Examples
58
+ # Examples
63
59
 
64
- 1. **Hello World**
60
+ #### Hello World
65
61
 
66
62
  ```ruby
67
63
  # hello.pdf.prawn
@@ -71,7 +67,7 @@ prawn_document do |pdf|
71
67
  end
72
68
  ```
73
69
 
74
- 2. ** Using Active Record **
70
+ #### Using Active Record
75
71
 
76
72
  ```ruby
77
73
  # myproducts.pdf.prawn
@@ -82,7 +78,7 @@ prawn_document do |pdf|
82
78
  pdf.table @products.collect{|p| [p.name,p.price]}
83
79
  end
84
80
  ```
85
- 3. ** Using Custom options **
81
+ #### Using Custom options
86
82
 
87
83
  ```ruby
88
84
  # landscape.pdf.prawn
@@ -92,12 +88,10 @@ prawn_document(page_layout: :landscape) do |pdf|
92
88
  end
93
89
  ```
94
90
 
95
- ## Credits
96
-
97
- Created by Carlos Ortiz - @cortiz
98
-
99
- <a href='http://ko-fi.com/A552JBK' target='_blank'><img height='32' style='border:0px;height:32px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=a' border='0' alt='Buy Me a Coffee' /></a>
91
+ # Credits
100
92
 
101
93
  Maintained by Weston Ganger - @westonganger
102
94
 
103
- Special thanks to @rwilliams, @sigmike, @smber1, @iffyuva
95
+ Created by Carlos Ortiz - @cortiz
96
+
97
+ <a href='http://ko-fi.com/A552JBK' target='_blank'><img height='32' style='border:0px;height:32px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=a' border='0' alt='Buy Me a Coffee' /></a>
@@ -1,10 +1,10 @@
1
1
  require 'prawn'
2
- require 'prawn/table'
3
- require "prawn-rails/extension"
2
+ require 'prawn-rails/load_prawn_plugins'
4
3
 
5
4
  module PrawnRails
6
5
 
7
- # This derives from Prawn::Document in order to override defaults. Note that the Prawn::Document behaviour itself shouldn't be changed.
6
+ # This derives from Prawn::Document in order to override defaults.
7
+ # Note that the Prawn::Document behaviour itself shouldn't be changed.
8
8
  class Document < Prawn::Document
9
9
  def initialize(opts = {})
10
10
  if PrawnRails.config.respond_to?(:to_h)
@@ -15,8 +15,7 @@ module PrawnRails
15
15
  super(default)
16
16
  end
17
17
 
18
- # Typically text expects a string. But rails views have this interesting concept that they implicitly call
19
- # `to_s` on all the variables before rendering. So, passing an integer to text fails:
18
+ # Typically text expects a string. But Rails views have this interesting concept that they implicitly call `to_s` on all the variables before rendering. So, passing an integer to text fails:
20
19
  #
21
20
  # pdf.text 10 #=> fails because 10 is not a string
22
21
  # pdf.text 10.to_s #=> works
@@ -27,5 +26,4 @@ module PrawnRails
27
26
  end
28
27
  end
29
28
 
30
- Document.extensions << Extension
31
29
  end
@@ -0,0 +1,11 @@
1
+ Gem.loaded_specs.keys.select{|spec_name| spec_name.starts_with?('prawn-')}.each do |gem_name|
2
+ next if gem_name == 'prawn-rails' # Prevent circular loading
3
+
4
+ file = gem_name.gsub('-', '/')
5
+
6
+ begin
7
+ require file
8
+ rescue LoadError => _
9
+ STDERR.puts "#{__FILE__}:#{__LINE__}: warning: prawn-rails could not require plugin `#{gem_name}`"
10
+ end
11
+ end
@@ -2,14 +2,19 @@ require 'prawn-rails/document'
2
2
 
3
3
  module PrawnRails
4
4
  module RailsHelper
5
+
5
6
  def prawn_document(options={})
6
- options.reverse_merge!(page_layout: PrawnRails.config.page_layout,
7
- page_size: PrawnRails.config.page_size,
8
- info: {
9
- Title: @filename.sub(/\.(p|P)(d|D)(f|F)$/, '')
10
- })
7
+ options.reverse_merge!({
8
+ page_layout: PrawnRails.config.page_layout,
9
+ page_size: PrawnRails.config.page_size,
10
+ info: {
11
+ Title: @filename.sub(/\.(p|P)(d|D)(f|F)$/, '')
12
+ }
13
+ })
11
14
 
12
- options.reverse_merge!(skip_page_creation: true) if PrawnRails.config.skip_page_creation
15
+ if PrawnRails.config.skip_page_creation
16
+ options.reverse_merge!(skip_page_creation: true)
17
+ end
13
18
 
14
19
  pdf = PrawnRails::Document.new(options)
15
20
 
@@ -17,5 +22,6 @@ module PrawnRails
17
22
 
18
23
  pdf.render
19
24
  end
25
+
20
26
  end
21
27
  end
@@ -2,6 +2,8 @@ require "prawn-rails/document"
2
2
 
3
3
  module PrawnRails
4
4
  class Renderer
5
+
6
+ ### WARNING: BE VERY CAREFUL IF EDITING THIS METHOD
5
7
  def self.call(template)
6
8
  %{
7
9
  @filename ||= "\#{controller.action_name}.pdf"
@@ -13,5 +15,6 @@ module PrawnRails
13
15
  #{template.source.strip}
14
16
  }
15
17
  end
18
+
16
19
  end
17
20
  end
@@ -1,3 +1,3 @@
1
1
  module PrawnRails
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
File without changes
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require_self
3
+ */
@@ -0,0 +1,18 @@
1
+ class ReportsController < ApplicationController
2
+
3
+ def sample
4
+ @items = [
5
+ {name: "Hello"},
6
+ {name: "World"},
7
+ ]
8
+ end
9
+
10
+ def table
11
+ @items = [
12
+ [1,2,3],
13
+ [4,5,6],
14
+ [7,8,9],
15
+ ]
16
+ end
17
+
18
+ end
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>Dummy</title>
4
+ <title>Dummy App</title>
5
5
  <%= stylesheet_link_tag "application" %>
6
6
  <%= javascript_include_tag "application" %>
7
7
  <%= csrf_meta_tags %>
@@ -0,0 +1 @@
1
+ <h1>Hello World!</h1>
@@ -1,13 +1,15 @@
1
1
  prawn_document(page_layout: :portrait) do |pdf|
2
- pdf.text "Hello There :D"
2
+ pdf.text "Hello World!"
3
3
  pdf.text "now it is here: #{pdf.cursor}"
4
- pdf.text "Items are #{@items.inspect}"
4
+ pdf.text "Number of Items: #{@items.count}"
5
+
5
6
  pdf.font("Courier") do
6
7
  pdf.text "Written in Courier because we are inside the block."
7
8
  end
8
9
 
9
10
  pdf.text "with html<bold></bold>"
10
- pdf.text pdf.html_strip("without html <bold>LD</bold>")
11
+ pdf.text strip_tags("without html <bold>LD</bold>")
12
+
11
13
  pdf.text "Let's see which is the current font_size: #{pdf.font_size.inspect}"
12
14
  pdf.move_down 10
13
15
  pdf.font_size 16
@@ -17,20 +19,22 @@ prawn_document(page_layout: :portrait) do |pdf|
17
19
  pdf.move_down 10
18
20
  pdf.text "Back to 16 again."
19
21
  pdf.move_down 10
20
- pdf.text "Single line on 20 using the :size option.", :size => 20
22
+ pdf.text "Single line on 20 using the :size option.", size: 20
21
23
  pdf.move_down 10
22
24
  pdf.text "Back to 16 once more."
23
25
  pdf.move_down 10
24
- pdf.font("Courier", :size => 10) do
26
+
27
+ pdf.font("Courier", size: 10) do
25
28
  pdf.text "Yeah, using Courier 10 courtesy of the font method."
26
29
  end
27
- pdf.font("Helvetica", :size => 12) # back to normal
30
+
31
+ pdf.font("Helvetica", size: 12) # back to normal
28
32
 
29
33
  pdf.text "Default color is black"
30
34
  pdf.move_down 25
31
- pdf.text "Changed to red", :color => "FF0000"
35
+ pdf.text "Changed to red", color: "FF0000"
32
36
  pdf.move_down 25
33
- pdf.text "CMYK color", :color => [22, 55, 79, 30]
37
+ pdf.text "CMYK color", color: [22, 55, 79, 30]
34
38
  pdf.move_down 25
35
- pdf.text "Also works with <color rgb='ff0000'>inline</color> formatting", :color => "0000FF", :inline_format => true
39
+ pdf.text "Also works with <color rgb='ff0000'>inline</color> formatting", color: "0000FF", inline_format: true
36
40
  end
@@ -0,0 +1,7 @@
1
+ prawn_document(page_layout: :portrait) do |pdf|
2
+
3
+ pdf.table @items do
4
+
5
+ end
6
+
7
+ end
File without changes
@@ -3,6 +3,11 @@ require File.expand_path('../boot', __FILE__)
3
3
  require 'rails/all'
4
4
 
5
5
  Bundler.require
6
+
7
+ silence_warnings do
8
+ require 'prawn-svg'
9
+ end
10
+
6
11
  require "prawn-rails"
7
12
 
8
13
  module Dummy
@@ -38,8 +43,21 @@ module Dummy
38
43
  # Enable the asset pipeline
39
44
  config.assets.enabled = true
40
45
 
46
+ config.assets.quiet = true
47
+
41
48
  # Version of your assets, change this if you want to expire all your assets
42
49
  config.assets.version = '1.0'
50
+
51
+ config.generators.test_framework = false
52
+ config.generators.helper = false
53
+ config.generators.stylesheets = false
54
+ config.generators.javascripts = false
55
+
56
+ if ActiveRecord.respond_to?(:gem_version)
57
+ gem_version = ActiveRecord.gem_version
58
+ if gem_version >= Gem::Version.new("5.2")
59
+ config.active_record.sqlite3.represent_boolean_as_integer = true
60
+ end
61
+ end
43
62
  end
44
63
  end
45
-
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ PrawnRails.config do |config|
2
+ config.page_layout = :portrait
3
+ config.page_size = "A4"
4
+ config.skip_page_creation = false
5
+ end
@@ -4,4 +4,8 @@
4
4
  # If you change this key, all old signed cookies will become invalid!
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = '4f337f0063fbb4a724dd8da15419679300da990ae4f6c94d36c714a3cd07e9653fc42d902cf33a9b9449a28e7eb2673f928172d65a090fa3c9156d6beea8d16c'
7
+
8
+ gem_version = ActiveRecord.gem_version
9
+ if gem_version <= Gem::Version.new("5.1")
10
+ Dummy::Application.config.secret_token = '4f337f0063fbb4a724dd8da15419679300da990ae4f6c94d36c714a3cd07e9653fc42d902cf33a9b9449a28e7eb2673f928172d65a090fa3c9156d6beea8d16c'
11
+ end
@@ -1,6 +1,6 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
4
 
5
5
  # Use the database for sessions instead of the cookie-based default,
6
6
  # which shouldn't be used to store highly confidential information
@@ -5,7 +5,7 @@
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
7
  ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters :format => [:json]
8
+ wrap_parameters format: [:json]
9
9
  end
10
10
 
11
11
  # Disable root element in JSON by default.
File without changes
@@ -0,0 +1,4 @@
1
+ Dummy::Application.routes.draw do
2
+ get "reports/sample"
3
+ get "reports/table"
4
+ end
File without changes
@@ -10,13 +10,6 @@
10
10
  #
11
11
  # It's strongly recommended to check this file into your version control system.
12
12
 
13
- ActiveRecord::Schema.define(:version => 20120221152352) do
14
-
15
- create_table "products", :force => true do |t|
16
- t.string "name"
17
- t.decimal "price"
18
- t.datetime "created_at"
19
- t.datetime "updated_at"
20
- end
13
+ ActiveRecord::Schema.define(version: 20120221152352) do
21
14
 
22
15
  end