simple-spreadsheet-extractor 0.7.0 → 0.7.1
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.rdoc +1 -1
- data/VERSION +1 -1
- data/jars/simple-spreadsheet-extractor-0.7.1.jar +0 -0
- data/lib/simple-spreadsheet-extractor.rb +1 -1
- data/simple-spreadsheet-extractor.gemspec +12 -9
- metadata +7 -10
- data/jars/simple-spreadsheet-extractor-0.7-SNAPSHOT.jar +0 -0
- data/jars/simple-spreadsheet-extractor-0.7.jar +0 -0
- data/test/test_extraction.rb +0 -78
data/README.rdoc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
= Simple Spreadsheet Extractor
|
|
2
2
|
|
|
3
3
|
Authors:: Stuart Owen, Finn Bacall
|
|
4
|
-
Version:: 0.7.
|
|
4
|
+
Version:: 0.7.1
|
|
5
5
|
Contact:: mailto:stuart.owen@manchester.ac.uk
|
|
6
6
|
Licence:: BSD (See LICENCE or http://www.opensource.org/licenses/bsd-license.php)
|
|
7
7
|
Copyright:: (c) 2010 The University of Manchester, UK
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.7.
|
|
1
|
+
0.7.1
|
|
Binary file
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{simple-spreadsheet-extractor}
|
|
8
|
-
s.version = "0.
|
|
8
|
+
s.version = "0.7.1"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Stuart Owen", "Finn Bacall"]
|
|
12
|
-
s.date = %q{2011-
|
|
12
|
+
s.date = %q{2011-11-28}
|
|
13
13
|
s.description = %q{Takes a stream to a spreadsheet file and produces an XML or CSV representation of its contents}
|
|
14
14
|
s.email = %q{stuart.owen@manchester.ac.uk}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -23,21 +23,24 @@ Gem::Specification.new do |s|
|
|
|
23
23
|
"doc/schema-v1.xsd",
|
|
24
24
|
"examples/example.rb",
|
|
25
25
|
"jars/lib/dom4j-1.6.1.jar",
|
|
26
|
-
"jars/lib/poi-3.
|
|
27
|
-
"jars/lib/poi-ooxml-3.
|
|
28
|
-
"jars/lib/poi-
|
|
26
|
+
"jars/lib/poi-ooxml-3.8-beta4.jar",
|
|
27
|
+
"jars/lib/poi-ooxml-schemas-3.8-beta4.jar",
|
|
28
|
+
"jars/lib/poi-rightfield-3.8-beta4.jar",
|
|
29
29
|
"jars/lib/xmlbeans-2.3.0.jar",
|
|
30
|
-
"jars/simple-spreadsheet-extractor-0.
|
|
30
|
+
"jars/simple-spreadsheet-extractor-0.7.1.jar",
|
|
31
31
|
"lib/simple-spreadsheet-extractor.rb",
|
|
32
|
-
"simple-spreadsheet-extractor.gemspec"
|
|
32
|
+
"simple-spreadsheet-extractor.gemspec",
|
|
33
|
+
"test/files/not-a-spreadsheet.xls",
|
|
34
|
+
"test/files/test-csv-output1-trimmed.csv",
|
|
35
|
+
"test/files/test-csv-output1.csv",
|
|
36
|
+
"test/files/test-spreadsheet.xls"
|
|
33
37
|
]
|
|
34
38
|
s.homepage = %q{http://github.com/myGrid/simple-spreadsheet-extractor-gem}
|
|
35
39
|
s.require_paths = ["lib"]
|
|
36
|
-
s.rubygems_version = %q{1.
|
|
40
|
+
s.rubygems_version = %q{1.4.2}
|
|
37
41
|
s.summary = %q{Basic spreadsheet content extraction using Apache POI}
|
|
38
42
|
|
|
39
43
|
if s.respond_to? :specification_version then
|
|
40
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
41
44
|
s.specification_version = 3
|
|
42
45
|
|
|
43
46
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simple-spreadsheet-extractor
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 1
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 7
|
|
9
|
-
-
|
|
10
|
-
version: 0.7.
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.7.1
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Stuart Owen
|
|
@@ -16,7 +16,7 @@ autorequire:
|
|
|
16
16
|
bindir: bin
|
|
17
17
|
cert_chain: []
|
|
18
18
|
|
|
19
|
-
date: 2011-11-
|
|
19
|
+
date: 2011-11-28 00:00:00 +00:00
|
|
20
20
|
default_executable:
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|
|
@@ -71,15 +71,13 @@ files:
|
|
|
71
71
|
- jars/lib/poi-ooxml-schemas-3.8-beta4.jar
|
|
72
72
|
- jars/lib/poi-rightfield-3.8-beta4.jar
|
|
73
73
|
- jars/lib/xmlbeans-2.3.0.jar
|
|
74
|
-
- jars/simple-spreadsheet-extractor-0.7
|
|
75
|
-
- jars/simple-spreadsheet-extractor-0.7.jar
|
|
74
|
+
- jars/simple-spreadsheet-extractor-0.7.1.jar
|
|
76
75
|
- lib/simple-spreadsheet-extractor.rb
|
|
77
76
|
- simple-spreadsheet-extractor.gemspec
|
|
78
77
|
- test/files/not-a-spreadsheet.xls
|
|
79
78
|
- test/files/test-csv-output1-trimmed.csv
|
|
80
79
|
- test/files/test-csv-output1.csv
|
|
81
80
|
- test/files/test-spreadsheet.xls
|
|
82
|
-
- test/test_extraction.rb
|
|
83
81
|
has_rdoc: true
|
|
84
82
|
homepage: http://github.com/myGrid/simple-spreadsheet-extractor-gem
|
|
85
83
|
licenses: []
|
|
@@ -114,6 +112,5 @@ rubygems_version: 1.4.2
|
|
|
114
112
|
signing_key:
|
|
115
113
|
specification_version: 3
|
|
116
114
|
summary: Basic spreadsheet content extraction using Apache POI
|
|
117
|
-
test_files:
|
|
118
|
-
|
|
119
|
-
- test/test_extraction.rb
|
|
115
|
+
test_files: []
|
|
116
|
+
|
|
Binary file
|
|
Binary file
|
data/test/test_extraction.rb
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
require 'test/unit'
|
|
2
|
-
require 'simple-spreadsheet-extractor'
|
|
3
|
-
require 'libxml'
|
|
4
|
-
|
|
5
|
-
class TestExtraction < Test::Unit::TestCase
|
|
6
|
-
|
|
7
|
-
SCHEMA_FILE_PATH = File.dirname(__FILE__) + "/../doc/schema-v1.xsd"
|
|
8
|
-
|
|
9
|
-
include SysMODB::SpreadsheetExtractor
|
|
10
|
-
|
|
11
|
-
def test_from_file_object
|
|
12
|
-
test_sheet = File.dirname(__FILE__) + "/files/test-spreadsheet.xls"
|
|
13
|
-
f=open(test_sheet,"rb")
|
|
14
|
-
xml = spreadsheet_to_xml(f)
|
|
15
|
-
assert_not_nil xml
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def test_validate_xml
|
|
19
|
-
test_sheet = File.dirname(__FILE__) + "/files/test-spreadsheet.xls"
|
|
20
|
-
f=open(test_sheet,"rb")
|
|
21
|
-
xml = spreadsheet_to_xml(f)
|
|
22
|
-
validate_against_schema(xml)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def test_failure
|
|
26
|
-
test_sheet = File.dirname(__FILE__) + "/files/not-a-spreadsheet.xls"
|
|
27
|
-
f=open(test_sheet,"rb")
|
|
28
|
-
assert_raise SysMODB::SpreadsheetExtractionException do
|
|
29
|
-
spreadsheet_to_xml(f)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def validate_against_schema xml
|
|
34
|
-
document = LibXML::XML::Document.string(xml)
|
|
35
|
-
schema = LibXML::XML::Schema.new(SCHEMA_FILE_PATH)
|
|
36
|
-
begin
|
|
37
|
-
document.validate_schema(schema)
|
|
38
|
-
rescue LibXML::XML::Error => e
|
|
39
|
-
puts xml
|
|
40
|
-
assert false,"Error validating against schema: #{e.message}"
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def test_csv_output
|
|
45
|
-
test_sheet = File.dirname(__FILE__) + "/files/test-spreadsheet.xls"
|
|
46
|
-
expected_file = File.dirname(__FILE__) + "/files/test-csv-output1.csv"
|
|
47
|
-
expected = open(expected_file,"rb").read
|
|
48
|
-
|
|
49
|
-
f=open(test_sheet,"rb")
|
|
50
|
-
csv = spreadsheet_to_csv(f,2)
|
|
51
|
-
assert_equal expected,csv
|
|
52
|
-
|
|
53
|
-
#try sheet as a string
|
|
54
|
-
f=open(test_sheet,"rb")
|
|
55
|
-
csv = spreadsheet_to_csv(f,"2")
|
|
56
|
-
assert_equal expected,csv
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
# def test_csv_output_trimmed
|
|
60
|
-
# test_sheet = File.dirname(__FILE__) + "/files/test-spreadsheet.xls"
|
|
61
|
-
# expected_file = File.dirname(__FILE__) + "/files/test-csv-output1-trimmed.csv"
|
|
62
|
-
# expected = open(expected_file,"rb").read
|
|
63
|
-
#
|
|
64
|
-
# f=open(test_sheet,"rb")
|
|
65
|
-
# csv = spreadsheet_to_csv(f,2,true)
|
|
66
|
-
# assert_equal expected,csv
|
|
67
|
-
# end
|
|
68
|
-
|
|
69
|
-
def test_for_segfault
|
|
70
|
-
test_sheet = File.dirname(__FILE__) + "/files/test-spreadsheet.xls"
|
|
71
|
-
10.times do |x|
|
|
72
|
-
f=open(test_sheet,"rb")
|
|
73
|
-
xml = spreadsheet_to_xml(f)
|
|
74
|
-
end
|
|
75
|
-
true
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
end
|