ruport 0.4.21 → 0.4.23

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,4 +1,28 @@
1
- The current version of Ruby Reports is 0.4.21
1
+ The current version of Ruby Reports is 0.4.23
2
+
3
+ changes since 0.4.21
4
+
5
+ - JH's invoice engine integrated
6
+
7
+ - Added rope, a tool for building a friendly environment for reports that use
8
+ Ruport.
9
+
10
+ - Fixed very broken Ruport::Query (DataSet aftermath)
11
+ We need to figure out a way to test this class better.
12
+
13
+ - Added Data::Table#add_column which is useful for calculated fields. (#19)
14
+
15
+ - Data::Table.reorder now works properly.
16
+ (Can use integer indices or attributes)
17
+
18
+ - Moved Data::Table.to_format to Collection, but be warned that the plugins must
19
+ support the collection you call them on. (Set is not fully supported yet)
20
+
21
+ - Renamed Query#to_dataset to Query#to_table
22
+
23
+ - Array#to_table now supports just passing an array of column_names if you do
24
+ not need other keyword arguments. This makes the interface support to_ds
25
+ style calls.
2
26
 
3
27
  changes since 0.4.19
4
28
  - Added a rake task to run rcov
data/Rakefile CHANGED
@@ -23,16 +23,17 @@ end
23
23
 
24
24
  spec = Gem::Specification.new do |spec|
25
25
  spec.name = LEAN ? "lean-ruport" : "ruport"
26
- spec.version = "0.4.21"
26
+ spec.version = "0.4.23"
27
27
  spec.platform = Gem::Platform::RUBY
28
28
  spec.summary = "A generalized Ruby report generation and templating engine."
29
- spec.files = Dir.glob("{examples,lib,test}/**/**/*") +
29
+ spec.files = Dir.glob("{examples,lib,test,bin}/**/**/*") +
30
30
  ["Rakefile", "setup.rb"]
31
31
 
32
32
  spec.require_path = "lib"
33
33
 
34
34
  spec.test_file = "test/ts_all.rb"
35
-
35
+ spec.bindir = "bin"
36
+ spec.executables = FileList["rope"]
36
37
  spec.has_rdoc = true
37
38
  spec.extra_rdoc_files = %w{README LICENSE TODO AUTHORS CHANGELOG}
38
39
  spec.rdoc_options << '--title' << 'Ruport Documentation' <<
data/TODO CHANGED
@@ -1,19 +1,8 @@
1
- TODO: (Wiped clean for a fresh start as of 2006.02.20)
1
+ TODO:
2
2
 
3
- Immediate Goals:
3
+ This file needs updating badly.
4
4
 
5
- Features:
5
+ In the interim, check the Roadmap at
6
+ http://stonecode.svnrepository.com/ruport
6
7
 
7
- - PDF document support + example
8
-
9
- - Composite key selection
10
-
11
- - Value modification predicate.
12
- DataRow#set_value_if("my_value") { # my_condition }
13
- (Update: What was I talking about here???)
14
-
15
- - Column based default values
16
-
17
- - Document the inner classes of Format
18
-
19
- - Calculated fields
8
+ - Check out the way Ruport.log prints
@@ -0,0 +1,116 @@
1
+ require "fileutils"
2
+ include FileUtils
3
+
4
+ if ARGV.empty?
5
+ puts "Usage: rope project_name"
6
+ exit
7
+ end
8
+ project = ARGV[0]
9
+
10
+ RAKEFILE = <<-EOS
11
+ require "rubygems" rescue LoadError nil
12
+ require "rake/testtask"
13
+
14
+ task :default => [:test]
15
+
16
+ Rake::TestTask.new do |test|
17
+ test.libs << "test"
18
+ test.pattern = 'test/**/tc_*.rb'
19
+ test.verbose = true
20
+ end
21
+
22
+ EOS
23
+
24
+ CONFIG = <<-EOS
25
+ require "ruport"
26
+
27
+ # For details, see Ruport::Config documentation
28
+ Ruport.configure { |c|
29
+ c.source :default, :user => "root",
30
+ :dsn => "dbi:mysql:mydb"
31
+ c.log_file "log/ruport.log"
32
+ }
33
+
34
+ EOS
35
+
36
+ BUILD = '
37
+
38
+ def format_class_name(string)
39
+ string.downcase.split("_").map { |s| s.capitalize }.join
40
+ end
41
+
42
+ unless ARGV.length > 1
43
+ puts "usage build.rb [command] [options]"
44
+ exit
45
+ end
46
+
47
+ class_name = format_class_name(ARGV[1])
48
+
49
+ exit if File.exist? "app/reports/#{ARGV[1]}.rb"
50
+ if ARGV[0].eql? "report"
51
+ File.open("app/reports.rb", "a") { |f|
52
+ f << "require \"app/reports/#{ARGV[1]}\""
53
+ }
54
+ REP = <<-EOR
55
+ require "rubygems" rescue LoadError nil
56
+ require "ruport"
57
+ require "config/ruport_config"
58
+
59
+ class #{class_name} < Ruport::Report
60
+
61
+ #optional
62
+ prepare { }
63
+
64
+ #mandatory
65
+ generate { }
66
+
67
+ #optional
68
+ cleanup { }
69
+
70
+ end
71
+
72
+ ##{class_name}.run { |res| puts res.results }
73
+ EOR
74
+
75
+ TEST = <<-EOR
76
+ require "rubygems" rescue LoadError nil
77
+ require "ruport"
78
+ require "test/unit"
79
+ require "app/reports/#{ARGV[1]}"
80
+ require "config/ruport_config"
81
+
82
+ class Test#{class_name} < Test::Unit::TestCase
83
+ def test_flunk
84
+ flunk "Write your real tests here or in any test/tc_* file"
85
+ end
86
+ end
87
+ EOR
88
+ File.open("app/reports/#{ARGV[1]}.rb", "w") { |f| f << REP }
89
+ File.open("test/tc_#{ARGV[1]}.rb","w") { |f| f << TEST }
90
+ end
91
+ '
92
+
93
+ SQL_EXEC = '
94
+ require "rubygems" rescue LoadError nil
95
+ require "ruport"
96
+ require "config/ruport_config"
97
+
98
+ puts Ruport::Query.new(ARGF.read).result
99
+ '
100
+
101
+ mkdir project
102
+
103
+ %w[test config output data app app/reports templates sql log util].each do |d|
104
+ mkdir "#{project}/#{d}"
105
+ end
106
+
107
+
108
+ touch("#{project}/app/reports.rb")
109
+ File.open("#{project}/config/ruport_config.rb","w") { |f| f << CONFIG }
110
+ File.open("#{project}/Rakefile","w") { |f| f << RAKEFILE }
111
+ File.open("#{project}/util/build.rb","w") { |f| f << BUILD }
112
+ File.open("#{project}/util/sql_exec.rb","w") { |f| f << SQL_EXEC }
113
+
114
+
115
+
116
+
@@ -0,0 +1,193 @@
1
+ %PDF-1.3
2
+ %����
3
+
4
+ 1 0 obj
5
+ << /Type /Catalog
6
+ /Outlines 2 0 R
7
+ /Pages 3 0 R>>
8
+ endobj
9
+ 2 0 obj
10
+ << /Type /Outlines >>
11
+ endobj
12
+ 3 0 obj
13
+ << /Type /Pages
14
+ /Kids [6 0 R
15
+ ]
16
+ /Count 1
17
+ /Resources <<
18
+ /ProcSet 4 0 R
19
+ /Font <<
20
+ /F1 8 0 R >>
21
+ >>
22
+ /MediaBox [0 0 612.0 792.0]
23
+ >>
24
+ endobj
25
+ 4 0 obj
26
+ [/PDF /Text ]
27
+ endobj
28
+ 5 0 obj
29
+ <<
30
+ /CreationDate (D:200608100525)
31
+ /Creator (sample_invoice_report.rb)
32
+ /Producer (PDF::Writer for Ruby)
33
+ >>
34
+ endobj
35
+ 6 0 obj
36
+ << /Type /Page
37
+ /Parent 3 0 R
38
+ /Contents [
39
+ 7 0 R
40
+ 9 0 R
41
+ 10 0 R
42
+ ]
43
+ >>
44
+ endobj
45
+ 7 0 obj
46
+ <<
47
+ /Length 1498 >>
48
+ stream
49
+
50
+ 0.000 0.000 0.000 rg
51
+ 0.000 0.000 0.000 RG
52
+ 0.800 0.800 0.800 RG
53
+ BT 36.000 742.440 Td /F1 10.0 Tf 0 Tr (Foo Inc.) Tj ET
54
+ BT 36.000 726.880 Td /F1 10.0 Tf 0 Tr (42 Rock Street) Tj ET
55
+ BT 36.000 711.320 Td /F1 10.0 Tf 0 Tr (New Haven, CT) Tj ET
56
+ 0.000 0.000 0.000 RG
57
+ 1 w
58
+ 31.000 753.750 m
59
+ 31.000 707.070 l S
60
+ 231.000 753.750 m
61
+ 231.000 707.070 l S
62
+ 30.500 753.750 m
63
+ 231.500 753.750 l S
64
+ 30.500 707.070 m
65
+ 231.500 707.070 l S
66
+ 0.800 0.800 0.800 RG
67
+ BT 36.000 685.760 Td /F1 10.0 Tf 0 Tr (Gregory Brown) Tj ET
68
+ BT 36.000 670.200 Td /F1 10.0 Tf 0 Tr (gregory.t.brown@gmail.com) Tj ET
69
+ 0.000 0.000 0.000 RG
70
+ 1 w
71
+ 31.000 697.070 m
72
+ 31.000 665.950 l S
73
+ 231.000 697.070 m
74
+ 231.000 665.950 l S
75
+ 30.500 697.070 m
76
+ 231.500 697.070 l S
77
+ 30.500 665.950 m
78
+ 231.500 665.950 l S
79
+ BT 386.000 739.816 Td /F1 14.0 Tf 0 Tr (Invoice for Gregory) Tj ET
80
+ 0.800 0.800 0.800 RG
81
+ BT 350.000 716.256 Td /F1 10.0 Tf 0 Tr (Order ID: 18180) Tj ET
82
+ BT 350.000 700.696 Td /F1 10.0 Tf 0 Tr (Customer ID: 6291) Tj ET
83
+ BT 350.000 685.136 Td /F1 10.0 Tf 0 Tr (Order Date: 2006-08-10) Tj ET
84
+ 0.000 0.000 0.000 RG
85
+ 1 w
86
+ 345.000 727.566 m
87
+ 345.000 680.886 l S
88
+ 545.000 727.566 m
89
+ 545.000 680.886 l S
90
+ 344.500 727.566 m
91
+ 545.500 727.566 l S
92
+ 344.500 680.886 m
93
+ 545.500 680.886 l S
94
+ 0.800 0.800 0.800 RG
95
+ BT 81.000 604.128 Td /F1 12.0 Tf 0 Tr (item) Tj ET
96
+ BT 335.750 604.128 Td /F1 12.0 Tf 0 Tr (price) Tj ET
97
+ q
98
+ 0.800 0.800 0.800 rg
99
+ 76.000 582.068 450.000 15.560 re f
100
+ 0.800 0.800 0.800 rg
101
+ 76.000 550.948 450.000 15.560 re f
102
+ 1 w
103
+ Q
104
+ BT 479.984 20.000 Td /F1 8.0 Tf 0 Tr (1 of 1) Tj ET
105
+ endstream
106
+ endobj
107
+
108
+ 8 0 obj
109
+ << /Type /Font
110
+ /Subtype /Type1
111
+ /Name /F1
112
+ /BaseFont /Helvetica
113
+ /Encoding /WinAnsiEncoding
114
+ >>
115
+ endobj
116
+ 9 0 obj
117
+ <<
118
+ /Length 610 >>
119
+ stream
120
+
121
+ BT 81.000 586.318 Td /F1 10.0 Tf 0 Tr (Rock Collection) Tj ET
122
+ BT 335.750 586.318 Td /F1 10.0 Tf 0 Tr ($25.00) Tj ET
123
+ BT 81.000 570.758 Td /F1 10.0 Tf 0 Tr (Endless Sand Supply) Tj ET
124
+ BT 335.750 570.758 Td /F1 10.0 Tf 0 Tr ($500.00) Tj ET
125
+ BT 81.000 555.198 Td /F1 10.0 Tf 0 Tr (Fire Filled Pit) Tj ET
126
+ BT 335.750 555.198 Td /F1 10.0 Tf 0 Tr ($800.00) Tj ET
127
+ 0.000 0.000 0.000 RG
128
+ 1 w
129
+ 76.000 620.000 m
130
+ 76.000 550.948 l S
131
+ 1 w
132
+ 330.750 620.000 m
133
+ 330.750 550.948 l S
134
+ 1 w
135
+ 526.000 620.000 m
136
+ 526.000 550.948 l S
137
+ 75.500 620.000 m
138
+ 526.500 620.000 l S
139
+ 76.000 599.878 m
140
+ 526.000 599.878 l S
141
+ 75.500 550.948 m
142
+ 526.500 550.948 l S
143
+ endstream
144
+ endobj
145
+
146
+ 10 0 obj
147
+ <<
148
+ /Length 419 >>
149
+ stream
150
+
151
+ q
152
+ 0.000 0.000 0.000 RG
153
+ 1 w 0 J 0 j [ ] 0 d
154
+ 0.800 0.800 0.800 RG
155
+ BT 110.000 519.638 Td /F1 10.0 Tf 0 Tr (Be sure to visit our website at www.iheartruport.com) Tj ET
156
+ 0.000 0.000 0.000 RG
157
+ 1 w
158
+ 105.000 530.948 m
159
+ 105.000 515.388 l S
160
+ 505.000 530.948 m
161
+ 505.000 515.388 l S
162
+ 104.500 530.948 m
163
+ 505.500 530.948 l S
164
+ 104.500 515.388 m
165
+ 505.500 515.388 l S
166
+ BT 50.000 20.000 Td /F1 8.0 Tf 0 Tr (Printed at 01:25 10/08/2006) Tj ET
167
+ 1 w
168
+ Q
169
+ endstream
170
+ endobj
171
+
172
+ xref
173
+ 0 11
174
+ 0000000000 65535 f
175
+ 0000000015 00000 n
176
+ 0000000079 00000 n
177
+ 0000000116 00000 n
178
+ 0000000258 00000 n
179
+ 0000000287 00000 n
180
+ 0000000408 00000 n
181
+ 0000000488 00000 n
182
+ 0000002039 00000 n
183
+ 0000002146 00000 n
184
+ 0000002808 00000 n
185
+
186
+ trailer
187
+ << /Size 11
188
+ /Root 1 0 R
189
+ /Info 5 0 R
190
+ >>
191
+ startxref
192
+ 3280
193
+ %%EOF
@@ -0,0 +1,5 @@
1
+ # Logfile created on Mon Aug 07 18:58:16 EDT 2006 by logger.rb/1.5.2.7
2
+ I, [2006-08-07T18:58:16.676501 #7621] INFO -- : preparing report
3
+ I, [2006-08-07T18:58:16.677282 #7621] INFO -- : generated csv from query
4
+ I, [2006-08-07T18:58:30.411506 #7621] INFO -- : preparing report
5
+ I, [2006-08-07T18:58:30.412121 #7621] INFO -- : generated csv from query
@@ -0,0 +1,193 @@
1
+ %PDF-1.3
2
+ %����
3
+
4
+ 1 0 obj
5
+ << /Type /Catalog
6
+ /Outlines 2 0 R
7
+ /Pages 3 0 R>>
8
+ endobj
9
+ 2 0 obj
10
+ << /Type /Outlines >>
11
+ endobj
12
+ 3 0 obj
13
+ << /Type /Pages
14
+ /Kids [6 0 R
15
+ ]
16
+ /Count 1
17
+ /Resources <<
18
+ /ProcSet 4 0 R
19
+ /Font <<
20
+ /F1 8 0 R >>
21
+ >>
22
+ /MediaBox [0 0 612.0 792.0]
23
+ >>
24
+ endobj
25
+ 4 0 obj
26
+ [/PDF /Text ]
27
+ endobj
28
+ 5 0 obj
29
+ <<
30
+ /CreationDate (D:200608100525)
31
+ /Creator (sample_invoice_report.rb)
32
+ /Producer (PDF::Writer for Ruby)
33
+ >>
34
+ endobj
35
+ 6 0 obj
36
+ << /Type /Page
37
+ /Parent 3 0 R
38
+ /Contents [
39
+ 7 0 R
40
+ 9 0 R
41
+ 10 0 R
42
+ ]
43
+ >>
44
+ endobj
45
+ 7 0 obj
46
+ <<
47
+ /Length 1498 >>
48
+ stream
49
+
50
+ 0.000 0.000 0.000 rg
51
+ 0.000 0.000 0.000 RG
52
+ 0.800 0.800 0.800 RG
53
+ BT 36.000 742.440 Td /F1 10.0 Tf 0 Tr (Foo Inc.) Tj ET
54
+ BT 36.000 726.880 Td /F1 10.0 Tf 0 Tr (42 Rock Street) Tj ET
55
+ BT 36.000 711.320 Td /F1 10.0 Tf 0 Tr (New Haven, CT) Tj ET
56
+ 0.000 0.000 0.000 RG
57
+ 1 w
58
+ 31.000 753.750 m
59
+ 31.000 707.070 l S
60
+ 231.000 753.750 m
61
+ 231.000 707.070 l S
62
+ 30.500 753.750 m
63
+ 231.500 753.750 l S
64
+ 30.500 707.070 m
65
+ 231.500 707.070 l S
66
+ 0.800 0.800 0.800 RG
67
+ BT 36.000 685.760 Td /F1 10.0 Tf 0 Tr (Gregory Brown) Tj ET
68
+ BT 36.000 670.200 Td /F1 10.0 Tf 0 Tr (gregory.t.brown@gmail.com) Tj ET
69
+ 0.000 0.000 0.000 RG
70
+ 1 w
71
+ 31.000 697.070 m
72
+ 31.000 665.950 l S
73
+ 231.000 697.070 m
74
+ 231.000 665.950 l S
75
+ 30.500 697.070 m
76
+ 231.500 697.070 l S
77
+ 30.500 665.950 m
78
+ 231.500 665.950 l S
79
+ BT 386.000 739.816 Td /F1 14.0 Tf 0 Tr (Invoice for Gregory) Tj ET
80
+ 0.800 0.800 0.800 RG
81
+ BT 350.000 716.256 Td /F1 10.0 Tf 0 Tr (Order ID: 18180) Tj ET
82
+ BT 350.000 700.696 Td /F1 10.0 Tf 0 Tr (Customer ID: 6291) Tj ET
83
+ BT 350.000 685.136 Td /F1 10.0 Tf 0 Tr (Order Date: 2006-08-10) Tj ET
84
+ 0.000 0.000 0.000 RG
85
+ 1 w
86
+ 345.000 727.566 m
87
+ 345.000 680.886 l S
88
+ 545.000 727.566 m
89
+ 545.000 680.886 l S
90
+ 344.500 727.566 m
91
+ 545.500 727.566 l S
92
+ 344.500 680.886 m
93
+ 545.500 680.886 l S
94
+ 0.800 0.800 0.800 RG
95
+ BT 81.000 604.128 Td /F1 12.0 Tf 0 Tr (item) Tj ET
96
+ BT 335.750 604.128 Td /F1 12.0 Tf 0 Tr (price) Tj ET
97
+ q
98
+ 0.800 0.800 0.800 rg
99
+ 76.000 582.068 450.000 15.560 re f
100
+ 0.800 0.800 0.800 rg
101
+ 76.000 550.948 450.000 15.560 re f
102
+ 1 w
103
+ Q
104
+ BT 479.984 20.000 Td /F1 8.0 Tf 0 Tr (1 of 1) Tj ET
105
+ endstream
106
+ endobj
107
+
108
+ 8 0 obj
109
+ << /Type /Font
110
+ /Subtype /Type1
111
+ /Name /F1
112
+ /BaseFont /Helvetica
113
+ /Encoding /WinAnsiEncoding
114
+ >>
115
+ endobj
116
+ 9 0 obj
117
+ <<
118
+ /Length 610 >>
119
+ stream
120
+
121
+ BT 81.000 586.318 Td /F1 10.0 Tf 0 Tr (Rock Collection) Tj ET
122
+ BT 335.750 586.318 Td /F1 10.0 Tf 0 Tr ($25.00) Tj ET
123
+ BT 81.000 570.758 Td /F1 10.0 Tf 0 Tr (Endless Sand Supply) Tj ET
124
+ BT 335.750 570.758 Td /F1 10.0 Tf 0 Tr ($500.00) Tj ET
125
+ BT 81.000 555.198 Td /F1 10.0 Tf 0 Tr (Fire Filled Pit) Tj ET
126
+ BT 335.750 555.198 Td /F1 10.0 Tf 0 Tr ($800.00) Tj ET
127
+ 0.000 0.000 0.000 RG
128
+ 1 w
129
+ 76.000 620.000 m
130
+ 76.000 550.948 l S
131
+ 1 w
132
+ 330.750 620.000 m
133
+ 330.750 550.948 l S
134
+ 1 w
135
+ 526.000 620.000 m
136
+ 526.000 550.948 l S
137
+ 75.500 620.000 m
138
+ 526.500 620.000 l S
139
+ 76.000 599.878 m
140
+ 526.000 599.878 l S
141
+ 75.500 550.948 m
142
+ 526.500 550.948 l S
143
+ endstream
144
+ endobj
145
+
146
+ 10 0 obj
147
+ <<
148
+ /Length 419 >>
149
+ stream
150
+
151
+ q
152
+ 0.000 0.000 0.000 RG
153
+ 1 w 0 J 0 j [ ] 0 d
154
+ 0.800 0.800 0.800 RG
155
+ BT 110.000 519.638 Td /F1 10.0 Tf 0 Tr (Be sure to visit our website at www.iheartruport.com) Tj ET
156
+ 0.000 0.000 0.000 RG
157
+ 1 w
158
+ 105.000 530.948 m
159
+ 105.000 515.388 l S
160
+ 505.000 530.948 m
161
+ 505.000 515.388 l S
162
+ 104.500 530.948 m
163
+ 505.500 530.948 l S
164
+ 104.500 515.388 m
165
+ 505.500 515.388 l S
166
+ BT 50.000 20.000 Td /F1 8.0 Tf 0 Tr (Printed at 01:25 10/08/2006) Tj ET
167
+ 1 w
168
+ Q
169
+ endstream
170
+ endobj
171
+
172
+ xref
173
+ 0 11
174
+ 0000000000 65535 f
175
+ 0000000015 00000 n
176
+ 0000000079 00000 n
177
+ 0000000116 00000 n
178
+ 0000000258 00000 n
179
+ 0000000287 00000 n
180
+ 0000000408 00000 n
181
+ 0000000488 00000 n
182
+ 0000002039 00000 n
183
+ 0000002146 00000 n
184
+ 0000002808 00000 n
185
+
186
+ trailer
187
+ << /Size 11
188
+ /Root 1 0 R
189
+ /Info 5 0 R
190
+ >>
191
+ startxref
192
+ 3280
193
+ %%EOF