hmcgowan-roo 1.3.1 → 1.3.2
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/README.markdown +1 -4
- data/lib/roo/google.rb +106 -83
- data/lib/roo/roo_rails_helper.rb +1 -0
- data/lib/roo/version.rb +1 -1
- data/test/test_roo.rb +47 -40
- metadata +4 -4
data/README.markdown
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# README for Roo
|
2
2
|
|
3
|
-
This is the
|
4
|
-
repository should allow us to continue in the interim. If you'd like to contribute I'm happy
|
5
|
-
to pull your changes in and will be making periodic releases from here until we can get
|
6
|
-
the gems on RubyForge.
|
3
|
+
This is now the official roo repository and I'll be making a release on RubyForge in the next few weeks.
|
7
4
|
|
8
5
|
|
9
6
|
## Installation
|
data/lib/roo/google.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'gdata/spreadsheet'
|
2
|
+
gem 'libxml-ruby', '>= 0.8.3'
|
3
|
+
require 'xml'
|
2
4
|
|
3
5
|
# overwrite some methods from the gdata-gem:
|
4
6
|
module GData
|
@@ -45,7 +47,7 @@ XML
|
|
45
47
|
def add_to_cell_roo(row,col,value, sheet_no=1)
|
46
48
|
save_entry_roo(entry_roo(value,row,col), sheet_no)
|
47
49
|
end
|
48
|
-
|
50
|
+
|
49
51
|
#-- new
|
50
52
|
def get_one_sheet
|
51
53
|
path = "/feeds/cells/#{@spreadsheet_id}/1/private/full"
|
@@ -70,11 +72,19 @@ XML
|
|
70
72
|
doc = Hpricot(request(path))
|
71
73
|
return doc
|
72
74
|
end
|
75
|
+
|
76
|
+
def celldoc(sheet_no, cell_name)
|
77
|
+
path = "/feeds/cells/#{@spreadsheet_id}/#{sheet_no}/private/full" + cell_name
|
78
|
+
doc = Hpricot(request(path))
|
79
|
+
return doc
|
80
|
+
end
|
81
|
+
|
73
82
|
end # class
|
74
83
|
end # module
|
75
84
|
|
76
85
|
class Google < GenericSpreadsheet
|
77
|
-
|
86
|
+
attr_accessor :date_format, :datetime_format
|
87
|
+
|
78
88
|
# Creates a new Google spreadsheet object.
|
79
89
|
def initialize(spreadsheetkey,user=nil,password=nil)
|
80
90
|
@filename = spreadsheetkey
|
@@ -89,6 +99,7 @@ class Google < GenericSpreadsheet
|
|
89
99
|
end
|
90
100
|
@default_sheet = nil
|
91
101
|
@cell = Hash.new
|
102
|
+
@cell_name = Hash.new
|
92
103
|
@cell_type = Hash.new
|
93
104
|
@formula = Hash.new
|
94
105
|
@first_row = Hash.new
|
@@ -97,10 +108,11 @@ class Google < GenericSpreadsheet
|
|
97
108
|
@last_column = Hash.new
|
98
109
|
@cells_read = Hash.new
|
99
110
|
@header_line = 1
|
100
|
-
|
111
|
+
@date_format = '%d/%m/%Y'
|
112
|
+
@datetime_format = '%d/%m/%Y %H:%M:%S'
|
113
|
+
@time_format = '%H:%M:%S'
|
101
114
|
@gs = GData::Spreadsheet.new(spreadsheetkey)
|
102
115
|
@gs.authenticate(user, password)
|
103
|
-
|
104
116
|
#-- ----------------------------------------------------------------------
|
105
117
|
#-- TODO: Behandlung von Berechtigungen hier noch einbauen ???
|
106
118
|
#-- ----------------------------------------------------------------------
|
@@ -115,29 +127,41 @@ class Google < GenericSpreadsheet
|
|
115
127
|
return @gs.sheetlist
|
116
128
|
end
|
117
129
|
|
118
|
-
|
119
|
-
def Google.date?(string)
|
130
|
+
def date?(string)
|
120
131
|
return false if string.class == Float
|
121
132
|
return true if string.class == Date
|
122
|
-
|
133
|
+
begin
|
134
|
+
Date.strptime(string, @date_format)
|
135
|
+
true
|
136
|
+
rescue
|
137
|
+
false
|
138
|
+
end
|
123
139
|
end
|
124
140
|
|
125
141
|
# is String a time with format HH:MM:SS?
|
126
|
-
def
|
142
|
+
def time?(string)
|
127
143
|
return false if string.class == Float
|
128
144
|
return true if string.class == Date
|
129
|
-
|
145
|
+
begin
|
146
|
+
DateTime.strptime(string, @time_format)
|
147
|
+
true
|
148
|
+
rescue
|
149
|
+
false
|
150
|
+
end
|
130
151
|
end
|
131
152
|
|
132
|
-
|
133
|
-
def Google.datetime?(string)
|
153
|
+
def datetime?(string)
|
134
154
|
return false if string.class == Float
|
135
155
|
return true if string.class == Date
|
136
|
-
|
156
|
+
begin
|
157
|
+
DateTime.strptime(string, @datetime_format)
|
158
|
+
true
|
159
|
+
rescue
|
160
|
+
false
|
161
|
+
end
|
137
162
|
end
|
138
163
|
|
139
|
-
|
140
|
-
def Google.timestring_to_seconds(value)
|
164
|
+
def timestring_to_seconds(value)
|
141
165
|
hms = value.split(':')
|
142
166
|
hms[0].to_i*3600 + hms[1].to_i*60 + hms[2].to_i
|
143
167
|
end
|
@@ -151,24 +175,21 @@ class Google < GenericSpreadsheet
|
|
151
175
|
check_default_sheet #TODO: 2007-12-16
|
152
176
|
read_cells(sheet) unless @cells_read[sheet]
|
153
177
|
row,col = normalize(row,col)
|
178
|
+
value = @cell[sheet]["#{row},#{col}"]
|
154
179
|
if celltype(row,col,sheet) == :date
|
155
|
-
yyyy,mm,dd = @cell[sheet]["#{row},#{col}"].split('-')
|
156
180
|
begin
|
157
|
-
return
|
181
|
+
return Date.strptime(value, @date_format)
|
158
182
|
rescue ArgumentError
|
159
|
-
raise "Invalid
|
183
|
+
raise "Invalid Date #{sheet}[#{row},#{col}] #{value} using format '{@date_format}'"
|
160
184
|
end
|
161
185
|
elsif celltype(row,col,sheet) == :datetime
|
162
186
|
begin
|
163
|
-
|
164
|
-
yyyy,mm,dd = date_part.split('-')
|
165
|
-
hh,mi,ss = time_part.split(':')
|
166
|
-
return DateTime.civil(yyyy.to_i,mm.to_i,dd.to_i,hh.to_i,mi.to_i,ss.to_i)
|
187
|
+
return DateTime.strptime(value, @datetime_format)
|
167
188
|
rescue ArgumentError
|
168
|
-
raise "Invalid
|
189
|
+
raise "Invalid DateTime #{sheet}[#{row},#{col}] #{value} using format '{@datetime_format}'"
|
169
190
|
end
|
170
191
|
end
|
171
|
-
return
|
192
|
+
return value
|
172
193
|
end
|
173
194
|
|
174
195
|
# returns the type of a cell:
|
@@ -291,8 +312,13 @@ class Google < GenericSpreadsheet
|
|
291
312
|
end
|
292
313
|
row,col = normalize(row,col)
|
293
314
|
@gs.add_to_cell_roo(row,col,value,sheet_no)
|
315
|
+
# re-read the portion of the document that has changed
|
316
|
+
if @cells_read[sheet]
|
317
|
+
cell_name = @cell_name[sheet]["#{row},#{col}"]
|
318
|
+
read_cells(sheet, cell_name)
|
319
|
+
end
|
294
320
|
end
|
295
|
-
|
321
|
+
|
296
322
|
# returns the first non-empty row in a sheet
|
297
323
|
def first_row(sheet=nil)
|
298
324
|
sheet = @default_sheet unless sheet
|
@@ -335,61 +361,67 @@ class Google < GenericSpreadsheet
|
|
335
361
|
|
336
362
|
private
|
337
363
|
|
338
|
-
# read all cells in a sheet
|
339
|
-
|
364
|
+
# read all cells in a sheet. if the cell_name is
|
365
|
+
# specified, only return the XML pertaining to that cell
|
366
|
+
def read_cells(sheet=nil, cell_name=nil)
|
340
367
|
sheet = @default_sheet unless sheet
|
341
368
|
raise RangeError, "illegal sheet <#{sheet}>" unless sheets.index(sheet)
|
342
369
|
sheet_no = sheets.index(sheet)+1
|
343
|
-
|
344
|
-
(
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
370
|
+
@cell_name[sheet] ||= {}
|
371
|
+
xml = cell_name ? @gs.celldoc(sheet_no, cell_name).to_s : @gs.fulldoc(sheet_no).to_s
|
372
|
+
doc = XML::Parser.string(xml).parse
|
373
|
+
doc.find("//*[local-name()='entry']").each do |entry|
|
374
|
+
key = nil;
|
375
|
+
cell_name = nil;
|
376
|
+
entry.each do |element|
|
377
|
+
next unless element.name == 'category'
|
378
|
+
cell_name = nil
|
379
|
+
element.each do |item|
|
380
|
+
case item.name
|
381
|
+
when 'link'
|
382
|
+
cell_name = item['href'][/\/R\d+C\d+/] if item['rel'] == 'self'
|
383
|
+
when 'cell'
|
384
|
+
row = item['row']
|
385
|
+
col = item['col']
|
386
|
+
value = item['inputvalue'] || item['inputValue']
|
387
|
+
numericvalue = item['numericvalue'] || item['numericValue']
|
388
|
+
if value[0,1] == '='
|
389
|
+
formula = value
|
390
|
+
else
|
391
|
+
formula = nil
|
392
|
+
end
|
393
|
+
@cell_type[sheet] ||= {}
|
394
|
+
if formula
|
395
|
+
ty = :formula
|
396
|
+
if numeric?(numericvalue)
|
397
|
+
value = numericvalue.to_f
|
398
|
+
else
|
399
|
+
value = numericvalue
|
400
|
+
end
|
401
|
+
elsif datetime?(value)
|
402
|
+
ty = :datetime
|
403
|
+
elsif date?(value)
|
404
|
+
ty = :date
|
405
|
+
elsif numeric?(value) # or o.class ???
|
406
|
+
ty = :float
|
407
|
+
value = value.to_f
|
408
|
+
elsif time?(value)
|
409
|
+
ty = :time
|
410
|
+
value = timestring_to_seconds(value)
|
411
|
+
else
|
412
|
+
ty = :string
|
413
|
+
end
|
414
|
+
key = "#{row},#{col}"
|
415
|
+
@cell[sheet] ||= {}
|
416
|
+
@cell[sheet][key] = value unless value == "" or value == nil
|
417
|
+
@cell_type[sheet][key] = ty # Openoffice.oo_type_2_roo_type(vt)
|
418
|
+
end
|
419
|
+
@formula[sheet] = {} unless @formula[sheet]
|
420
|
+
@formula[sheet][key] = formula if formula
|
361
421
|
end
|
362
|
-
elsif Google.date?(value)
|
363
|
-
ty = :date
|
364
|
-
elsif Google.datetime?(value)
|
365
|
-
ty = :datetime
|
366
|
-
elsif numeric?(value) # or o.class ???
|
367
|
-
ty = :float
|
368
|
-
value = value.to_f
|
369
|
-
elsif Google.time?(value)
|
370
|
-
ty = :time
|
371
|
-
value = Google.timestring_to_seconds(value)
|
372
|
-
else
|
373
|
-
ty = :string
|
374
|
-
end
|
375
|
-
key = "#{row},#{col}"
|
376
|
-
@cell[sheet] = {} unless @cell[sheet]
|
377
|
-
if ty == :date
|
378
|
-
dd,mm,yyyy = value.split('/')
|
379
|
-
@cell[sheet][key] = sprintf("%04d-%02d-%02d",yyyy.to_i,mm.to_i,dd.to_i)
|
380
|
-
elsif ty == :datetime
|
381
|
-
date_part,time_part = value.split(' ')
|
382
|
-
dd,mm,yyyy = date_part.split('/')
|
383
|
-
hh,mi,ss = time_part.split(':')
|
384
|
-
@cell[sheet][key] = sprintf("%04d-%02d-%02d %02d:%02d:%02d",
|
385
|
-
yyyy.to_i,mm.to_i,dd.to_i,hh.to_i,mi.to_i,ss.to_i)
|
386
|
-
else
|
387
|
-
@cell[sheet][key] = value unless value == "" or value == nil
|
388
422
|
end
|
389
|
-
@
|
390
|
-
|
391
|
-
@formula[sheet][key] = formula if formula
|
392
|
-
}
|
423
|
+
@cell_name[sheet][key] = cell_name if cell_name && key
|
424
|
+
end
|
393
425
|
@cells_read[sheet] = true
|
394
426
|
end
|
395
427
|
|
@@ -397,15 +429,6 @@ class Google < GenericSpreadsheet
|
|
397
429
|
string =~ /^[0-9]+[\.]*[0-9]*$/
|
398
430
|
end
|
399
431
|
|
400
|
-
# convert string DD/MM/YYYY into a Date-object
|
401
|
-
#TODO: was ist mit verschiedenen Typen der Datumseingabe bei Google?
|
402
|
-
def Google.to_date(string)
|
403
|
-
if string.strip =~ /^([0-9]+)\/([0-9]+)\/([0-9]+)$/
|
404
|
-
return Date.new($3.to_i,$2.to_i,$1.to_i)
|
405
|
-
else
|
406
|
-
return nil
|
407
|
-
end
|
408
|
-
end
|
409
432
|
|
410
433
|
|
411
434
|
end # class
|
data/lib/roo/roo_rails_helper.rb
CHANGED
data/lib/roo/version.rb
CHANGED
data/test/test_roo.rb
CHANGED
@@ -44,17 +44,27 @@ end
|
|
44
44
|
class Test::Unit::TestCase
|
45
45
|
def key_of(spreadsheetname)
|
46
46
|
begin
|
47
|
+
|
47
48
|
return {
|
48
|
-
'
|
49
|
-
|
50
|
-
'
|
49
|
+
'formula' => 'rt4Pw1WmjxFtyfrqqy94wPw',
|
50
|
+
"write.me" => 'r6m7HFlUOwst0RTUTuhQ0Ow',
|
51
|
+
'numbers1' => "rYraCzjxTtkxw1NxHJgDU8Q",
|
52
|
+
'borders' => "r_nLYMft6uWg_PT9Rc2urXw",
|
53
|
+
'simple_spreadsheet' => "r3aMMCBCA153TmU_wyIaxfw",
|
51
54
|
'testnichtvorhandenBibelbund.ods' => "invalidkeyforanyspreadsheet", # !!! intentionally false key
|
52
|
-
"only_one_sheet" => "
|
53
|
-
|
54
|
-
'
|
55
|
-
'time-test' => 'ptu6bbahNZpYBMhk01UfXSg',
|
56
|
-
'datetime' => "ptu6bbahNZpYQEtZwzL_dZQ",
|
55
|
+
"only_one_sheet" => "rqRtkcPJ97nhQ0m9ksDw2rA",
|
56
|
+
'time-test' => 'r2XfDBJMrLPjmuLrPQQrEYw',
|
57
|
+
'datetime' => "r2kQpXWr6xOSUpw9MyXavYg",
|
57
58
|
}[spreadsheetname]
|
59
|
+
# 'numbers1' => "o10837434939102457526.4784396906364855777",
|
60
|
+
# 'borders' => "o10837434939102457526.664868920231926255",
|
61
|
+
# 'simple_spreadsheet' => "ptu6bbahNZpYe-L1vEBmgGA",
|
62
|
+
# 'testnichtvorhandenBibelbund.ods' => "invalidkeyforanyspreadsheet", # !!! intentionally false key
|
63
|
+
# "only_one_sheet" => "o10837434939102457526.762705759906130135",
|
64
|
+
# "write.me" => 'ptu6bbahNZpY0N0RrxQbWdw&hl',
|
65
|
+
# 'formula' => 'o10837434939102457526.3022866619437760118',
|
66
|
+
# 'time-test' => 'ptu6bbahNZpYBMhk01UfXSg',
|
67
|
+
# 'datetime' => "ptu6bbahNZpYQEtZwzL_dZQ",
|
58
68
|
rescue
|
59
69
|
raise "unknown spreadsheetname: #{spreadsheetname}"
|
60
70
|
end
|
@@ -129,18 +139,21 @@ class TestRoo < Test::Unit::TestCase
|
|
129
139
|
assert_equal 42*60, 42.minutes
|
130
140
|
end
|
131
141
|
|
142
|
+
# Using Date.strptime so check that it's using the method
|
143
|
+
# with the value set in date_format
|
132
144
|
def test_date
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
145
|
+
if GOOGLE
|
146
|
+
oo = Google.new(key_of("numbers1"))
|
147
|
+
# should default to DDMMYYYY
|
148
|
+
assert oo.date?("21/11/1962") == true
|
149
|
+
assert oo.date?("11/21/1962") == false
|
150
|
+
oo.date_format = '%m/%d/%Y'
|
151
|
+
assert oo.date?("21/11/1962") == false
|
152
|
+
assert oo.date?("11/21/1962") == true
|
153
|
+
oo.date_format = '%Y-%m-%d'
|
154
|
+
assert oo.date?("1962-11-21") == true
|
155
|
+
assert oo.date?("1962-21-11") == false
|
156
|
+
end
|
144
157
|
end
|
145
158
|
|
146
159
|
def test_classes
|
@@ -439,25 +452,19 @@ class TestRoo < Test::Unit::TestCase
|
|
439
452
|
assert_equal 8, oo.cell(2,4)
|
440
453
|
assert_equal 9, oo.cell(2,5)
|
441
454
|
assert_equal "test", oo.cell(2,6)
|
442
|
-
# assert_equal "string", oo.celltype(2,6)
|
443
455
|
assert_equal :string, oo.celltype(2,6)
|
444
456
|
assert_equal 11, oo.cell(2,7)
|
445
|
-
# assert_equal "float", oo.celltype(2,7)
|
446
457
|
assert_equal :float, oo.celltype(2,7), "Inhalt: --#{oo.cell(2,7)}--"
|
447
|
-
|
448
458
|
assert_equal 10, oo.cell(4,1)
|
449
459
|
assert_equal 11, oo.cell(4,2)
|
450
460
|
assert_equal 12, oo.cell(4,3)
|
451
461
|
assert_equal 13, oo.cell(4,4)
|
452
462
|
assert_equal 14, oo.cell(4,5)
|
453
|
-
|
454
463
|
assert_equal 10, oo.cell(4,'A')
|
455
464
|
assert_equal 11, oo.cell(4,'B')
|
456
465
|
assert_equal 12, oo.cell(4,'C')
|
457
466
|
assert_equal 13, oo.cell(4,'D')
|
458
467
|
assert_equal 14, oo.cell(4,'E')
|
459
|
-
|
460
|
-
# assert_equal "date", oo.celltype(5,1)
|
461
468
|
assert_equal :date, oo.celltype(5,1)
|
462
469
|
assert_equal Date.new(1961,11,21), oo.cell(5,1)
|
463
470
|
assert_equal "1961-11-21", oo.cell(5,1).to_s
|
@@ -1974,7 +1981,7 @@ class TestRoo < Test::Unit::TestCase
|
|
1974
1981
|
end
|
1975
1982
|
end
|
1976
1983
|
|
1977
|
-
def
|
1984
|
+
def test_excel_zipped
|
1978
1985
|
after Date.new(2009,1,10) do
|
1979
1986
|
if EXCEL
|
1980
1987
|
$log.level = Logger::DEBUG
|
@@ -2259,12 +2266,12 @@ class TestRoo < Test::Unit::TestCase
|
|
2259
2266
|
oo.default_sheet = oo.sheets.first
|
2260
2267
|
assert oo.to_csv("/tmp/numbers1.csv")
|
2261
2268
|
assert File.exists?("/tmp/numbers1.csv")
|
2262
|
-
assert_equal "", `diff
|
2269
|
+
assert_equal "", `diff #{File.join(TESTDIR,"numbers1.csv")} /tmp/numbers1.csv`
|
2263
2270
|
|
2264
2271
|
# bug?, 2008-01-15 from Troy Davis
|
2265
2272
|
assert oo.to_csv("/tmp/numbers1.csv",oo.sheets.first)
|
2266
2273
|
assert File.exists?("/tmp/numbers1.csv")
|
2267
|
-
assert_equal "", `diff
|
2274
|
+
assert_equal "", `diff #{File.join(TESTDIR,"numbers1.csv")} /tmp/numbers1.csv`
|
2268
2275
|
|
2269
2276
|
end # Timeout
|
2270
2277
|
#} # nothing_raised
|
@@ -3222,6 +3229,7 @@ class TestRoo < Test::Unit::TestCase
|
|
3222
3229
|
oo = Google.new(key_of("simple_spreadsheet"))
|
3223
3230
|
oo.default_sheet = oo.sheets.first
|
3224
3231
|
oo.header_line = 3
|
3232
|
+
oo.date_format = '%m/%d/%Y'
|
3225
3233
|
erg = oo.find(:all, :conditions => {'Comment' => 'Task 1'})
|
3226
3234
|
assert_equal Date.new(2007,05,07), erg[1]['Date']
|
3227
3235
|
assert_equal 10.75 , erg[1]['Start time']
|
@@ -3417,12 +3425,10 @@ class TestRoo < Test::Unit::TestCase
|
|
3417
3425
|
}
|
3418
3426
|
end
|
3419
3427
|
if GOOGLE
|
3420
|
-
|
3421
|
-
|
3422
|
-
|
3423
|
-
|
3424
|
-
}
|
3425
|
-
end
|
3428
|
+
# assert_raise(Net::HTTPServerException) {
|
3429
|
+
# oo = Google.new(key_of('testnichtvorhanden'+'Bibelbund.ods'))
|
3430
|
+
# oo = Google.new('testnichtvorhanden')
|
3431
|
+
# }
|
3426
3432
|
end
|
3427
3433
|
end
|
3428
3434
|
|
@@ -3441,11 +3447,12 @@ class TestRoo < Test::Unit::TestCase
|
|
3441
3447
|
def test_write_google
|
3442
3448
|
# write.me: http://spreadsheets.google.com/ccc?key=ptu6bbahNZpY0N0RrxQbWdw&hl=en_GB
|
3443
3449
|
if GOOGLE
|
3444
|
-
oo = Google.new('
|
3450
|
+
oo = Google.new(key_of('write.me'))
|
3445
3451
|
oo.default_sheet = oo.sheets.first
|
3446
3452
|
oo.set_value(1,1,"hello from the tests")
|
3447
|
-
#oo.set_value(1,1,"sin(1)")
|
3448
3453
|
assert_equal "hello from the tests", oo.cell(1,1)
|
3454
|
+
oo.set_value(1,1, 1.0)
|
3455
|
+
assert_equal 1.0, oo.cell(1,1)
|
3449
3456
|
end
|
3450
3457
|
end
|
3451
3458
|
|
@@ -3454,7 +3461,7 @@ class TestRoo < Test::Unit::TestCase
|
|
3454
3461
|
if GOOGLE
|
3455
3462
|
content1 = 'AAA'
|
3456
3463
|
content2 = 'BBB'
|
3457
|
-
oo = Google.new('
|
3464
|
+
oo = Google.new(key_of('write.me'))
|
3458
3465
|
oo.default_sheet = oo.sheets.first
|
3459
3466
|
oo.set_value(1,1,content1)
|
3460
3467
|
oo.default_sheet = oo.sheets[1]
|
@@ -3470,7 +3477,7 @@ class TestRoo < Test::Unit::TestCase
|
|
3470
3477
|
if GOOGLE
|
3471
3478
|
random_row = rand(10)+1
|
3472
3479
|
random_column = rand(10)+1
|
3473
|
-
oo = Google.new('
|
3480
|
+
oo = Google.new(key_of('write.me'))
|
3474
3481
|
oo.default_sheet = oo.sheets.first
|
3475
3482
|
content1 = 'ABC'
|
3476
3483
|
content2 = 'DEF'
|
@@ -3697,7 +3704,7 @@ Sheet 3:
|
|
3697
3704
|
oo.default_sheet = oo.sheets.first
|
3698
3705
|
assert oo.to_csv("/tmp/time-test.csv")
|
3699
3706
|
assert File.exists?("/tmp/time-test.csv")
|
3700
|
-
assert_equal "", `diff
|
3707
|
+
assert_equal "", `diff #{File.join(TESTDIR,"time-test.csv")} /tmp/time-test.csv`
|
3701
3708
|
end # GOOGLE
|
3702
3709
|
end
|
3703
3710
|
|
@@ -4632,7 +4639,7 @@ This attached file is the newer format of Microsoft Excel (.xlsx).
|
|
4632
4639
|
end
|
4633
4640
|
|
4634
4641
|
def do_datetime_tests(oo)
|
4635
|
-
|
4642
|
+
val = oo.cell('c',3)
|
4636
4643
|
assert_kind_of DateTime, val
|
4637
4644
|
assert_equal :datetime, oo.celltype('c',3)
|
4638
4645
|
assert_equal DateTime.new(1961,11,21,12,17,18), val
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hmcgowan-roo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hugh McGowan
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-05-25 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -129,7 +129,7 @@ files:
|
|
129
129
|
- test/time-test.xlsx
|
130
130
|
- README.markdown
|
131
131
|
- History.txt
|
132
|
-
has_rdoc:
|
132
|
+
has_rdoc: false
|
133
133
|
homepage: http://roo.rubyforge.org
|
134
134
|
post_install_message:
|
135
135
|
rdoc_options:
|
@@ -156,7 +156,7 @@ requirements: []
|
|
156
156
|
rubyforge_project: roo
|
157
157
|
rubygems_version: 1.2.0
|
158
158
|
signing_key:
|
159
|
-
specification_version:
|
159
|
+
specification_version: 3
|
160
160
|
summary: roo
|
161
161
|
test_files: []
|
162
162
|
|