ruport 1.6.3 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +11 -0
  3. data/CHANGELOG.md +38 -0
  4. data/HACKING +1 -17
  5. data/README.md +97 -0
  6. data/Rakefile +9 -50
  7. data/examples/add_row_table.rb +46 -0
  8. data/examples/data/wine.csv +255 -0
  9. data/examples/pdf_grouping.rb +39 -0
  10. data/examples/pdf_table.rb +28 -0
  11. data/examples/pdf_table_from_csv.rb +26 -0
  12. data/examples/pdf_table_prawn.rb +30 -0
  13. data/examples/pdf_table_simple.rb +13 -0
  14. data/examples/row_renderer.rb +1 -1
  15. data/examples/simple_pdf_lines.rb +1 -1
  16. data/examples/trac_ticket_status.rb +1 -1
  17. data/lib/ruport/controller.rb +17 -21
  18. data/lib/ruport/data/feeder.rb +2 -2
  19. data/lib/ruport/data/grouping.rb +8 -8
  20. data/lib/ruport/data/record.rb +4 -4
  21. data/lib/ruport/data/table.rb +318 -206
  22. data/lib/ruport/formatter/csv.rb +6 -7
  23. data/lib/ruport/formatter/html.rb +13 -11
  24. data/lib/ruport/formatter/markdown.rb +105 -0
  25. data/lib/ruport/formatter/prawn_pdf.rb +159 -0
  26. data/lib/ruport/formatter/template.rb +1 -1
  27. data/lib/ruport/formatter/text.rb +1 -1
  28. data/lib/ruport/formatter.rb +54 -54
  29. data/lib/ruport/version.rb +1 -1
  30. data/lib/ruport.rb +7 -23
  31. data/test/controller_test.rb +201 -225
  32. data/test/csv_formatter_test.rb +36 -36
  33. data/test/data_feeder_test.rb +64 -64
  34. data/test/expected_outputs/prawn_pdf_formatter/pdf_basic.pdf.test +265 -0
  35. data/test/grouping_test.rb +103 -102
  36. data/test/helpers.rb +29 -10
  37. data/test/html_formatter_test.rb +46 -46
  38. data/test/markdown_formatter_test.rb +142 -0
  39. data/test/prawn_pdf_formatter_test.rb +108 -0
  40. data/test/record_test.rb +91 -91
  41. data/test/samples/sales.csv +21 -0
  42. data/test/table_pivot_test.rb +77 -26
  43. data/test/table_test.rb +376 -354
  44. data/test/template_test.rb +13 -13
  45. data/test/text_formatter_test.rb +52 -52
  46. data/util/bench/data/table/bench_column_manip.rb +0 -1
  47. data/util/bench/data/table/bench_dup.rb +0 -1
  48. data/util/bench/data/table/bench_init.rb +1 -2
  49. data/util/bench/data/table/bench_manip.rb +0 -1
  50. data/util/bench/formatter/bench_csv.rb +0 -1
  51. data/util/bench/formatter/bench_html.rb +0 -1
  52. data/util/bench/formatter/bench_pdf.rb +0 -1
  53. data/util/bench/formatter/bench_text.rb +0 -1
  54. metadata +131 -82
  55. data/README +0 -114
  56. data/lib/ruport/formatter/pdf.rb +0 -591
  57. data/test/pdf_formatter_test.rb +0 -354
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b8b980ae054fa6d3d42e224431277d3deb471aa2e7132ea144bdb63bff3b3642
4
+ data.tar.gz: 9b5784e616ce0cbce9e218995cb7c3b36eb625cc18a75eea8642092713a391c4
5
+ SHA512:
6
+ metadata.gz: 5ecded8ff524e85d5c9a5bb6312b7bb50cdd5fa0f74540059c4c41c50d9b4cd3c679d6c176dc0a19564eca53590b77374ef00fe2a9afd9a742f0e35b0b88c79c
7
+ data.tar.gz: 5045f9a47bee0f414ff26222784ce782f2d01329f7f8448196ba6c91974e160fdfcb1d9fdc95318db4246fc67f0f16804e1a965b2856758bc66431b5c17502c9
data/AUTHORS CHANGED
@@ -1,3 +1,7 @@
1
+ = Maintainer
2
+
3
+ - {Andrew France}[mailto:andrew-ruport@odaeus.co.uk]
4
+
1
5
  = Developers
2
6
 
3
7
  - {Gregory Brown}[mailto:gregory.t.brown@gmail.com]
@@ -46,3 +50,10 @@ Chris Carter
46
50
 
47
51
  Dave Nelson
48
52
  - Grouping#sigma (r1131)
53
+
54
+ Bob Nadler:
55
+ - Table pivot operations support.
56
+
57
+ Michael Pope:
58
+ - Work on Prawn support.
59
+ - Table#add_row and #search.
data/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased] - undecided
8
+
9
+ ## [1.8.0] - 2022-09-20
10
+
11
+ ### Added
12
+
13
+ - Markdown formatter [#54](https://github.com/ruport/ruport/pull/54)
14
+ - Ruby 3.0 support
15
+
16
+ ### Changed
17
+
18
+ - Reduced allocations to improve performance [#34](https://github.com/ruport/ruport/pull/34)
19
+ - Update Prawn version to 2.4.0 [#44](https://github.com/ruport/ruport/pull/44) [#57](https://github.com/ruport/ruport/pull/57) [#64](https://github.com/ruport/ruport/pull/64)
20
+
21
+ ## [1.7.1] - 2017-05-02
22
+
23
+ ### Changed
24
+
25
+ - Improved errors when missing gems.
26
+ - Added ruby 1.9 support
27
+ - Removed dependency on `fastercsv` gem
28
+
29
+ ## [1.7.0] - 2011-01-06
30
+
31
+ ## [1.6.3] - 2009-12-12
32
+
33
+
34
+ [Unreleased]: https://github.com/ruport/ruport/compare/v1.8.0...HEAD
35
+ [1.8.0]: https://github.com/ruport/ruport/compare/v1.7.1...v1.8.0
36
+ [1.7.1]: https://github.com/ruport/ruport/compare/v1.7.0...v1.7.1
37
+ [1.7.0]: https://github.com/ruport/ruport/compare/v1.6.3...v1.7.0
38
+ [1.6.3]: https://github.com/ruport/ruport/compare/v1.6.2...v1.6.3
data/HACKING CHANGED
@@ -23,23 +23,7 @@ contributions to our project. Here are a few different ways you can help.
23
23
  If any of these things sound appealing to you, there are a few things
24
24
  you should do:
25
25
 
26
- 1) Sign up on the mailing list: http://list.rubyreports.org/
27
-
28
- 2) Post and introduce yourself, letting us know what you'd like to work on OR
29
- Find sandal or mikem836 on #ruport
30
-
31
- 3) Please read the MakingChangeRequests, ReportingDefects, and
32
- SubmittingPatches Trac wiki pages, as appropriate.
33
-
34
- - http://stonecode.svnrepository.com/ruport/trac.cgi/wiki/MakingChangeRequests
35
-
36
- - http://stonecode.svnrepository.com/ruport/trac.cgi/wiki/ReportingDefects
37
-
38
- - http://stonecode.svnrepository.com/ruport/trac.cgi/wiki/SubmittingPatches
39
-
40
- 4) Please pull the latest code from SVN trunk:
41
- http://stonecode.svnrepository.com/svn/ruport/ruport/trunk
42
-
26
+ 1) Head over to https://github.com/ruport/ruport
43
27
 
44
28
  This should hopefully be enough to get you on the right track. We welcome your
45
29
  questions and ideas, so don't be afraid to contact us.
data/README.md ADDED
@@ -0,0 +1,97 @@
1
+ [![Build Status][BS img]](https://travis-ci.org/ruport/ruport)
2
+ [![Coverage Status][CS img]](https://coveralls.io/r/ruport/ruport)
3
+
4
+ ## What Ruport Is
5
+
6
+ Ruby Reports (Ruport) is an extensible reporting system.
7
+
8
+ It aims to be as lightweight as possible while still providing core support
9
+ for data aggregation and manipulation as well as multi-format rendering
10
+ of reports.
11
+
12
+ Ruport provides tools for using a number of data sources, including CSV files,
13
+ ActiveRecord models, and raw SQL connections via RubyDBI (through ruport-util).
14
+
15
+ Data manipulation is easy as there are standard structures that support
16
+ record, table, and grouping operations. These all can be extended to
17
+ implement custom behavior as needed.
18
+
19
+ For common tasks, Ruport provides formatters for CSV, HTML, PDF, and text-
20
+ based reports. However, the real power lies in building custom report
21
+ controllers and formatters. The base formatting libraries provide a number
22
+ of helper functions that will let you build complex reports while maintaining
23
+ a DRY and consistent interface.
24
+
25
+ To get a quick feel for what you can accomplish with Ruport, take a look at
26
+ a few simple examples provided on our web site:
27
+
28
+ https://ruport.github.io/examples.html
29
+
30
+ Since Ruport's core support is intentionally minimalistic, you may be looking
31
+ for some higher level support for specific needs such as graphing, invoices,
32
+ report mailing support, etc. For this, you may wish to take a look at the
33
+ ruport-util package, which contains some generally useful tools and libraries
34
+ to extend Ruport's capabilities.
35
+
36
+ ## Installation
37
+
38
+ To install ruport via rubygems:
39
+
40
+ ```sh
41
+ $ sudo gem install ruport
42
+ ```
43
+
44
+ Check to see if it installed properly:
45
+
46
+ ```sh
47
+ $ ruby -e "require 'ruport'; puts Ruport::VERSION"
48
+ ```
49
+
50
+ If you get an error, please let us know on our mailing list.
51
+
52
+ ### Dependencies
53
+
54
+ #### Formatting
55
+
56
+ Ruport relies on PDF::Writer for its formatting support.
57
+ If you want to make use of textile helpers, you'll also need RedCloth.
58
+
59
+ #### Database interaction
60
+
61
+ If you wish to use Ruport to report against a Rails project, you'll need
62
+ ActiveRecord and the `acts_as_reportable` gem.
63
+
64
+ If you want to use Ruport::Query for raw SQL support, you'll need to
65
+ install `ruport-util`, `RubyDBI` and whatever database drivers you might
66
+ need.
67
+
68
+ ## Resources
69
+
70
+ Our developers have published a free-content book about all things
71
+ Ruport, including complete coverage of acts_as_reportable and some of
72
+ ruport-util's features. This book serves as the definitive guide to
73
+ Ruport, so all users should become acquainted with it:
74
+
75
+ https://ruport.github.io
76
+
77
+ If you are looking to dig a little deeper, there are a couple more resources
78
+ that may be helpful to you.
79
+
80
+ - The latest stable API documentation is available at: http://rubydoc.info/gems/ruport/frames
81
+ - The code repository is on GitHub: https://github.com/ruport/ruport
82
+ - Our issues tracker is at https://github.com/ruport/ruport/issues
83
+
84
+ ## Hacking
85
+
86
+ If you'd like to contribute code to Ruport, fork the repository and open a PR!
87
+
88
+ We are very responsive to contributors, and review every patch we receive
89
+ fairly quickly. Most contributors who successfully get a patch or two applied
90
+ are given write access to the repositories and invited to join Ruport's
91
+ development team. Since we view every user as potential contributor, this
92
+ approach works well for us.
93
+
94
+ So if you want to help out with Ruport, we'll happy accept your efforts!
95
+
96
+ [BS img]: https://travis-ci.org/ruport/ruport.svg?branch=master
97
+ [CS img]: https://coveralls.io/repos/ruport/ruport/badge.png?branch=master
data/Rakefile CHANGED
@@ -1,60 +1,19 @@
1
- require "rake/rdoctask"
2
- require "rake/testtask"
3
- require "lib/ruport/version"
1
+ require "rubygems"
2
+ require "bundler/setup"
4
3
 
5
- begin
6
- require "rubygems"
7
- rescue LoadError
8
- nil
9
- end
4
+ require "rake/testtask"
5
+ require 'bundler/gem_tasks'
10
6
 
11
7
  task :default => [:test]
12
8
 
13
9
  Rake::TestTask.new do |test|
14
10
  test.libs << "test"
15
- test.test_files = Dir[ "test/*_test.rb" ]
16
- test.verbose = true
17
- end
18
-
19
- begin
20
- require 'jeweler'
21
- Jeweler::Tasks.new do |gemspec|
22
- gemspec.name = 'ruport'
23
- gemspec.rubyforge_project = 'ruport'
24
- gemspec.version = Ruport::VERSION
25
- gemspec.summary = 'A generalized Ruby report generation and templating engine.'
26
- gemspec.description = <<-END_DESC
27
- Ruby Reports is a software library that aims to make the task of reporting
28
- less tedious and painful. It provides tools for data acquisition,
29
- database interaction, formatting, and parsing/munging.
30
- END_DESC
31
- gemspec.email = 'gregory.t.brown@gmail.com'
32
- gemspec.homepage = 'http://rubyreports.org'
33
- gemspec.authors = ['Gregory Brown', 'Mike Milner', 'Andrew France']
34
- gemspec.rdoc_options = ['--title', 'Ruport Documentation', '--main', 'README', '-q']
35
- gemspec.add_dependency 'fastercsv'
36
- gemspec.add_dependency 'pdf-writer', '= 1.1.8'
11
+ if RUBY_VERSION < "1.9"
12
+ test.test_files = Dir["test/*_test.rb", "test18/*_test.rb"]
13
+ else
14
+ test.test_files = Dir[ "test/*_test.rb" ]
37
15
  end
38
- rescue LoadError
39
- puts "Jeweler gem not available."
40
- end
41
-
42
- Rake::RDocTask.new do |rdoc|
43
- rdoc.rdoc_files.include( "README",
44
- #"CHANGELOG",
45
- "AUTHORS", "COPYING",
46
- "LICENSE", "lib/" )
47
- rdoc.main = "README"
48
- rdoc.rdoc_dir = "doc/html"
49
- rdoc.title = "Ruport Documentation"
50
- end
51
-
52
- task :build_archives => [:package,:rcov,:rdoc] do
53
- mv "pkg/ruport-#{Ruport::VERSION}.tgz", "pkg/ruport-#{Ruport::VERSION}.tar.gz"
54
- sh "tar cjvf pkg/ruport_coverage-#{Ruport::VERSION}.tar.bz2 coverage"
55
- sh "tar cjvf pkg/ruport_doc-#{Ruport::VERSION}.tar.bz2 doc/html"
56
- cd "pkg"
57
- sh "tar cjvf ruport-#{Ruport::VERSION}.tar.bz2 ruport-#{Ruport::VERSION}"
16
+ test.verbose = true
58
17
  end
59
18
 
60
19
  task :run_benchmarks do
@@ -0,0 +1,46 @@
1
+ $: << File.join(File.dirname(__FILE__), '..', 'lib')
2
+ require "ruport"
3
+
4
+ # Example of adding a row inbetween two rows of a already created table.
5
+
6
+ data = Table(:service,:rate)
7
+ data << ["Mow The Lawn","50.00"]
8
+ data << ["Sew Curtains", "120.00"]
9
+ data << ["Fly To Mars", "10000.00"]
10
+
11
+ puts data.to_text
12
+
13
+
14
+ # Need to add a row
15
+ # Use sub table to split where we want the new row
16
+ # add the row to the first split
17
+ # merge two splits back
18
+
19
+ puts 'sub table1'
20
+ sub1 = data.sub_table(0..0)
21
+ puts sub1
22
+
23
+ puts 'sub table2'
24
+ sub2 = data.sub_table(1..-1)
25
+ puts sub2
26
+
27
+ puts 'Add a row to the first split'
28
+ sub1 << ["Book-keeping", "90.00"]
29
+ puts sub1
30
+
31
+ puts 'Merge splits'
32
+ data = sub1 + sub2
33
+ puts data
34
+
35
+ puts 'Add row'
36
+ data.add_row(["Fix Car", "2000"], :position => 0)
37
+ puts data
38
+
39
+
40
+ puts 'Add Row after Sew Curtains'
41
+ pos = data.row_search("Sew", :column => 0) # Search for Sew in column 0 and get position.
42
+ pos += 1
43
+ data.add_row(["Wash Car", "8"], :position => pos)
44
+ puts data
45
+
46
+
@@ -0,0 +1,255 @@
1
+ Winery,Name,Region,Type,Year
2
+ Blue Pyrenees Estate,Reserve,Avoca,Cabernet Sauvigon Merlot,1998
3
+ Penfolds,BIN 389,"",Shiraz Cabernet,1998
4
+ Penfolds,BIN 28,"",Shiraz,1998
5
+ Penfolds,BIN 28,"",Shiraz,1996
6
+ Penfolds,St Henri,"",Shiraz,1998
7
+ Penfolds,St Henri,"",Shiraz,1998
8
+ Shottesbrooke,Eliza,"",Shiraz,2000
9
+ Shottesbrooke,Eliza,"",Shiraz,2000
10
+ Penfolds,St Henri,"Barossa, etc",Shiraz,1999
11
+ Peter Lehman,The Futures,Barossa,Shiraz,2001
12
+ Peter Lehman,The Futures,Barossa,Shiraz,2001
13
+ Saltram,Metala Black,Langhorne Creek,Shiraz,2000
14
+ Hanging Rock,Heathcote,Heathcote,Shiraz,2001
15
+ Penfolds,Magill Estate,Adelaide,Shiraz,1998
16
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2001
17
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2001
18
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2001
19
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2001
20
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2001
21
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2001
22
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2001
23
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2001
24
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2001
25
+ Penfolds,BIN 28,"",Shiraz,2001
26
+ Penfolds,BIN 28,"",Shiraz,2001
27
+ Penfolds,BIN 28,"",Shiraz,2001
28
+ Penfolds,BIN 28,"",Shiraz,2001
29
+ Penfolds,BIN 28,"",Shiraz,2001
30
+ Blanche Barkly,Johann,Bendigo,Cabernet Sauvigon,2001
31
+ Blanche Barkly,Johann,Bendigo,Cabernet Sauvigon,2001
32
+ Blanche Barkly,Johann,Bendigo,Cabernet Sauvigon,2001
33
+ Blanche Barkly,Mary Eileen,Bendigo,Shiraz,2001
34
+ Blanche Barkly,Mary Eileen,Bendigo,Shiraz,2001
35
+ Blanche Barkly,Mary Eileen,Bendigo,Shiraz,2001
36
+ Blanche Barkly,Johann,Bendigo,Cabernet Sauvigon,2002
37
+ Blanche Barkly,Johann,Bendigo,Cabernet Sauvigon,2002
38
+ Blanche Barkly,Johann,Bendigo,Cabernet Sauvigon,2002
39
+ Blanche Barkly,Mary Eileen,Bendigo,Shiraz,2002
40
+ Blanche Barkly,Mary Eileen,Bendigo,Shiraz,2002
41
+ Blanche Barkly,Mary Eileen,Bendigo,Shiraz,2002
42
+ Passing Clouds,The Cabernets,Bendigo,Cabernet Sauvigon/Cabernet Franc,2002
43
+ Blanche Barkly,Charlotte Elise,Bendigo,Shiraz,2002
44
+ Blanche Barkly,Charlotte Elise,Bendigo,Shiraz,2002
45
+ Blanche Barkly,Charlotte Elise,Bendigo,Shiraz,2002
46
+ Passing Clouds,The Cabernets,Bendigo,Cabernet Sauvigon/Cabernet Franc,2002
47
+ Blanche Barkly,Charlotte Elise,Bendigo,Shiraz,2002
48
+ Blanche Barkly,Charlotte Elise,Bendigo,Shiraz,2002
49
+ Blanche Barkly,Charlotte Elise,Bendigo,Shiraz,2002
50
+ Blanche Barkly,Alexander,Bendigo,Cabernet Sauvigon,2002
51
+ Blanche Barkly,Alexander,Bendigo,Cabernet Sauvigon,2002
52
+ Blanche Barkly,Alexander,Bendigo,Cabernet Sauvigon,2002
53
+ Blanche Barkly,Alexander,Bendigo,Cabernet Sauvigon,2002
54
+ Blanche Barkly,Alexander,Bendigo,Cabernet Sauvigon,2002
55
+ Blanche Barkly,Alexander,Bendigo,Cabernet Sauvigon,2002
56
+ Penfolds,BIN 28,Barossa,Shiraz,2002
57
+ Penfolds,BIN 28,Barossa,Shiraz,2002
58
+ Penfolds,BIN 28,Barossa,Shiraz,2002
59
+ Penfolds,BIN 28,Barossa,Shiraz,2002
60
+ Penfolds,BIN 28,Barossa,Shiraz,2002
61
+ Penfolds,BIN 28,Barossa,Shiraz,2002
62
+ Penfolds,BIN 407,SA,Cabernet Sauvigon,2002
63
+ Penfolds,BIN 407,SA,Cabernet Sauvigon,2002
64
+ Penfolds,BIN 407,SA,Cabernet Sauvigon,2002
65
+ Penfolds,BIN 407,SA,Cabernet Sauvigon,2002
66
+ Penfolds,BIN 407,SA,Cabernet Sauvigon,2002
67
+ Penfolds,BIN 389,SA,Cabernet Sauvigon Shiraz,2002
68
+ Penfolds,BIN 389,SA,Cabernet Sauvigon Shiraz,2002
69
+ Penfolds,BIN 389,SA,Cabernet Sauvigon Shiraz,2002
70
+ Penfolds,BIN 389,SA,Cabernet Sauvigon Shiraz,2002
71
+ Penfolds,BIN 389,SA,Cabernet Sauvigon Shiraz,2002
72
+ Penfolds,BIN 389,SA,Cabernet Sauvigon Shiraz,2002
73
+ Wynns,Harold,Coonawarra,Cabernet Sauvigon,2001
74
+ Hollick,"",Coonawarra,Cabernet Sauvigon,2002
75
+ Brands,"",Coonawarra,Cabernet Sauvigon,2002
76
+ Wirra Wirra,RSW,McLaren Vale,Shiraz,2002
77
+ Tatachilla,"",McLaren Vale,Shiraz,2001
78
+ Fox Creek,JSM,McLaren Vale,Shiraz Cabernet Franc,2002
79
+ Pirramimma,"",McLaren Vale,Cabernet Sauvigon,2001
80
+ Yalumba,The Signature,Barossa,Cabernet Sauvigon Shiraz,2000
81
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
82
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
83
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
84
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
85
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
86
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
87
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
88
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
89
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
90
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2003
91
+ Penfolds,BIN 28,Barossa,Shiraz,2003
92
+ Penfolds,BIN 28,Barossa,Shiraz,2003
93
+ Penfolds,BIN 28,Barossa,Shiraz,2003
94
+ Penfolds,BIN 28,Barossa,Shiraz,2003
95
+ Penfolds,BIN 28,Barossa,Shiraz,2003
96
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2003
97
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2003
98
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2003
99
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2003
100
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2003
101
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2003
102
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2003
103
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2003
104
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2003
105
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2003
106
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2003
107
+ Brown Brothers,"",King Valley,Shiraz Cabernet,1998
108
+ Blanche Barkly,Mary,Bendigo,Shiraz,2002
109
+ Blanche Barkly,Mary,Bendigo,Shiraz,2002
110
+ Blanche Barkly,Mary,Bendigo,Shiraz,2002
111
+ Blanche Barkly,Mary,Bendigo,Shiraz,2001
112
+ Blanche Barkly,Mary,Bendigo,Shiraz,2001
113
+ Blanche Barkly,Mary,Bendigo,Shiraz,2001
114
+ d`Arenberg,The Dead Arm,McLaren Vale,Shiraz,2003
115
+ Tahbilk,Reserve,Nagambie Lakes,Shiraz,2001
116
+ Wynns,"",Coonawarra,Cabernet Sauvigon,2003
117
+ Wynns,"",Coonawarra,Cabernet Sauvigon,2003
118
+ Wynns,"",Coonawarra,Cabernet Sauvigon,2003
119
+ Wynns,"",Coonawarra,Cabernet Sauvigon,2003
120
+ Wolf Blass,Black Label,"",Cabernet Sauvigon Shiraz,2002
121
+ Wolf Blass,Black Label,"",Cabernet Sauvigon Shiraz,2002
122
+ Henschke,Keyneton Estate,"",Cabernet Sauvigon,2003
123
+ Henschke,Keyneton Estate,"",Cabernet Sauvigon,2003
124
+ Saltram,No. 1,"",Shiraz,2002
125
+ Saltram,No. 1,"",Shiraz,2002
126
+ Pewsy Vale,"",Eden Valley,Reisling,2006
127
+ Pewsy Vale,"",Eden Valley,Reisling,2006
128
+ Peter Lehmann,"",Eden Valley,Reisling,2006
129
+ Peter Lehmann,"",Eden Valley,Reisling,2006
130
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2005
131
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2005
132
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2005
133
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2005
134
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2005
135
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2005
136
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2005
137
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2005
138
+ Saltram,Metala White,"",Shiraz Cabernet,2004
139
+ Saltram,Metala White,"",Shiraz Cabernet,2004
140
+ Saltram,Metala White,"",Shiraz Cabernet,2004
141
+ Saltram,Metala White,"",Shiraz Cabernet,2004
142
+ Saltram,Metala White,"",Shiraz Cabernet,2004
143
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2004
144
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2004
145
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2004
146
+ Saltram,Metala White,Langhorne Creek,Shiraz Cabernet,2004
147
+ Penfolds,BIN 28,Barossa,Shiraz,2004
148
+ Penfolds,BIN 28,Barossa,Shiraz,2004
149
+ Penfolds,BIN 28,Barossa,Shiraz,2004
150
+ Penfolds,BIN 28,Barossa,Shiraz,2004
151
+ Penfolds,BIN 28,Barossa,Shiraz,2004
152
+ Penfolds,BIN 28,Barossa,Shiraz,2004
153
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2004
154
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2004
155
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2004
156
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2004
157
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2004
158
+ Penfolds,BIN 407,"",Cabernet Sauvigon,2004
159
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2004
160
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2004
161
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2004
162
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2004
163
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2004
164
+ Penfolds,BIN 389,"",Cabernet Sauvigon Shiraz,2004
165
+ Penfolds,BIN 28,"",Shiraz,2001
166
+ Blanche Barkley,Johann,King..,Cabernet Sauvigon,2002
167
+ Blanche Barkley,Johann,King..,Cabernet Sauvigon,2002
168
+ Blanche Barkley,Johann,King..,Cabernet Sauvigon,2002
169
+ Blanche Barkley,Johann,Bendigo,Cabernet Sauvigon,2001
170
+ Blanche Barkley,Johann,Bendigo,Cabernet Sauvigon,2001
171
+ Blanche Barkley,Johann,Bendigo,Cabernet Sauvigon,2001
172
+ Wynns,"",Coonawarra,Cabernet Sauvigon,2003
173
+ Wynns,"",Coonawarra,Cabernet Sauvigon,2003
174
+ Wynns,"",Coonawarra,Cabernet Sauvigon,2003
175
+ Wynns,"",Coonawarra,Cabernet Sauvigon,2003
176
+ Hanging rock,"",Hanging rock,Red Blend,2003
177
+ Charles,"","",Cabernet Sauvigon,2002
178
+ King River Estate,"",King Valley,Cabernet Sauvigon,2005
179
+ King River Estate,"",King Valley,Cabernet Sauvigon,2005
180
+ King River Estate,Barbera,King Valley,Red Blend,2005
181
+ King River Estate,"",King Valley,Viognier,2005
182
+ Delatite,Sylvia,Goulburn,Reisling,2006
183
+ Delatite,Sylvia,Goulburn,Reisling,2006
184
+ Brown Brothers,Patricia,"",Cabernet Sauvigon,2002
185
+ Penfolds,Koonunga Hill,"",Shiraz Cabernet,2006
186
+ Penfolds,Koonunga Hill,"",Shiraz Cabernet,2006
187
+ Blanche Barkly,Johann,Bendigo,Cabernet Sauvigon,2003
188
+ Blanche Barkly,Johann,Bendigo,Cabernet Sauvigon,2003
189
+ Blanche Barkly,Johann,Bendigo,Cabernet Sauvigon,2003
190
+ Blanche Barkly,Mary Eileen,Bendigo,Shiraz,2003
191
+ Blanche Barkly,Mary Eileen,Bendigo,Shiraz,2003
192
+ Blanche Barkly,Mary Eileen,Bendigo,Shiraz,2003
193
+ Blanche Barkly,"",Bendigo,Cabernet Sauvigon Shiraz,2003
194
+ Blanche Barkly,"",Bendigo,Cabernet Sauvigon Shiraz,2003
195
+ Blanche Barkly,"",Bendigo,Cabernet Sauvigon Shiraz,2003
196
+ Blanche Barkly,"",Bendigo,Cabernet Sauvigon Shiraz,2003
197
+ Blanche Barkly,"",Bendigo,Cabernet Sauvigon Shiraz,2003
198
+ Blanche Barkly,"",Bendigo,Cabernet Sauvigon Shiraz,2003
199
+ Delatite,RJ,Goulburn,Cabernet Merlot Melbec,2002
200
+ Delatite,RJ,Goulburn,Cabernet Merlot Melbec,2002
201
+ Penfolds,Bin 28,Kalimna,Shiraz,2005
202
+ Penfolds,Bin 28,Kalimna,Shiraz,2005
203
+ Penfolds,Bin 28,Kalimna,Shiraz,2005
204
+ Penfolds,Bin 28,Kalimna,Shiraz,2005
205
+ Penfolds,Bin 28,Kalimna,Shiraz,2005
206
+ Penfolds,Bin 28,Kalimna,Shiraz,2005
207
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2005
208
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2005
209
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2005
210
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2005
211
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2005
212
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2005
213
+ Penfolds,St Henri,"",Shiraz,2005
214
+ Penfolds,St Henri,"",Shiraz,2005
215
+ John Gehrig,"",King Valley,Merlot,2006
216
+ John Gehrig,"",King Valley,Merlot,2006
217
+ Baileys,1920s Block,Rutherglen,Shiraz,2006
218
+ Baileys,1920s Block,Rutherglen,Shiraz,2006
219
+ Brown Brothers,"",Miliwa,Tempranillo,2005
220
+ Brown Brothers,"",Miliwa,Tempranillo,2005
221
+ Taminick,Cellars,Glen Rowan,Shiraz,2004
222
+ Taminick,Cellars,Glen Rowan,Shiraz,2004
223
+ G. Sutherland Smith,"",Rutherglen,Durif Shiraz,2007
224
+ G. Sutherland Smith,"",Rutherglen,Durif Shiraz,2007
225
+ Mount Prior,"",Rutherglen,Shiraz Grenache Mourvedre,2006
226
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2006
227
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2006
228
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2006
229
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2006
230
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2006
231
+ Penfolds,Bin 389,"",Cabernet Sauvigon Shiraz,2006
232
+ Pfeiffer,"",Rutherglen,Chardonnay,2006
233
+ Pfeiffer,"",Rutherglen,Chardonnay,2006
234
+ Pfeiffer,Carlyle,Rutherglen,Shiraz,2007
235
+ Pfeiffer,Carlyle,Rutherglen,Shiraz,2007
236
+ Pfeiffer,"",Rutherglen,Cabernet Sauvigon,2006
237
+ Cofield,Quartz Vein,Rutherglen,Red Blend,2006
238
+ Cofield,Quartz Vein,Rutherglen,Red Blend,2006
239
+ Jones,LJ,Rutherglen,Shiraz Grenache Mourvedre,2006
240
+ Baileys,Block 1904,Glenrowan,Shiraz,2005
241
+ Baileys,Block 1904,Glenrowan,Shiraz,2005
242
+ Baileys,1920s Block,Glenrowan,Shiraz,2006
243
+ Baileys,1920s Block,Glenrowan,Shiraz,2006
244
+ Penfolds,Bin 28,"",Shiraz,2006
245
+ Penfolds,Bin 28,"",Shiraz,2006
246
+ Penfolds,Bin 28,"",Shiraz,2006
247
+ Penfolds,Bin 28,"",Shiraz,2006
248
+ Penfolds,Bin 28,"",Shiraz,2006
249
+ Penfolds,Bin 28,"",Shiraz,2006
250
+ Penfolds,Bin 407,"",Cabernet Sauvigon,2006
251
+ Penfolds,Bin 407,"",Cabernet Sauvigon,2006
252
+ Penfolds,Bin 407,"",Cabernet Sauvigon,2006
253
+ Penfolds,Bin 407,"",Cabernet Sauvigon,2006
254
+ Penfolds,Bin 407,"",Cabernet Sauvigon,2006
255
+ Penfolds,Bin 407,"",Cabernet Sauvigon,2006
@@ -0,0 +1,39 @@
1
+
2
+ $: << File.join(File.dirname(__FILE__), '..', 'lib')
3
+ require "ruport"
4
+ require "ruby-debug"
5
+
6
+ class Document < Ruport::Controller
7
+ stage :title, :body
8
+
9
+ def setup
10
+ table = Ruport::Data::Table.load('data/wine.csv')
11
+ grouping = Grouping(table, :by => 'Type')
12
+ self.data = grouping
13
+ end
14
+ end
15
+
16
+ class DocumentFormatter < Ruport::Formatter::PrawnPDF
17
+ renders :prawn_pdf, :for => Document
18
+
19
+ def build_title
20
+ pad(10) do
21
+ text 'WINES', :style => :bold, :size => 20
22
+ horizontal_rule
23
+ end
24
+ end
25
+
26
+ def build_body
27
+ render_grouping(data, :formatter => pdf) # It's Nasty!!!
28
+ end
29
+ end
30
+
31
+ class DocumentTextFormatter < Ruport::Formatter::Text
32
+ renders :text, :for => Document
33
+
34
+ def build_body
35
+ output << data.to_text
36
+ end
37
+ end
38
+
39
+ Document.render(:prawn_pdf, :file => 'pdf_grouping.pdf')
@@ -0,0 +1,28 @@
1
+ $: << File.join(File.dirname(__FILE__), '..', 'lib')
2
+ require "ruport"
3
+
4
+ # Example using prawn 0.9.0 pdf generator
5
+ class Document < Ruport::Controller
6
+ stage :body
7
+
8
+ def setup
9
+ self.data = Ruport::Data::Table.new(
10
+ :column_names => %w(Make Model Year),
11
+ :data => [
12
+ %w(Nissan Skyline 1989),
13
+ %w(Mercedes-Benz 500SL 2005),
14
+ %w(Kia Sinatra 2008)
15
+ ])
16
+ end
17
+ end
18
+
19
+ class DocumentFormatter < Ruport::Formatter::PrawnPDF
20
+ renders :prawn_pdf, :for => Document
21
+
22
+ def build_body
23
+ draw_table(data)
24
+ end
25
+ end
26
+
27
+ Document.render(:prawn_pdf, :file => 'pdf_table.pdf')
28
+
@@ -0,0 +1,26 @@
1
+ $: << File.join(File.dirname(__FILE__), '..', 'lib')
2
+ require "ruport"
3
+
4
+ class Document < Ruport::Controller
5
+ stage :title, :body
6
+
7
+ def setup
8
+ self.data = Ruport::Data::Table.load('data/wine.csv')
9
+ end
10
+ end
11
+
12
+ class DocumentFormatter < Ruport::Formatter::PrawnPDF
13
+ renders :prawn_pdf, :for => Document
14
+
15
+ def build_title
16
+ pad(10) do
17
+ text 'Wine', :style => :bold, :size => 20
18
+ end
19
+ end
20
+
21
+ def build_body
22
+ draw_table(data)
23
+ end
24
+ end
25
+
26
+ Document.render(:prawn_pdf, :file => 'pdf_table_from_csv.pdf')