ruport 0.8.12 → 0.8.13

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.
data/Rakefile CHANGED
@@ -8,6 +8,8 @@ rescue LoadError
8
8
  nil
9
9
  end
10
10
 
11
+ RUPORT_VERSION = "0.8.13"
12
+
11
13
  #Set to true to disable dependency resolution
12
14
  LEAN=false
13
15
  dir = File.dirname(__FILE__)
@@ -23,7 +25,7 @@ end
23
25
 
24
26
  spec = Gem::Specification.new do |spec|
25
27
  spec.name = LEAN ? "lean-ruport" : "ruport"
26
- spec.version = "0.8.12"
28
+ spec.version = RUPORT_VERSION
27
29
  spec.platform = Gem::Platform::RUBY
28
30
  spec.summary = "A generalized Ruby report generation and templating engine."
29
31
  spec.files = Dir.glob("{examples,lib,test,bin}/**/**/*") +
@@ -73,6 +75,14 @@ Rake::GemPackageTask.new(spec) do |pkg|
73
75
  pkg.need_tar = true
74
76
  end
75
77
 
78
+ task :build_archives => [:package,:rcov,:rdoc] do
79
+ mv "pkg/ruport-#{RUPORT_VERSION}.tgz", "pkg/ruport-#{RUPORT_VERSION}.tar.gz"
80
+ sh "tar cjvf pkg/ruport_coverage-#{RUPORT_VERSION}.tar.bz2 coverage"
81
+ sh "tar cjvf pkg/ruport_doc-#{RUPORT_VERSION}.tar.bz2 doc/html"
82
+ cd "pkg"
83
+ sh "tar cjvf ruport-#{RUPORT_VERSION}.tar.bz2 ruport-#{RUPORT_VERSION}"
84
+ end
85
+
76
86
  begin
77
87
  require 'rcov/rcovtask'
78
88
  Rcov::RcovTask.new do |t|
data/lib/ruport.rb CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  module Ruport
14
14
 
15
- VERSION = "0.8.12"
15
+ VERSION = "0.8.13"
16
16
 
17
17
  # This method is Ruport's logging and error interface. It can generate
18
18
  # warnings or raise fatal errors, logging +message+ to the file defined by
@@ -60,7 +60,7 @@ module Ruport
60
60
  # c.source :default,
61
61
  # :dsn => "dbi:mysql:foo",
62
62
  # :user => "clyde",
63
- # :password => "pman"
63
+ # :password => "pacman"
64
64
  #
65
65
  # c.mailer :default,
66
66
  # :host => "mail.example.com",
@@ -183,7 +183,9 @@ module Ruport::Data
183
183
  self
184
184
  end
185
185
 
186
- # Takes an old name and a new name and renames an attribute.
186
+ # Takes an old name and a new name and renames an attribute.
187
+ #
188
+ # The third option, update_index is for internal use.
187
189
  def rename_attribute(old_name,new_name,update_index=true)
188
190
  @attributes[@attributes.index(old_name)] = new_name if update_index
189
191
  @data[new_name] = @data.delete(old_name)
@@ -222,13 +224,24 @@ module Ruport::Data
222
224
  end
223
225
  end
224
226
 
225
- #indifferentish access that also can call methods
227
+ # Indifferent access to attributes.
228
+ #
229
+ # Examples:
230
+ #
231
+ # record.get(:foo) # looks for an attribute "foo" or :foo,
232
+ # or calls the method <tt>foo</tt>
233
+ #
234
+ # record.get("foo") # looks for an attribute "foo" or :foo
235
+ #
236
+ # record.get(0) # Gets the first element
226
237
  def get(name)
227
238
  case name
228
239
  when Symbol
229
240
  send(name)
230
241
  when String
231
242
  self[attributes.find { |a| a.to_s.eql?(name)}]
243
+ when Fixnum
244
+ self[name]
232
245
  else
233
246
  raise "Whatchu Talkin' Bout, Willis?"
234
247
  end
@@ -390,15 +390,15 @@ module Ruport::Data
390
390
  #
391
391
  # FIXME: loses tags
392
392
  def sub_table(columns=column_names,range=nil)
393
- Table(columns) do |t|
394
- if range
395
- data[range].each { |r| t << r }
396
- elsif block_given?
397
- data.each { |r| t << r if yield(r) }
398
- else
399
- data.each { |r| t << r }
400
- end
401
- end
393
+ t =Ruport::Data::Table.new(:column_names => columns)
394
+ if range
395
+ data[range].each { |r| t << r }
396
+ elsif block_given?
397
+ data.each { |r| t << r if yield(r) }
398
+ else
399
+ data.each { |r| t << r }
400
+ end
401
+ return t
402
402
  end
403
403
 
404
404
  # returns an array of values for the given column name
@@ -480,8 +480,7 @@ module Ruport::Data
480
480
  sort_by(&block)
481
481
  end
482
482
 
483
- table =
484
- data_array.to_table(@column_names)
483
+ table = Table.new(:data => data_array, :column_names => @column_names)
485
484
 
486
485
  table.tags = self.tags
487
486
  return table
@@ -614,7 +613,7 @@ module Kernel
614
613
  when /\.csv/
615
614
  Ruport::Data::Table.load(*args)
616
615
  else
617
- [].to_table(args)
616
+ Ruport::Data::Table.new(:data => [],:column_names => args)
618
617
  end
619
618
 
620
619
  block[table] if block
data/test/test_record.rb CHANGED
@@ -250,4 +250,12 @@ class TestRecord < Test::Unit::TestCase
250
250
  assert_equal(2,a.get(:b))
251
251
  end
252
252
 
253
- end
253
+ def test_ensure_get_works_ordinally
254
+ a = Record.new({"a" => 1, "b" => 2})
255
+ assert_nothing_raised { a.get(0) }
256
+ b = Record.new({"a" => 1, "b" => 2},:attributes => %w[a b])
257
+ assert_equal 2, a.get(1)
258
+ assert_equal 1, a.get(0)
259
+ end
260
+
261
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: ruport
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.12
7
- date: 2007-03-14 00:00:00 -04:00
6
+ version: 0.8.13
7
+ date: 2007-04-01 00:00:00 -04:00
8
8
  summary: A generalized Ruby report generation and templating engine.
9
9
  require_paths:
10
10
  - lib
@@ -29,128 +29,128 @@ post_install_message:
29
29
  authors:
30
30
  - Gregory Brown
31
31
  files:
32
- - examples/rope_examples
33
- - examples/RWEmerson.jpg
34
32
  - examples/centered_pdf_text_box.rb
35
- - examples/line_plotter.rb
33
+ - examples/invoice.rb
36
34
  - examples/invoice_report.rb
37
35
  - examples/line_graph.rb
36
+ - examples/line_plotter.rb
38
37
  - examples/pdf_complex_report.rb
39
- - examples/invoice.rb
40
38
  - examples/pdf_table_with_title.rb
41
- - examples/rope_examples/sales_report
39
+ - examples/rope_examples
40
+ - examples/RWEmerson.jpg
42
41
  - examples/rope_examples/itunes
43
- - examples/rope_examples/sales_report/sql
44
- - examples/rope_examples/sales_report/test
45
- - examples/rope_examples/sales_report/output
46
- - examples/rope_examples/sales_report/log
47
- - examples/rope_examples/sales_report/config
48
- - examples/rope_examples/sales_report/lib
49
- - examples/rope_examples/sales_report/data
50
- - examples/rope_examples/sales_report/util
51
- - examples/rope_examples/sales_report/templates
52
- - examples/rope_examples/sales_report/Rakefile
53
- - examples/rope_examples/sales_report/README
54
- - examples/rope_examples/sales_report/test/test_sales.rb
55
- - examples/rope_examples/sales_report/output/books.pdf
56
- - examples/rope_examples/sales_report/output/books.txt
57
- - examples/rope_examples/sales_report/log/ruport.log
58
- - examples/rope_examples/sales_report/config/ruport_config.rb
59
- - examples/rope_examples/sales_report/lib/reports
60
- - examples/rope_examples/sales_report/lib/reports.rb
61
- - examples/rope_examples/sales_report/lib/helpers.rb
62
- - examples/rope_examples/sales_report/lib/init.rb
63
- - examples/rope_examples/sales_report/lib/reports/sales.rb
64
- - examples/rope_examples/sales_report/util/build
65
- - examples/rope_examples/sales_report/util/sql_exec
66
- - examples/rope_examples/itunes/sql
67
- - examples/rope_examples/itunes/test
68
- - examples/rope_examples/itunes/output
69
- - examples/rope_examples/itunes/log
42
+ - examples/rope_examples/sales_report
70
43
  - examples/rope_examples/itunes/config
71
- - examples/rope_examples/itunes/lib
72
44
  - examples/rope_examples/itunes/data
73
- - examples/rope_examples/itunes/util
74
- - examples/rope_examples/itunes/templates
45
+ - examples/rope_examples/itunes/lib
46
+ - examples/rope_examples/itunes/log
47
+ - examples/rope_examples/itunes/output
75
48
  - examples/rope_examples/itunes/Rakefile
76
49
  - examples/rope_examples/itunes/README
77
- - examples/rope_examples/itunes/test/test_playlist.rb
78
- - examples/rope_examples/itunes/log/ruport.log
50
+ - examples/rope_examples/itunes/sql
51
+ - examples/rope_examples/itunes/templates
52
+ - examples/rope_examples/itunes/test
53
+ - examples/rope_examples/itunes/util
79
54
  - examples/rope_examples/itunes/config/ruport_config.rb
80
- - examples/rope_examples/itunes/lib/reports
81
- - examples/rope_examples/itunes/lib/reports.rb
55
+ - examples/rope_examples/itunes/data/mix.txt
82
56
  - examples/rope_examples/itunes/lib/helpers.rb
83
57
  - examples/rope_examples/itunes/lib/init.rb
58
+ - examples/rope_examples/itunes/lib/reports
59
+ - examples/rope_examples/itunes/lib/reports.rb
84
60
  - examples/rope_examples/itunes/lib/reports/playlist.rb
85
- - examples/rope_examples/itunes/data/mix.txt
61
+ - examples/rope_examples/itunes/log/ruport.log
62
+ - examples/rope_examples/itunes/test/test_playlist.rb
86
63
  - examples/rope_examples/itunes/util/build
87
64
  - examples/rope_examples/itunes/util/sql_exec
65
+ - examples/rope_examples/sales_report/config
66
+ - examples/rope_examples/sales_report/data
67
+ - examples/rope_examples/sales_report/lib
68
+ - examples/rope_examples/sales_report/log
69
+ - examples/rope_examples/sales_report/output
70
+ - examples/rope_examples/sales_report/Rakefile
71
+ - examples/rope_examples/sales_report/README
72
+ - examples/rope_examples/sales_report/sql
73
+ - examples/rope_examples/sales_report/templates
74
+ - examples/rope_examples/sales_report/test
75
+ - examples/rope_examples/sales_report/util
76
+ - examples/rope_examples/sales_report/config/ruport_config.rb
77
+ - examples/rope_examples/sales_report/lib/helpers.rb
78
+ - examples/rope_examples/sales_report/lib/init.rb
79
+ - examples/rope_examples/sales_report/lib/reports
80
+ - examples/rope_examples/sales_report/lib/reports.rb
81
+ - examples/rope_examples/sales_report/lib/reports/sales.rb
82
+ - examples/rope_examples/sales_report/log/ruport.log
83
+ - examples/rope_examples/sales_report/output/books.pdf
84
+ - examples/rope_examples/sales_report/output/books.txt
85
+ - examples/rope_examples/sales_report/test/test_sales.rb
86
+ - examples/rope_examples/sales_report/util/build
87
+ - examples/rope_examples/sales_report/util/sql_exec
88
88
  - lib/ruport
89
- - lib/uport.rb
90
89
  - lib/ruport.rb
91
- - lib/ruport/format
92
- - lib/ruport/query
93
- - lib/ruport/renderer
90
+ - lib/uport.rb
91
+ - lib/ruport/attempt.rb
92
+ - lib/ruport/config.rb
94
93
  - lib/ruport/data
95
- - lib/ruport/report
94
+ - lib/ruport/data.rb
95
+ - lib/ruport/extensions.rb
96
+ - lib/ruport/format
97
+ - lib/ruport/format.rb
98
+ - lib/ruport/generator.rb
96
99
  - lib/ruport/layout
97
100
  - lib/ruport/layout.rb
98
- - lib/ruport/attempt.rb
99
- - lib/ruport/generator.rb
100
- - lib/ruport/format.rb
101
- - lib/ruport/extensions.rb
102
- - lib/ruport/system_extensions.rb
101
+ - lib/ruport/mailer.rb
102
+ - lib/ruport/query
103
103
  - lib/ruport/query.rb
104
- - lib/ruport/config.rb
104
+ - lib/ruport/renderer
105
105
  - lib/ruport/renderer.rb
106
- - lib/ruport/mailer.rb
107
- - lib/ruport/data.rb
106
+ - lib/ruport/report
108
107
  - lib/ruport/report.rb
108
+ - lib/ruport/system_extensions.rb
109
+ - lib/ruport/data/groupable.rb
110
+ - lib/ruport/data/record.rb
111
+ - lib/ruport/data/table.rb
112
+ - lib/ruport/data/taggable.rb
113
+ - lib/ruport/format/csv.rb
114
+ - lib/ruport/format/html.rb
109
115
  - lib/ruport/format/latex.rb
116
+ - lib/ruport/format/pdf.rb
110
117
  - lib/ruport/format/plugin.rb
111
118
  - lib/ruport/format/svg.rb
112
- - lib/ruport/format/xml.rb
113
- - lib/ruport/format/html.rb
114
119
  - lib/ruport/format/text.rb
115
- - lib/ruport/format/pdf.rb
116
- - lib/ruport/format/csv.rb
120
+ - lib/ruport/format/xml.rb
121
+ - lib/ruport/layout/component.rb
117
122
  - lib/ruport/query/sql_split.rb
118
123
  - lib/ruport/renderer/graph.rb
119
124
  - lib/ruport/renderer/table.rb
120
- - lib/ruport/data/record.rb
121
- - lib/ruport/data/groupable.rb
122
- - lib/ruport/data/taggable.rb
123
- - lib/ruport/data/table.rb
124
125
  - lib/ruport/report/graph.rb
125
- - lib/ruport/layout/component.rb
126
+ - test/_test_database.rb
126
127
  - test/samples
127
- - test/test_record.rb
128
- - test/test_groupable.rb
129
- - test/test_table.rb
130
- - test/test_graph_renderer.rb
131
- - test/test_ruport.rb
128
+ - test/test_config.rb
132
129
  - test/test_format_text.rb
133
- - test/_test_database.rb
130
+ - test/test_graph_renderer.rb
131
+ - test/test_groupable.rb
132
+ - test/test_mailer.rb
134
133
  - test/test_query.rb
135
- - test/test_config.rb
136
- - test/test_taggable.rb
134
+ - test/test_record.rb
137
135
  - test/test_renderer.rb
138
- - test/test_mailer.rb
139
- - test/test_sql_split.rb
140
136
  - test/test_report.rb
137
+ - test/test_ruport.rb
138
+ - test/test_sql_split.rb
139
+ - test/test_table.rb
141
140
  - test/test_table_renderer.rb
142
- - test/samples/test.yaml
143
- - test/samples/query_test.sql
141
+ - test/test_taggable.rb
142
+ - test/samples/addressbook.csv
144
143
  - test/samples/data.csv
145
- - test/samples/foo.rtxt
146
144
  - test/samples/data.tsv
147
- - test/samples/erb_test.sql
148
- - test/samples/stonecodeblog.sql
149
- - test/samples/ruport_test.sql
150
- - test/samples/addressbook.csv
151
145
  - test/samples/dates.csv
152
146
  - test/samples/document.xml
147
+ - test/samples/erb_test.sql
148
+ - test/samples/foo.rtxt
149
+ - test/samples/query_test.sql
150
+ - test/samples/ruport_test.sql
151
+ - test/samples/stonecodeblog.sql
153
152
  - test/samples/test.sql
153
+ - test/samples/test.yaml
154
154
  - bin/rope
155
155
  - Rakefile
156
156
  - setup.rb
@@ -159,20 +159,20 @@ files:
159
159
  - TODO
160
160
  - AUTHORS
161
161
  test_files:
162
- - test/test_record.rb
163
- - test/test_groupable.rb
164
- - test/test_table.rb
165
- - test/test_graph_renderer.rb
166
- - test/test_ruport.rb
162
+ - test/test_config.rb
167
163
  - test/test_format_text.rb
164
+ - test/test_graph_renderer.rb
165
+ - test/test_groupable.rb
166
+ - test/test_mailer.rb
168
167
  - test/test_query.rb
169
- - test/test_config.rb
170
- - test/test_taggable.rb
168
+ - test/test_record.rb
171
169
  - test/test_renderer.rb
172
- - test/test_mailer.rb
173
- - test/test_sql_split.rb
174
170
  - test/test_report.rb
171
+ - test/test_ruport.rb
172
+ - test/test_sql_split.rb
173
+ - test/test_table.rb
175
174
  - test/test_table_renderer.rb
175
+ - test/test_taggable.rb
176
176
  rdoc_options:
177
177
  - --title
178
178
  - Ruport Documentation