ruport 1.6.3 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby -w
2
2
  require File.join(File.expand_path(File.dirname(__FILE__)), "helpers")
3
3
 
4
- class TemplateTest < Test::Unit::TestCase
4
+ class TemplateTest < Minitest::Test
5
5
 
6
6
  def setup
7
7
  @template_class = Ruport::Formatter::Template.dup
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby -w
2
2
  require File.join(File.expand_path(File.dirname(__FILE__)), "helpers")
3
3
 
4
- class TestRenderTextTable < Test::Unit::TestCase
4
+ class TestRenderTextTable < Minitest::Test
5
5
 
6
6
  def setup
7
7
  Ruport::Formatter::Template.create(:simple) do |format|
@@ -23,17 +23,17 @@ class TestRenderTextTable < Test::Unit::TestCase
23
23
  def test_basic
24
24
  tf = "+-------+\n"
25
25
 
26
- a = Table([], :data => [[1,2],[3,4]]).to_text
26
+ a = Ruport.Table([], :data => [[1,2],[3,4]]).to_text
27
27
  assert_equal("#{tf}| 1 | 2 |\n| 3 | 4 |\n#{tf}",a)
28
28
 
29
- a = Table(%w[a b], :data => [[1,2],[3,4]]).to_text
29
+ a = Ruport.Table(%w[a b], :data => [[1,2],[3,4]]).to_text
30
30
  assert_equal("#{tf}| a | b |\n#{tf}| 1 | 2 |\n| 3 | 4 |\n#{tf}", a)
31
31
  end
32
32
 
33
33
  def test_centering
34
34
  tf = "+---------+\n"
35
35
 
36
- a = Table([], :data => [[1,2],[300,4]])
36
+ a = Ruport.Table([], :data => [[1,2],[300,4]])
37
37
  assert_equal( "#{tf}| 1 | 2 |\n| 300 | 4 |\n#{tf}",
38
38
  a.to_text(:alignment => :center) )
39
39
 
@@ -45,7 +45,7 @@ class TestRenderTextTable < Test::Unit::TestCase
45
45
 
46
46
  def test_justified
47
47
  tf = "+----------+\n"
48
- a = Table([], :data => [[1,'Z'],[300,'BB']])
48
+ a = Ruport.Table([], :data => [[1,'Z'],[300,'BB']])
49
49
 
50
50
  # justified alignment can be set explicitly
51
51
  assert_equal "#{tf}| 1 | Z |\n| 300 | BB |\n#{tf}",
@@ -56,21 +56,21 @@ class TestRenderTextTable < Test::Unit::TestCase
56
56
  end
57
57
 
58
58
  def test_wrapping
59
- a = Table([], :data => [[1,2],[300,4]]).to_text(:table_width => 10)
59
+ a = Ruport.Table([], :data => [[1,2],[300,4]]).to_text(:table_width => 10)
60
60
  assert_equal("+------->>\n| 1 | >>\n| 300 | >>\n+------->>\n",a)
61
61
  end
62
62
 
63
63
  def test_ignore_wrapping
64
- a = Table([], :data => [[1,2],[300,4]]).to_text(:table_width => 10,
64
+ a = Ruport.Table([], :data => [[1,2],[300,4]]).to_text(:table_width => 10,
65
65
  :ignore_table_width => true )
66
66
  assert_equal("+---------+\n| 1 | 2 |\n| 300 | 4 |\n+---------+\n",a)
67
67
  end
68
68
 
69
69
  def test_render_empty_table
70
- assert_raise(Ruport::FormatterError) { Table([]).to_text }
71
- assert_nothing_raised { Table(%w[a b c]).to_text }
70
+ assert_raises(Ruport::FormatterError) { Ruport.Table([]).to_text }
71
+ Ruport.Table(%w[a b c]).to_text
72
72
 
73
- a = Table(%w[a b c]).to_text
73
+ a = Ruport.Table(%w[a b c]).to_text
74
74
  expected = "+-----------+\n"+
75
75
  "| a | b | c |\n"+
76
76
  "+-----------+\n"
@@ -95,7 +95,7 @@ class TestRenderTextTable < Test::Unit::TestCase
95
95
 
96
96
  def test_options_hashes_override_template
97
97
  opts = nil
98
- table = Table(%w[a b c])
98
+ table = Ruport.Table(%w[a b c])
99
99
  table.to_text(
100
100
  :template => :simple,
101
101
  :table_format => {
@@ -126,7 +126,7 @@ class TestRenderTextTable < Test::Unit::TestCase
126
126
 
127
127
  def test_individual_options_override_template
128
128
  opts = nil
129
- table = Table(%w[a b c])
129
+ table = Ruport.Table(%w[a b c])
130
130
  table.to_text(
131
131
  :template => :simple,
132
132
  :show_table_headers => true,
@@ -152,7 +152,7 @@ class TestRenderTextTable < Test::Unit::TestCase
152
152
  # -- BUG TRAPS ------------------------------
153
153
 
154
154
  def test_should_render_without_column_names
155
- a = Table([], :data => [[1,2,3]]).to_text
155
+ a = Ruport.Table([], :data => [[1,2,3]]).to_text
156
156
  expected = "+-----------+\n"+
157
157
  "| 1 | 2 | 3 |\n"+
158
158
  "+-----------+\n"
@@ -162,7 +162,7 @@ class TestRenderTextTable < Test::Unit::TestCase
162
162
  end
163
163
 
164
164
 
165
- class TestRenderTextRow < Test::Unit::TestCase
165
+ class TestRenderTextRow < Minitest::Test
166
166
 
167
167
  def test_row_basic
168
168
  actual = Ruport::Controller::Row.render_text(:data => [1,2,3])
@@ -172,7 +172,7 @@ class TestRenderTextRow < Test::Unit::TestCase
172
172
  end
173
173
 
174
174
 
175
- class TestRenderTextGroup < Test::Unit::TestCase
175
+ class TestRenderTextGroup < Minitest::Test
176
176
 
177
177
  def test_render_text_group
178
178
  group = Ruport::Data::Group.new(:name => 'test',
@@ -209,13 +209,13 @@ class TestRenderTextGroup < Test::Unit::TestCase
209
209
  end
210
210
 
211
211
 
212
- class TestRenderTextGrouping < Test::Unit::TestCase
212
+ class TestRenderTextGrouping < Minitest::Test
213
213
 
214
214
  def test_render_text_grouping
215
215
  table = Ruport::Data::Table.new(:data => [ %w[is this more],
216
216
  %w[interesting red snapper]],
217
217
  :column_names => %w[i hope so])
218
- grouping = Grouping(table, :by => "i")
218
+ grouping = Grouping(table, :by => "i", :order => :name)
219
219
 
220
220
  actual = Ruport::Controller::Grouping.render(:text, :data => grouping)
221
221
  expected = "interesting:\n\n"+
@@ -240,7 +240,7 @@ class TestRenderTextGrouping < Test::Unit::TestCase
240
240
  table = Ruport::Data::Table.new(:data => [ %w[is this more],
241
241
  %w[interesting red snapper]],
242
242
  :column_names => %w[i hope so])
243
- grouping = Grouping(table, :by => "i")
243
+ grouping = Grouping(table, :by => "i", :order => :name)
244
244
 
245
245
  actual = Ruport::Controller::Grouping.render(:text, :data => grouping,
246
246
  :show_table_headers => false)
@@ -255,4 +255,4 @@ class TestRenderTextGrouping < Test::Unit::TestCase
255
255
  assert_equal(expected, actual)
256
256
  end
257
257
 
258
- end
258
+ end
@@ -62,6 +62,6 @@ bench_suite do
62
62
  }
63
63
 
64
64
  bench_case("FasterCSV Table loading", CSV_N) {
65
- FasterCSV::Table.new(FasterCSV.read("util/bench/samples/tattle.csv"))
65
+ ::CSV::Table.new(::CSV.read("util/bench/samples/tattle.csv"))
66
66
  }
67
67
  end
metadata CHANGED
@@ -1,65 +1,93 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruport
3
- version: !ruby/object:Gem::Version
4
- version: 1.6.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.7.1
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Gregory Brown
8
8
  - Mike Milner
9
9
  - Andrew France
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2009-12-13 00:00:00 +11:00
15
- default_executable:
16
- dependencies:
17
- - !ruby/object:Gem::Dependency
18
- name: fastercsv
19
- type: :runtime
20
- version_requirement:
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: "0"
26
- version:
27
- - !ruby/object:Gem::Dependency
13
+ date: 2017-05-02 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
28
16
  name: pdf-writer
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.1.8
29
22
  type: :runtime
30
- version_requirement:
31
- version_requirements: !ruby/object:Gem::Requirement
32
- requirements:
33
- - - "="
34
- - !ruby/object:Gem::Version
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - '='
27
+ - !ruby/object:Gem::Version
35
28
  version: 1.1.8
36
- version:
37
- description: " Ruby Reports is a software library that aims to make the task of reporting\n less tedious and painful. It provides tools for data acquisition,\n database interaction, formatting, and parsing/munging.\n"
29
+ - !ruby/object:Gem::Dependency
30
+ name: prawn
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '='
34
+ - !ruby/object:Gem::Version
35
+ version: 0.12.0
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '='
41
+ - !ruby/object:Gem::Version
42
+ version: 0.12.0
43
+ - !ruby/object:Gem::Dependency
44
+ name: rake
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ description: |
58
+ Ruby Reports is a software library that aims to make the task of reporting
59
+ less tedious and painful. It provides tools for data acquisition,
60
+ database interaction, formatting, and parsing/munging.
38
61
  email: gregory.t.brown@gmail.com
39
62
  executables: []
40
-
41
63
  extensions: []
42
-
43
- extra_rdoc_files:
64
+ extra_rdoc_files:
44
65
  - LICENSE
45
- - README
46
- files:
66
+ - README.rdoc
67
+ files:
47
68
  - AUTHORS
48
69
  - COPYING
49
70
  - HACKING
50
71
  - LICENSE
51
- - README
72
+ - README.rdoc
52
73
  - Rakefile
53
74
  - examples/RWEmerson.jpg
75
+ - examples/add_row_table.rb
54
76
  - examples/anon.rb
55
77
  - examples/btree/commaleon/commaleon.rb
56
78
  - examples/btree/commaleon/sample_data/ticket_count.csv
57
79
  - examples/btree/commaleon/sample_data/ticket_count2.csv
58
80
  - examples/centered_pdf_text_box.rb
59
81
  - examples/data/tattle.dump
82
+ - examples/data/wine.csv
60
83
  - examples/example.csv
61
84
  - examples/line_plotter.rb
85
+ - examples/pdf_grouping.rb
62
86
  - examples/pdf_report_with_common_base.rb
87
+ - examples/pdf_table.rb
88
+ - examples/pdf_table_from_csv.rb
89
+ - examples/pdf_table_prawn.rb
90
+ - examples/pdf_table_simple.rb
63
91
  - examples/png_embed.rb
64
92
  - examples/roadmap.png
65
93
  - examples/row_renderer.rb
@@ -82,6 +110,7 @@ files:
82
110
  - lib/ruport/formatter/csv.rb
83
111
  - lib/ruport/formatter/html.rb
84
112
  - lib/ruport/formatter/pdf.rb
113
+ - lib/ruport/formatter/prawn_pdf.rb
85
114
  - lib/ruport/formatter/template.rb
86
115
  - lib/ruport/formatter/text.rb
87
116
  - lib/ruport/version.rb
@@ -92,7 +121,6 @@ files:
92
121
  - test/grouping_test.rb
93
122
  - test/helpers.rb
94
123
  - test/html_formatter_test.rb
95
- - test/pdf_formatter_test.rb
96
124
  - test/record_test.rb
97
125
  - test/samples/addressbook.csv
98
126
  - test/samples/data.csv
@@ -101,6 +129,7 @@ files:
101
129
  - test/samples/erb_test.sql
102
130
  - test/samples/query_test.sql
103
131
  - test/samples/ruport_test.sql
132
+ - test/samples/sales.csv
104
133
  - test/samples/test.sql
105
134
  - test/samples/test.yaml
106
135
  - test/samples/ticket_count.csv
@@ -124,60 +153,79 @@ files:
124
153
  - util/bench/samples/tattle.csv
125
154
  - util/release/freshmeat.rb
126
155
  - util/release/raa.rb
127
- has_rdoc: true
128
- homepage: http://rubyreports.org
156
+ homepage: http://github.com/ruport/ruport
129
157
  licenses: []
130
-
158
+ metadata: {}
131
159
  post_install_message:
132
- rdoc_options:
133
- - --title
160
+ rdoc_options:
161
+ - "--title"
134
162
  - Ruport Documentation
135
- - --main
136
- - README
137
- - -q
138
- require_paths:
163
+ - "--main"
164
+ - README.rdoc
165
+ - "-q"
166
+ require_paths:
139
167
  - lib
140
- required_ruby_version: !ruby/object:Gem::Requirement
141
- requirements:
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
142
170
  - - ">="
143
- - !ruby/object:Gem::Version
144
- version: "0"
145
- version:
146
- required_rubygems_version: !ruby/object:Gem::Requirement
147
- requirements:
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
148
175
  - - ">="
149
- - !ruby/object:Gem::Version
150
- version: "0"
151
- version:
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
152
178
  requirements: []
153
-
154
- rubyforge_project: ruport
155
- rubygems_version: 1.3.5
179
+ rubyforge_project:
180
+ rubygems_version: 2.6.10
156
181
  signing_key:
157
- specification_version: 3
182
+ specification_version: 4
158
183
  summary: A generalized Ruby report generation and templating engine.
159
- test_files:
160
- - test/template_test.rb
161
- - test/record_test.rb
162
- - test/csv_formatter_test.rb
163
- - test/data_feeder_test.rb
164
- - test/table_pivot_test.rb
165
- - test/helpers.rb
166
- - test/table_test.rb
167
- - test/text_formatter_test.rb
168
- - test/html_formatter_test.rb
169
- - test/grouping_test.rb
170
- - test/controller_test.rb
171
- - test/pdf_formatter_test.rb
184
+ test_files:
185
+ - examples/RWEmerson.jpg
186
+ - examples/add_row_table.rb
187
+ - examples/anon.rb
188
+ - examples/btree/commaleon/commaleon.rb
189
+ - examples/btree/commaleon/sample_data/ticket_count.csv
190
+ - examples/btree/commaleon/sample_data/ticket_count2.csv
172
191
  - examples/centered_pdf_text_box.rb
192
+ - examples/data/tattle.dump
193
+ - examples/data/wine.csv
194
+ - examples/example.csv
173
195
  - examples/line_plotter.rb
174
- - examples/btree/commaleon/commaleon.rb
175
- - examples/anon.rb
196
+ - examples/pdf_grouping.rb
176
197
  - examples/pdf_report_with_common_base.rb
198
+ - examples/pdf_table.rb
199
+ - examples/pdf_table_from_csv.rb
200
+ - examples/pdf_table_prawn.rb
201
+ - examples/pdf_table_simple.rb
202
+ - examples/png_embed.rb
203
+ - examples/roadmap.png
177
204
  - examples/row_renderer.rb
178
- - examples/tattle_ruby_version.rb
179
205
  - examples/simple_pdf_lines.rb
180
- - examples/png_embed.rb
181
- - examples/trac_ticket_status.rb
182
- - examples/tattle_rubygems_version.rb
183
206
  - examples/simple_templating_example.rb
207
+ - examples/tattle_ruby_version.rb
208
+ - examples/tattle_rubygems_version.rb
209
+ - examples/trac_ticket_status.rb
210
+ - test/controller_test.rb
211
+ - test/csv_formatter_test.rb
212
+ - test/data_feeder_test.rb
213
+ - test/grouping_test.rb
214
+ - test/helpers.rb
215
+ - test/html_formatter_test.rb
216
+ - test/record_test.rb
217
+ - test/samples/addressbook.csv
218
+ - test/samples/data.csv
219
+ - test/samples/data.tsv
220
+ - test/samples/dates.csv
221
+ - test/samples/erb_test.sql
222
+ - test/samples/query_test.sql
223
+ - test/samples/ruport_test.sql
224
+ - test/samples/sales.csv
225
+ - test/samples/test.sql
226
+ - test/samples/test.yaml
227
+ - test/samples/ticket_count.csv
228
+ - test/table_pivot_test.rb
229
+ - test/table_test.rb
230
+ - test/template_test.rb
231
+ - test/text_formatter_test.rb
data/README DELETED
@@ -1,114 +0,0 @@
1
- # -----------------------------------------------------------------
2
- # Contents:
3
- #
4
- # + What Ruport Is
5
- # + Installation
6
- # + Resources
7
- # + Hacking
8
- #
9
- # = What Ruport Is
10
- #
11
- # Ruby Reports (Ruport) is an extensible reporting system.
12
- #
13
- # It aims to be as lightweight as possible while still providing core support
14
- # for data aggregation and manipulation as well as multi-format rendering
15
- # of reports.
16
- #
17
- # Ruport provides tools for using a number of data sources, including CSV files,
18
- # ActiveRecord models, and raw SQL connections via RubyDBI (through ruport-util).
19
- #
20
- # Data manipulation is easy as there are standard structures that support
21
- # record, table, and grouping operations. These all can be extended to
22
- # implement custom behavior as needed.
23
- #
24
- # For common tasks, Ruport provides formatters for CSV, HTML, PDF, and text-
25
- # based reports. However, the real power lies in building custom report
26
- # controllers and formatters. The base formatting libraries provide a number
27
- # of helper functions that will let you build complex reports while maintaining
28
- # a DRY and consistent interface.
29
- #
30
- # To get a quick feel for what you can accomplish with Ruport, take a look at
31
- # a few simple examples provided on our web site.
32
- #
33
- # http://rubyreports.org/examples.html
34
- #
35
- # Since Ruport's core support is intentionally minimalistic, you may be looking
36
- # for some higher level support for specific needs such as graphing, invoices,
37
- # report mailing support, etc. For this, you may wish to take a look at the
38
- # ruport-util package, which contains some generally useful tools and libraries
39
- # to extend Ruport's capabilities.
40
- #
41
- # = Installation
42
- #
43
- # To install ruport via rubygems:
44
- #
45
- # sudo gem install ruport
46
- #
47
- # Check to see if it installed properly:
48
- #
49
- # ruby -rubygems -e "require 'ruport'; puts Ruport::VERSION"
50
- #
51
- # If you get an error, please let us know on our mailing list.
52
- #
53
- # Dependencies Details:
54
- #
55
- # -- formatting
56
- #
57
- # Ruport relies on PDF::Writer and FasterCSV for its formatting support.
58
- # If you want to make use of textile helpers, you'll also need RedCloth.
59
- #
60
- # -- database interaction
61
- #
62
- # If you wish to use Ruport to report against a rails project,
63
- # a camping project, or do standalone acts_as_reportable reports, you'll need
64
- # ActiveRecord and the acts_as_reportable gem.
65
- #
66
- # If you want to use Ruport::Query for raw SQL support, you'll need to
67
- # install ruport-util, RubyDBI and whatever database drivers you might need.
68
- #
69
- # = Resources
70
- #
71
- # Our developers have published a free-content book about all things
72
- # Ruport, including complete coverage of acts_as_reportable and some of
73
- # ruport-util's features. This book serves as the definitive guide to
74
- # Ruport, so all users should become acquainted with it:
75
- #
76
- # http://ruportbook.com
77
- #
78
- # The next best way to get help and make suggestions is the Ruport mailing list.
79
- # This software is on the move, so the list is the most reliable way of getting
80
- # up to date information.
81
- #
82
- # - You can sign up and/or view the archives here:
83
- # http://groups.google.com/group/ruby-reports
84
- #
85
- # If you are looking to dig a little deeper, there are a couple more resources
86
- # that may be helpful to you.
87
- #
88
- # - The latest stable API documentation is available at:
89
- # http://api.rubyreports.org
90
- #
91
- # - Our Trac is at: http://code.rubyreports.org/ruport
92
- # You may use the username ruport and password blinky to file tickets.
93
- #
94
- # = Hacking
95
- #
96
- # If you'd like to contribute code to Ruport, please join our development
97
- # mailing list, and let us know what you'd like to do!
98
- #
99
- # http://groups.google.com/group/ruport-dev
100
- #
101
- # It also may be worthwhile to join this list if you plan on running edge
102
- # versions of Ruport, as this is where we make announcements about major
103
- # breakage in trunk.
104
- #
105
- # We are very responsive to contributors, and review every patch we receive
106
- # fairly quickly. Most contributors who successfully get a patch or two applied
107
- # are given write access to the repositories and invited to join Ruport's
108
- # development team. Since we view every user as potential contributor, this
109
- # approach works well for us.
110
- #
111
- # So if you want to help out with Ruport, we'll happy accept your efforts!
112
-
113
-
114
-