roo 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +2 -0
- data/lib/roo/excel.rb +0 -34
- data/lib/roo/generic_spreadsheet.rb +79 -1
- data/lib/roo/google.rb +76 -76
- data/lib/roo/openoffice.rb +15 -79
- data/lib/roo/version.rb +1 -1
- data/test/bbu.ods +0 -0
- data/test/numbers1.csv +18 -0
- data/test/numbers1_excel.csv +18 -0
- data/test/test_roo.rb +87 -35
- data/website/index.html +1 -1
- metadata +4 -2
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.8.2 2007-12-28
|
2
|
+
* 1 enhancement:
|
3
|
+
* basename() only in method #info
|
4
|
+
* 2 bugfixes
|
5
|
+
* changed logging-method to mysql-database in test code with AR, table column 'class' => 'class_name'
|
6
|
+
* reactived the Excel#to_csv method which has been disappeared in the last restructoring
|
1
7
|
== 0.8.1 2007-12-22
|
2
8
|
* 3 bugfixes
|
3
9
|
* fixed a bug with first/last-row/column in empty sheet
|
data/Manifest.txt
CHANGED
data/lib/roo/excel.rb
CHANGED
@@ -319,40 +319,6 @@ class Excel < GenericSpreadsheet
|
|
319
319
|
raise StandardError, "sheet '#{name}' not found"
|
320
320
|
end
|
321
321
|
|
322
|
-
# writes csv output to stdout or file
|
323
|
-
def write_csv_content(file=nil,sheet=nil)
|
324
|
-
file = STDOUT unless file
|
325
|
-
sheet = @default_sheet unless sheet
|
326
|
-
worksheet = @workbook.worksheet(sheet_no(sheet))
|
327
|
-
skip = 0
|
328
|
-
worksheet.each(skip) { |row_par|
|
329
|
-
1.upto(row_par.length) {|col|
|
330
|
-
file.print(",") if col > 1
|
331
|
-
cell = row_par.at(col-1)
|
332
|
-
unless cell
|
333
|
-
empty = true
|
334
|
-
else
|
335
|
-
case cell.type
|
336
|
-
when :numeric
|
337
|
-
onecelltype = :float
|
338
|
-
onecell = cell.to_f
|
339
|
-
when :text
|
340
|
-
onecelltype = :string
|
341
|
-
onecell = cell.to_s('utf-8')
|
342
|
-
when :date
|
343
|
-
onecelltype = :date
|
344
|
-
onecell = cell.date
|
345
|
-
else
|
346
|
-
onecelltype = nil
|
347
|
-
onecell = nil
|
348
|
-
end
|
349
|
-
end
|
350
|
-
file.print one_cell_output(onecelltype,onecell,empty)
|
351
|
-
}
|
352
|
-
file.print("\n")
|
353
|
-
}
|
354
|
-
end
|
355
|
-
|
356
322
|
def empty_row?(row)
|
357
323
|
content = false
|
358
324
|
row.each {|elem|
|
@@ -58,7 +58,7 @@ class GenericSpreadsheet
|
|
58
58
|
# this document.
|
59
59
|
def info
|
60
60
|
# $log.debug(self.class.to_s+"#info started")
|
61
|
-
result = "File: #{@filename}\n"+
|
61
|
+
result = "File: #{File.basename(@filename)}\n"+
|
62
62
|
"Number of sheets: #{sheets.size}\n"+
|
63
63
|
"Sheets: #{sheets.map{|sheet| sheet+", "}.to_s[0..-3]}\n"
|
64
64
|
n = 1
|
@@ -258,6 +258,21 @@ class GenericSpreadsheet
|
|
258
258
|
result
|
259
259
|
end
|
260
260
|
|
261
|
+
# write the current spreadsheet to stdout or into a file
|
262
|
+
#TODO: refactoring --> GenericSpreadsheet
|
263
|
+
|
264
|
+
def to_csv(filename=nil,sheet=nil)
|
265
|
+
sheet = @default_sheet unless sheet
|
266
|
+
if filename
|
267
|
+
file = File.open(filename,"w") # do |file|
|
268
|
+
write_csv_content(file,sheet)
|
269
|
+
file.close
|
270
|
+
else
|
271
|
+
write_csv_content(STDOUT,sheet)
|
272
|
+
end
|
273
|
+
true
|
274
|
+
end
|
275
|
+
|
261
276
|
protected
|
262
277
|
|
263
278
|
def unzip(filename)
|
@@ -311,4 +326,67 @@ class GenericSpreadsheet
|
|
311
326
|
ret
|
312
327
|
end
|
313
328
|
|
329
|
+
#TODO: refactoring to GenericSpreadsheet?
|
330
|
+
def write_csv_content(file=nil,sheet=nil)
|
331
|
+
file = STDOUT unless file
|
332
|
+
if first_row # sheet is not empty
|
333
|
+
first_row(sheet).upto(last_row(sheet)) do |row|
|
334
|
+
1.upto(last_column(sheet)) do |col|
|
335
|
+
file.print(",") if col > 1
|
336
|
+
onecell = cell(row,col,sheet)
|
337
|
+
onecelltype = celltype(row,col,sheet)
|
338
|
+
file.print one_cell_output(onecelltype,onecell,empty?(row,col,sheet))
|
339
|
+
end
|
340
|
+
file.print("\n")
|
341
|
+
end # sheet not empty
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
#TODO: refactor to Generic...
|
346
|
+
def one_cell_output(onecelltype,onecell,empty)
|
347
|
+
str = ""
|
348
|
+
if empty
|
349
|
+
str += ''
|
350
|
+
else
|
351
|
+
case onecelltype
|
352
|
+
when :string
|
353
|
+
if onecell == ""
|
354
|
+
str << ''
|
355
|
+
else
|
356
|
+
onecell.gsub!(/"/,'""')
|
357
|
+
str << ('"'+onecell+'"')
|
358
|
+
end
|
359
|
+
when :float,:percentage
|
360
|
+
if onecell == onecell.to_i
|
361
|
+
str << onecell.to_i.to_s
|
362
|
+
else
|
363
|
+
str << onecell.to_s
|
364
|
+
end
|
365
|
+
when :formula
|
366
|
+
if onecell.class == String
|
367
|
+
if onecell == ""
|
368
|
+
str << ''
|
369
|
+
else
|
370
|
+
onecell.gsub!(/"/,'""')
|
371
|
+
str << '"'+onecell+'"'
|
372
|
+
end
|
373
|
+
elsif onecell.class == Float
|
374
|
+
if onecell == onecell.to_i
|
375
|
+
str << onecell.to_i.to_s
|
376
|
+
else
|
377
|
+
str << onecell.to_s
|
378
|
+
end
|
379
|
+
else
|
380
|
+
raise "unhandled onecell-class "+onecell.class.to_s
|
381
|
+
end
|
382
|
+
when :date
|
383
|
+
str << '"'+onecell.to_s+'"'
|
384
|
+
else
|
385
|
+
raise "unhandled celltype "+onecelltype.to_s
|
386
|
+
end
|
387
|
+
end
|
388
|
+
#cells << onecell
|
389
|
+
str
|
390
|
+
end
|
391
|
+
|
314
392
|
end
|
data/lib/roo/google.rb
CHANGED
@@ -323,20 +323,20 @@ class Google < GenericSpreadsheet
|
|
323
323
|
return @last_column[sheet]
|
324
324
|
end
|
325
325
|
|
326
|
-
# write the current spreadsheet to stdout or into a file
|
327
|
-
#--
|
328
|
-
#TODO: refactoring --> GenericSpreadsheet
|
329
|
-
def to_csv(filename=nil,sheet=nil)
|
330
|
-
sheet = @default_sheet unless sheet
|
331
|
-
if filename
|
332
|
-
file = File.open(filename,"w") # do |file|
|
333
|
-
write_csv_content(file,sheet)
|
334
|
-
file.close
|
335
|
-
else
|
336
|
-
write_csv_content(STDOUT,sheet)
|
337
|
-
end
|
338
|
-
true
|
339
|
-
end
|
326
|
+
# # write the current spreadsheet to stdout or into a file
|
327
|
+
# #--
|
328
|
+
# #TODO: refactoring --> GenericSpreadsheet
|
329
|
+
# def to_csv(filename=nil,sheet=nil)
|
330
|
+
# sheet = @default_sheet unless sheet
|
331
|
+
# if filename
|
332
|
+
# file = File.open(filename,"w") # do |file|
|
333
|
+
# write_csv_content(file,sheet)
|
334
|
+
# file.close
|
335
|
+
# else
|
336
|
+
# write_csv_content(STDOUT,sheet)
|
337
|
+
# end
|
338
|
+
# true
|
339
|
+
# end
|
340
340
|
|
341
341
|
|
342
342
|
# find a row either by row number or a condition
|
@@ -504,67 +504,67 @@ class Google < GenericSpreadsheet
|
|
504
504
|
end
|
505
505
|
end
|
506
506
|
|
507
|
-
#TODO: refactoring to GenericSpreadsheet?
|
508
|
-
def write_csv_content(file=nil,sheet=nil)
|
509
|
-
file = STDOUT unless file
|
510
|
-
if first_row # sheet is not empty
|
511
|
-
first_row(sheet).upto(last_row(sheet)) do |row|
|
512
|
-
1.upto(last_column(sheet)) do |col|
|
513
|
-
file.print(",") if col > 1
|
514
|
-
onecell = cell(row,col,sheet)
|
515
|
-
onecelltype = celltype(row,col,sheet)
|
516
|
-
file.print one_cell_output(onecelltype,onecell,empty?(row,col,sheet))
|
517
|
-
end
|
518
|
-
file.print("\n")
|
519
|
-
end # sheet not empty
|
520
|
-
end
|
521
|
-
end
|
522
|
-
|
523
|
-
#TODO: refactor to Generic....
|
524
|
-
def one_cell_output(onecelltype,onecell,empty)
|
525
|
-
str = ""
|
526
|
-
if empty
|
527
|
-
str += ''
|
528
|
-
else
|
529
|
-
case onecelltype
|
530
|
-
when :string
|
531
|
-
if onecell == ""
|
532
|
-
str << ''
|
533
|
-
else
|
534
|
-
onecell.gsub!(/"/,'""')
|
535
|
-
str << ('"'+onecell+'"')
|
536
|
-
end
|
537
|
-
when :float,:percentage
|
538
|
-
if onecell == onecell.to_i
|
539
|
-
str << onecell.to_i.to_s
|
540
|
-
else
|
541
|
-
str << onecell.to_s
|
542
|
-
end
|
543
|
-
when :formula
|
544
|
-
if onecell.class == String
|
545
|
-
if onecell == ""
|
546
|
-
str << ''
|
547
|
-
else
|
548
|
-
onecell.gsub!(/"/,'""')
|
549
|
-
str << '"'+onecell+'"'
|
550
|
-
end
|
551
|
-
elsif onecell.class == Float
|
552
|
-
if onecell == onecell.to_i
|
553
|
-
str << onecell.to_i.to_s
|
554
|
-
else
|
555
|
-
str << onecell.to_s
|
556
|
-
end
|
557
|
-
else
|
558
|
-
raise "unhandled onecell-class "+onecell.class.to_s
|
559
|
-
end
|
560
|
-
when :date
|
561
|
-
str << '"'+onecell.to_s+'"'
|
562
|
-
else
|
563
|
-
raise "unhandled celltype "+onecelltype.to_s
|
564
|
-
end
|
565
|
-
end
|
566
|
-
#cells << onecell
|
567
|
-
str
|
568
|
-
end
|
507
|
+
# #TODO: refactoring to GenericSpreadsheet?
|
508
|
+
# def write_csv_content(file=nil,sheet=nil)
|
509
|
+
# file = STDOUT unless file
|
510
|
+
# if first_row # sheet is not empty
|
511
|
+
# first_row(sheet).upto(last_row(sheet)) do |row|
|
512
|
+
# 1.upto(last_column(sheet)) do |col|
|
513
|
+
# file.print(",") if col > 1
|
514
|
+
# onecell = cell(row,col,sheet)
|
515
|
+
# onecelltype = celltype(row,col,sheet)
|
516
|
+
# file.print one_cell_output(onecelltype,onecell,empty?(row,col,sheet))
|
517
|
+
# end
|
518
|
+
# file.print("\n")
|
519
|
+
# end # sheet not empty
|
520
|
+
# end
|
521
|
+
# end
|
522
|
+
|
523
|
+
# #TODO: refactor to Generic....
|
524
|
+
# def one_cell_output(onecelltype,onecell,empty)
|
525
|
+
# str = ""
|
526
|
+
# if empty
|
527
|
+
# str += ''
|
528
|
+
# else
|
529
|
+
# case onecelltype
|
530
|
+
# when :string
|
531
|
+
# if onecell == ""
|
532
|
+
# str << ''
|
533
|
+
# else
|
534
|
+
# onecell.gsub!(/"/,'""')
|
535
|
+
# str << ('"'+onecell+'"')
|
536
|
+
# end
|
537
|
+
# when :float,:percentage
|
538
|
+
# if onecell == onecell.to_i
|
539
|
+
# str << onecell.to_i.to_s
|
540
|
+
# else
|
541
|
+
# str << onecell.to_s
|
542
|
+
# end
|
543
|
+
# when :formula
|
544
|
+
# if onecell.class == String
|
545
|
+
# if onecell == ""
|
546
|
+
# str << ''
|
547
|
+
# else
|
548
|
+
# onecell.gsub!(/"/,'""')
|
549
|
+
# str << '"'+onecell+'"'
|
550
|
+
# end
|
551
|
+
# elsif onecell.class == Float
|
552
|
+
# if onecell == onecell.to_i
|
553
|
+
# str << onecell.to_i.to_s
|
554
|
+
# else
|
555
|
+
# str << onecell.to_s
|
556
|
+
# end
|
557
|
+
# else
|
558
|
+
# raise "unhandled onecell-class "+onecell.class.to_s
|
559
|
+
# end
|
560
|
+
# when :date
|
561
|
+
# str << '"'+onecell.to_s+'"'
|
562
|
+
# else
|
563
|
+
# raise "unhandled celltype "+onecelltype.to_s
|
564
|
+
# end
|
565
|
+
# end
|
566
|
+
# #cells << onecell
|
567
|
+
# str
|
568
|
+
# end
|
569
569
|
|
570
570
|
end # class
|
data/lib/roo/openoffice.rb
CHANGED
@@ -268,20 +268,20 @@ class Openoffice < GenericSpreadsheet
|
|
268
268
|
theformulas
|
269
269
|
end
|
270
270
|
|
271
|
-
# write the current spreadsheet to stdout or into a file
|
272
|
-
#TODO: refactoring --> GenericSpreadsheet
|
273
|
-
|
274
|
-
def to_csv(filename=nil,sheet=nil)
|
275
|
-
sheet = @default_sheet unless sheet
|
276
|
-
if filename
|
277
|
-
file = File.open(filename,"w") # do |file|
|
278
|
-
write_csv_content(file,sheet)
|
279
|
-
file.close
|
280
|
-
else
|
281
|
-
write_csv_content(STDOUT,sheet)
|
282
|
-
end
|
283
|
-
true
|
284
|
-
end
|
271
|
+
# # write the current spreadsheet to stdout or into a file
|
272
|
+
# #TODO: refactoring --> GenericSpreadsheet
|
273
|
+
#
|
274
|
+
# def to_csv(filename=nil,sheet=nil)
|
275
|
+
# sheet = @default_sheet unless sheet
|
276
|
+
# if filename
|
277
|
+
# file = File.open(filename,"w") # do |file|
|
278
|
+
# write_csv_content(file,sheet)
|
279
|
+
# file.close
|
280
|
+
# else
|
281
|
+
# write_csv_content(STDOUT,sheet)
|
282
|
+
# end
|
283
|
+
# true
|
284
|
+
# end
|
285
285
|
|
286
286
|
# find a row either by row number or a condition
|
287
287
|
# Caution: this works only within the default sheet -> set default_sheet before you call this method
|
@@ -558,71 +558,7 @@ class Openoffice < GenericSpreadsheet
|
|
558
558
|
def Openoffice.oo_type_2_roo_type(ootype)
|
559
559
|
return A_ROO_TYPE[ootype]
|
560
560
|
end
|
561
|
-
|
562
|
-
|
563
|
-
#TODO: refactoring to GenericSpreadsheet?
|
564
|
-
def write_csv_content(file=nil,sheet=nil)
|
565
|
-
file = STDOUT unless file
|
566
|
-
if first_row # sheet is not empty
|
567
|
-
first_row(sheet).upto(last_row(sheet)) do |row|
|
568
|
-
1.upto(last_column(sheet)) do |col|
|
569
|
-
file.print(",") if col > 1
|
570
|
-
onecell = cell(row,col,sheet)
|
571
|
-
onecelltype = celltype(row,col,sheet)
|
572
|
-
file.print one_cell_output(onecelltype,onecell,empty?(row,col,sheet))
|
573
|
-
end
|
574
|
-
file.print("\n")
|
575
|
-
end # sheet not empty
|
576
|
-
end
|
577
|
-
end
|
578
|
-
|
579
|
-
#TODO: refactor to Generic...
|
580
|
-
def one_cell_output(onecelltype,onecell,empty)
|
581
|
-
str = ""
|
582
|
-
if empty
|
583
|
-
str += ''
|
584
|
-
else
|
585
|
-
case onecelltype
|
586
|
-
when :string
|
587
|
-
if onecell == ""
|
588
|
-
str << ''
|
589
|
-
else
|
590
|
-
onecell.gsub!(/"/,'""')
|
591
|
-
str << ('"'+onecell+'"')
|
592
|
-
end
|
593
|
-
when :float,:percentage
|
594
|
-
if onecell == onecell.to_i
|
595
|
-
str << onecell.to_i.to_s
|
596
|
-
else
|
597
|
-
str << onecell.to_s
|
598
|
-
end
|
599
|
-
when :formula
|
600
|
-
if onecell.class == String
|
601
|
-
if onecell == ""
|
602
|
-
str << ''
|
603
|
-
else
|
604
|
-
onecell.gsub!(/"/,'""')
|
605
|
-
str << '"'+onecell+'"'
|
606
|
-
end
|
607
|
-
elsif onecell.class == Float
|
608
|
-
if onecell == onecell.to_i
|
609
|
-
str << onecell.to_i.to_s
|
610
|
-
else
|
611
|
-
str << onecell.to_s
|
612
|
-
end
|
613
|
-
else
|
614
|
-
raise "unhandled onecell-class "+onecell.class.to_s
|
615
|
-
end
|
616
|
-
when :date
|
617
|
-
str << '"'+onecell.to_s+'"'
|
618
|
-
else
|
619
|
-
raise "unhandled celltype "+onecelltype.to_s
|
620
|
-
end
|
621
|
-
end
|
622
|
-
#cells << onecell
|
623
|
-
str
|
624
|
-
end
|
625
|
-
|
561
|
+
|
626
562
|
# helper method to convert compressed spaces and other elements within
|
627
563
|
# an text into a string
|
628
564
|
def children_to_string(children)
|
data/lib/roo/version.rb
CHANGED
data/test/bbu.ods
CHANGED
Binary file
|
data/test/numbers1.csv
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
1,2,3,4,10,,
|
2
|
+
5,6,7,8,9,"test",11
|
3
|
+
,,,,,,
|
4
|
+
10,11,12,13,14,,
|
5
|
+
"1961-11-21",,,,,,
|
6
|
+
"tata",,,,,,
|
7
|
+
,,,,,,
|
8
|
+
,,"thisisc8",,,,
|
9
|
+
,,,"thisisd9",,,
|
10
|
+
,,,,,,
|
11
|
+
"thisisa11",,,,,,
|
12
|
+
41,42,43,44,45,,
|
13
|
+
,,,,,,
|
14
|
+
,,,,,,
|
15
|
+
41,42,43,44,45,,
|
16
|
+
"einundvierzig","zweiundvierzig","dreiundvierzig","vierundvierzig","fuenfundvierzig",,
|
17
|
+
,,,,,,
|
18
|
+
"2007-05-31","dies hier als Date-Objekt",,,,,
|
@@ -0,0 +1,18 @@
|
|
1
|
+
1,2,3,4,,,
|
2
|
+
5,6,7,8,9,"test",11
|
3
|
+
,,,,,,
|
4
|
+
10,11,12,13,14,,
|
5
|
+
"1961-11-21",,,,,,
|
6
|
+
"tata",,,,,,
|
7
|
+
,,,,,,
|
8
|
+
,,"thisisc8",,,,
|
9
|
+
,,,"thisisd9",,,
|
10
|
+
,,,,,,
|
11
|
+
"thisisa11",,,,,,
|
12
|
+
41,42,43,44,45,,
|
13
|
+
,,,,,,
|
14
|
+
,,,,,,
|
15
|
+
41,42,43,44,45,,
|
16
|
+
"einundvierzig","zweiundvierzig","dreiundvierzig","vierundvierzig","fuenfundvierzig",,
|
17
|
+
,,,,,,
|
18
|
+
"2007-05-31","dies hier als Date-Objekt",,,,,
|
data/test/test_roo.rb
CHANGED
@@ -26,7 +26,7 @@ if DB_LOG
|
|
26
26
|
# gem 'activerecord', '< 2.0.0'
|
27
27
|
# require 'activerecord'
|
28
28
|
# require_gem 'activerecord', '< 2.0.0'
|
29
|
-
gem 'activerecord', '< 2.0.0'
|
29
|
+
#gem 'activerecord', '< 2.0.0'
|
30
30
|
require 'activerecord'
|
31
31
|
end
|
32
32
|
|
@@ -60,23 +60,6 @@ class Test::Unit::TestCase
|
|
60
60
|
rescue
|
61
61
|
raise "unknown spreadsheetname: #{spreadsheetname}"
|
62
62
|
end
|
63
|
-
|
64
|
-
if false
|
65
|
-
case spreadsheetname
|
66
|
-
when 'numbers1'
|
67
|
-
return "o10837434939102457526.4784396906364855777"
|
68
|
-
when 'borders'
|
69
|
-
return "o10837434939102457526.664868920231926255"
|
70
|
-
when 'simple_spreadsheet'
|
71
|
-
return "o1087434939102457526.1774445811568867358"
|
72
|
-
when 'testnichtvorhandenBibelbund.ods'
|
73
|
-
return "invalidkeyforanyspreadsheet" # !!! intentionally false key
|
74
|
-
when "only_one_sheet"
|
75
|
-
return "o10837434939102457526.762705759906130135"
|
76
|
-
else
|
77
|
-
raise "unknown spreadsheetname: #{spreadsheetname}"
|
78
|
-
end
|
79
|
-
end # false
|
80
63
|
end
|
81
64
|
|
82
65
|
if DB_LOG
|
@@ -110,8 +93,8 @@ if false
|
|
110
93
|
#p t1
|
111
94
|
#p t2-t1
|
112
95
|
domain = Testrun.create(
|
113
|
-
:
|
114
|
-
:
|
96
|
+
:class_name => self.class.to_s,
|
97
|
+
:test_name => @method_name,
|
115
98
|
:start => t1,
|
116
99
|
:duration => t2-t1
|
117
100
|
)
|
@@ -119,6 +102,16 @@ if false
|
|
119
102
|
end
|
120
103
|
end
|
121
104
|
|
105
|
+
class File
|
106
|
+
|
107
|
+
def File.delete_if_exist(filename)
|
108
|
+
if File.exist?(filename)
|
109
|
+
File.delete(filename)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
122
115
|
class TestRoo < Test::Unit::TestCase
|
123
116
|
|
124
117
|
OPENOFFICE = true # do Openoffice-Spreadsheet Tests?
|
@@ -128,6 +121,7 @@ class TestRoo < Test::Unit::TestCase
|
|
128
121
|
OPENOFFICEWRITE = false # experimental: write access with OO-Documents
|
129
122
|
ONLINE = true
|
130
123
|
LONG_RUN = false
|
124
|
+
LONG_RUN_EXCEL = false
|
131
125
|
GLOBAL_TIMEOUT = 2*12*60 # seconds
|
132
126
|
|
133
127
|
|
@@ -1539,12 +1533,12 @@ end
|
|
1539
1533
|
end
|
1540
1534
|
end
|
1541
1535
|
|
1542
|
-
def
|
1536
|
+
def test_huge_document_to_csv_openoffice
|
1543
1537
|
if LONG_RUN
|
1544
1538
|
if OPENOFFICE
|
1545
1539
|
assert_nothing_raised(Timeout::Error) {
|
1546
1540
|
Timeout::timeout(GLOBAL_TIMEOUT) do |timeout_length|
|
1547
|
-
File.
|
1541
|
+
File.delete_if_exist("/tmp/Bibelbund.csv")
|
1548
1542
|
oo = Openoffice.new(File.join("test","Bibelbund.ods"))
|
1549
1543
|
oo.default_sheet = oo.sheets.first
|
1550
1544
|
assert_equal "Tagebuch des Sekret\303\244rs. Letzte Tagung 15./16.11.75 Schweiz", oo.cell(45,'A')
|
@@ -1559,8 +1553,8 @@ end
|
|
1559
1553
|
end
|
1560
1554
|
end
|
1561
1555
|
|
1562
|
-
def
|
1563
|
-
if
|
1556
|
+
def test_huge_document_to_csv_excel
|
1557
|
+
if LONG_RUN_EXCEL
|
1564
1558
|
if EXCEL
|
1565
1559
|
assert_nothing_raised(Timeout::Error) {
|
1566
1560
|
Timeout::timeout(GLOBAL_TIMEOUT) do |timeout_length|
|
@@ -1576,7 +1570,7 @@ end
|
|
1576
1570
|
end # LONG_RUN
|
1577
1571
|
end # def to_csv
|
1578
1572
|
|
1579
|
-
def
|
1573
|
+
def test_huge_document_to_csv_google
|
1580
1574
|
# maybe a better example... TODO:
|
1581
1575
|
after Date.new(2008,1,30) do
|
1582
1576
|
if GOOGLE
|
@@ -1596,6 +1590,60 @@ after Date.new(2008,1,30) do
|
|
1596
1590
|
end # GOOGLE
|
1597
1591
|
end # after
|
1598
1592
|
end
|
1593
|
+
|
1594
|
+
def test_to_csv_openoffice
|
1595
|
+
if OPENOFFICE
|
1596
|
+
#assert_nothing_raised(Timeout::Error) {
|
1597
|
+
Timeout::timeout(GLOBAL_TIMEOUT) do |timeout_length|
|
1598
|
+
File.delete_if_exist("/tmp/numbers1.csv")
|
1599
|
+
oo = Openoffice.new(File.join("test","numbers1.ods"))
|
1600
|
+
oo.default_sheet = oo.sheets.first
|
1601
|
+
#assert_equal "Tagebuch des Sekret\303\244rs. Letzte Tagung 15./16.11.75 Schweiz", oo.cell(45,'A')
|
1602
|
+
#assert_equal "Tagebuch des Sekret\303\244rs. Nachrichten aus Chile", oo.cell(46,'A')
|
1603
|
+
#assert_equal "Tagebuch aus Chile Juli 1977", oo.cell(55,'A')
|
1604
|
+
assert oo.to_csv("/tmp/numbers1.csv")
|
1605
|
+
assert File.exists?("/tmp/numbers1.csv")
|
1606
|
+
assert_equal "", `diff test/numbers1.csv /tmp/numbers1.csv`
|
1607
|
+
end # Timeout
|
1608
|
+
#} # nothing_raised
|
1609
|
+
end # OPENOFFICE
|
1610
|
+
end
|
1611
|
+
|
1612
|
+
def test_to_csv_excel
|
1613
|
+
if EXCEL
|
1614
|
+
#assert_nothing_raised(Timeout::Error) {
|
1615
|
+
Timeout::timeout(GLOBAL_TIMEOUT) do |timeout_length|
|
1616
|
+
File.delete_if_exist("/tmp/numbers1_excel.csv")
|
1617
|
+
oo = Excel.new(File.join("test","numbers1.xls"))
|
1618
|
+
oo.default_sheet = oo.sheets.first
|
1619
|
+
assert oo.to_csv("/tmp/numbers1_excel.csv")
|
1620
|
+
assert File.exists?("/tmp/numbers1_excel.csv")
|
1621
|
+
assert_equal "", `diff test/numbers1_excel.csv /tmp/numbers1_excel.csv`
|
1622
|
+
end
|
1623
|
+
#}
|
1624
|
+
end
|
1625
|
+
end # def to_csv
|
1626
|
+
|
1627
|
+
def test_to_csv_google
|
1628
|
+
# maybe a better example... TODO:
|
1629
|
+
after Date.new(2008,1,30) do
|
1630
|
+
if GOOGLE
|
1631
|
+
#assert_nothing_raised(Timeout::Error) {
|
1632
|
+
Timeout::timeout(GLOBAL_TIMEOUT) do |timeout_length|
|
1633
|
+
File.delete_if_exist("/tmp/numbers1.csv") if File.exists?("/tmp/numbers1.csv")
|
1634
|
+
oo = Google.new(key_of('numbers1'))
|
1635
|
+
oo.default_sheet = oo.sheets.first
|
1636
|
+
#?? assert_equal "Tagebuch des Sekret\303\244rs. Letzte Tagung 15./16.11.75 Schweiz", oo.cell(45,'A')
|
1637
|
+
#?? assert_equal "Tagebuch des Sekret\303\244rs. Nachrichten aus Chile", oo.cell(46,'A')
|
1638
|
+
#?? assert_equal "Tagebuch aus Chile Juli 1977", oo.cell(55,'A')
|
1639
|
+
assert oo.to_csv("/tmp/numbers1.csv")
|
1640
|
+
assert File.exists?("/tmp/numbers1.csv")
|
1641
|
+
assert_equal "", `diff test/numbers1.csv /tmp/numbers1.csv`
|
1642
|
+
end # Timeout
|
1643
|
+
#} # nothing_raised
|
1644
|
+
end # GOOGLE
|
1645
|
+
end # after
|
1646
|
+
end
|
1599
1647
|
|
1600
1648
|
def test_bug_mehrere_datum
|
1601
1649
|
if OPENOFFICE
|
@@ -2152,12 +2200,10 @@ end # after
|
|
2152
2200
|
if OPENOFFICE
|
2153
2201
|
assert_nothing_raised(Timeout::Error) {
|
2154
2202
|
Timeout::timeout(GLOBAL_TIMEOUT) do |timeout_length|
|
2155
|
-
#puts Time.now.to_s + "column Openoffice gestartet"
|
2156
2203
|
oo = Openoffice.new(File.join('test','Bibelbund.ods'))
|
2157
2204
|
oo.default_sheet = oo.sheets.first
|
2158
|
-
|
2159
|
-
assert_equal 499, oo.column('a').size
|
2160
|
-
#puts Time.now.to_s + "column Openoffice beendet"
|
2205
|
+
assert_equal 3735, oo.column('a').size
|
2206
|
+
#assert_equal 499, oo.column('a').size
|
2161
2207
|
end
|
2162
2208
|
}
|
2163
2209
|
end
|
@@ -2183,7 +2229,7 @@ end # after
|
|
2183
2229
|
|
2184
2230
|
def test_column_huge_document_google
|
2185
2231
|
if LONG_RUN
|
2186
|
-
if
|
2232
|
+
if GOOGLE
|
2187
2233
|
assert_nothing_raised(Timeout::Error) {
|
2188
2234
|
Timeout::timeout(GLOBAL_TIMEOUT) do |timeout_length|
|
2189
2235
|
#puts Time.now.to_s + "column Openoffice gestartet"
|
@@ -2296,7 +2342,7 @@ end
|
|
2296
2342
|
end
|
2297
2343
|
|
2298
2344
|
def test_info
|
2299
|
-
expected_templ = "File:
|
2345
|
+
expected_templ = "File: numbers1%s\n"+
|
2300
2346
|
"Number of sheets: 5\n"+
|
2301
2347
|
"Sheets: Tabelle1, Name of Sheet 2, Sheet3, Sheet4, Sheet5\n"+
|
2302
2348
|
"Sheet 1:\n"+
|
@@ -2341,8 +2387,7 @@ end
|
|
2341
2387
|
expected = sprintf(expected_templ,ext)
|
2342
2388
|
oo = Google.new(key_of("numbers1"))
|
2343
2389
|
#$log.debug(expected)
|
2344
|
-
|
2345
|
-
assert_equal expected.gsub(/test\/numbers1/,key_of("numbers1")), oo.info
|
2390
|
+
assert_equal expected.gsub(/numbers1/,key_of("numbers1")), oo.info
|
2346
2391
|
end
|
2347
2392
|
end
|
2348
2393
|
|
@@ -2421,7 +2466,7 @@ end
|
|
2421
2466
|
def test_bug_bbu_openoffice
|
2422
2467
|
oo = Openoffice.new(File.join('test','bbu.ods'))
|
2423
2468
|
assert_nothing_raised() {
|
2424
|
-
assert_equal "File:
|
2469
|
+
assert_equal "File: bbu.ods
|
2425
2470
|
Number of sheets: 3
|
2426
2471
|
Sheets: 2007_12, Tabelle2, Tabelle3
|
2427
2472
|
Sheet 1:
|
@@ -2445,7 +2490,7 @@ Sheet 3:
|
|
2445
2490
|
def test_bug_bbu_excel
|
2446
2491
|
oo = Excel.new(File.join('test','bbu.xls'))
|
2447
2492
|
assert_nothing_raised() {
|
2448
|
-
assert_equal "File:
|
2493
|
+
assert_equal "File: bbu.xls
|
2449
2494
|
Number of sheets: 3
|
2450
2495
|
Sheets: 2007_12, Tabelle2, Tabelle3
|
2451
2496
|
Sheet 1:
|
@@ -2493,4 +2538,11 @@ Sheet 3:
|
|
2493
2538
|
end
|
2494
2539
|
end # false
|
2495
2540
|
|
2541
|
+
# def teardown
|
2542
|
+
# puts "Options:"
|
2543
|
+
# puts "OPENOFFICE = #{OPENOFFICE}"
|
2544
|
+
# puts "EXCEL = #{EXCEL}"
|
2545
|
+
# puts "GOOGLE = #{GOOGLE}"
|
2546
|
+
# end
|
2547
|
+
|
2496
2548
|
end # class
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>roo</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/roo"; return false'>
|
35
35
|
Get Version
|
36
|
-
<a href="http://rubyforge.org/projects/roo" class="numbers">0.8.
|
36
|
+
<a href="http://rubyforge.org/projects/roo" class="numbers">0.8.2</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Preymesser
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2007-12-
|
12
|
+
date: 2007-12-28 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -87,6 +87,8 @@ files:
|
|
87
87
|
- test/simple_spreadsheet_from_italo.xls
|
88
88
|
- test/test_helper.rb
|
89
89
|
- test/test_roo.rb
|
90
|
+
- test/numbers1.csv
|
91
|
+
- test/numbers1_excel.csv
|
90
92
|
- test/numbers1.ods
|
91
93
|
- test/numbers1.xls
|
92
94
|
- test/borders.ods
|