chupa-text-decomposer-spreadsheet 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +20 -0
- data/README.md +23 -1
- data/chupa-text-decomposer-spreadsheet.gemspec +3 -1
- data/doc/text/news.md +11 -0
- data/lib/chupa-text/decomposers/spreadsheet.rb +2 -1
- data/test/fixture/ods/multi-sheets.ods +0 -0
- data/test/fixture/xls/multi-sheets.xls +0 -0
- data/test/fixture/xlsx/multi-sheets.xlsx +0 -0
- data/test/run-test.rb +0 -0
- data/test/test-spreadsheet.rb +44 -10
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb5fe80592a943a60bcb2d2716432a03a195c970
|
4
|
+
data.tar.gz: d29475afbe1e429204ea4305506b561563ae750f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a202f906a4bd200f43c43d842655bf8d22b5549dda4a3428372288e0b5e850c56d2046af340b8838a44bb2c9c2dd3cafe2035e49a2a8ea9c752274608344e96
|
7
|
+
data.tar.gz: 3d31d5ffa8c0eb0457b0be6f4c7206354012b73ea7fd8e6f42f8faaff8e4ecc2c25fdfab9e84e1da35f085519d53234724919749ab326051e983e543447621ea
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Kenji Okimoto <okimoto@clear-code.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,26 @@
|
|
1
1
|
# chupa-text-decomposer-spreadsheet
|
2
2
|
|
3
|
-
[Roo](https://github.com/roo-rb/roo) based
|
3
|
+
[Roo](https://github.com/roo-rb/roo) based ChupaText decomposer for spreadsheet.
|
4
|
+
|
5
|
+
## Install
|
6
|
+
|
7
|
+
```
|
8
|
+
$ gem install chupa-text-decomposer-spreadsheet
|
9
|
+
```
|
10
|
+
|
11
|
+
or write Gemfile:
|
12
|
+
|
13
|
+
```
|
14
|
+
source "https://rubygems.org"
|
15
|
+
|
16
|
+
gem "chupa-text-decomposer-spreadsheet"
|
17
|
+
```
|
18
|
+
|
19
|
+
and run `bundle install`.
|
20
|
+
|
21
|
+
## License
|
22
|
+
|
23
|
+
MIT license
|
24
|
+
|
25
|
+
Copyright 2017 Kenji Okimoto \<okimoto@clear-code.com\>
|
4
26
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "chupa-text-decomposer-spreadsheet"
|
5
|
-
spec.version = "1.0.
|
5
|
+
spec.version = "1.0.1"
|
6
6
|
spec.author = "Kenji Okimoto"
|
7
7
|
spec.email = "okimoto@clear-code.com"
|
8
8
|
spec.summary = "ChupaText decomposer for spreadsheet."
|
@@ -10,12 +10,14 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.license = "MIT"
|
11
11
|
spec.files = ["#{spec.name}.gemspec"]
|
12
12
|
spec.files += Dir.glob("{README*,LICENSE*,Rakefile,Gemfile}")
|
13
|
+
spec.files += Dir.glob("doc/text/*")
|
13
14
|
spec.files += Dir.glob("lib/**/*.rb")
|
14
15
|
spec.files += Dir.glob("test/fixture/**/*")
|
15
16
|
spec.files += Dir.glob("test/**/*.rb")
|
16
17
|
|
17
18
|
spec.add_runtime_dependency("chupa-text")
|
18
19
|
spec.add_runtime_dependency("roo")
|
20
|
+
spec.add_runtime_dependency("roo-xls")
|
19
21
|
|
20
22
|
spec.add_development_dependency("bundler")
|
21
23
|
spec.add_development_dependency("rake")
|
data/doc/text/news.md
ADDED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "roo"
|
2
|
+
require "roo-xls"
|
2
3
|
require "digest/sha1"
|
3
4
|
|
4
5
|
module ChupaText
|
@@ -23,7 +24,7 @@ module ChupaText
|
|
23
24
|
book.sheets.each do |sheet_name|
|
24
25
|
sheet = book.sheet(sheet_name)
|
25
26
|
body = sheet.to_csv
|
26
|
-
text_data = TextData.new(body)
|
27
|
+
text_data = TextData.new(body, source_data: data)
|
27
28
|
text_data["name"] = sheet_name
|
28
29
|
text_data["digest"] = Digest::SHA1.hexdigest(body)
|
29
30
|
text_data["size"] = body.bytesize
|
Binary file
|
Binary file
|
Binary file
|
data/test/run-test.rb
CHANGED
File without changes
|
data/test/test-spreadsheet.rb
CHANGED
@@ -6,23 +6,57 @@ class TestSpreadsheet < Test::Unit::TestCase
|
|
6
6
|
end
|
7
7
|
|
8
8
|
sub_test_case("decompose") do
|
9
|
-
def decompose(
|
10
|
-
|
11
|
-
data
|
12
|
-
data.body = input_body
|
9
|
+
def decompose(fixture_name)
|
10
|
+
path = Pathname(fixture_path(fixture_name))
|
11
|
+
data = ChupaText::InputData.new(path)
|
13
12
|
|
14
13
|
decomposed = []
|
15
14
|
@decomposer.decompose(data) do |decomposed_data|
|
16
15
|
decomposed << decomposed_data
|
17
16
|
end
|
18
|
-
decomposed
|
17
|
+
decomposed.collect(&:body)
|
19
18
|
end
|
20
19
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
20
|
+
def test_ods
|
21
|
+
assert_equal([<<-SHEET1, <<-SHEET2, <<-SHEET3],
|
22
|
+
"Sheet1 - A1","Sheet1 - B1"
|
23
|
+
"Sheet1 - A2","Sheet1 - B2"
|
24
|
+
SHEET1
|
25
|
+
"Sheet2 - A1","Sheet2 - B1"
|
26
|
+
"Sheet2 - A2","Sheet2 - B2"
|
27
|
+
SHEET2
|
28
|
+
"Sheet3 - A1","Sheet3 - B1"
|
29
|
+
"Sheet3 - A2","Sheet3 - B2"
|
30
|
+
SHEET3
|
31
|
+
decompose("ods/multi-sheets.ods"))
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_xls
|
35
|
+
assert_equal([<<-SHEET1, <<-SHEET2, <<-SHEET3],
|
36
|
+
"Sheet1 - A1","Sheet1 - B1"
|
37
|
+
"Sheet1 - A2","Sheet1 - B2"
|
38
|
+
SHEET1
|
39
|
+
"Sheet2 - A1","Sheet2 - B1"
|
40
|
+
"Sheet2 - A2","Sheet2 - B2"
|
41
|
+
SHEET2
|
42
|
+
"Sheet3 - A1","Sheet3 - B1"
|
43
|
+
"Sheet3 - A2","Sheet3 - B2"
|
44
|
+
SHEET3
|
45
|
+
decompose("xls/multi-sheets.xls"))
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_xlsx
|
49
|
+
assert_equal([<<-SHEET1, <<-SHEET2, <<-SHEET3],
|
50
|
+
"Sheet1 - A1","Sheet1 - B1"
|
51
|
+
"Sheet1 - A2","Sheet1 - B2"
|
52
|
+
SHEET1
|
53
|
+
"Sheet2 - A1","Sheet2 - B1"
|
54
|
+
"Sheet2 - A2","Sheet2 - B2"
|
55
|
+
SHEET2
|
56
|
+
"Sheet3 - A1","Sheet3 - B1"
|
57
|
+
"Sheet3 - A2","Sheet3 - B2"
|
58
|
+
SHEET3
|
59
|
+
decompose("xlsx/multi-sheets.xlsx"))
|
26
60
|
end
|
27
61
|
end
|
28
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chupa-text-decomposer-spreadsheet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kenji Okimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chupa-text
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: roo-xls
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,10 +101,15 @@ extensions: []
|
|
87
101
|
extra_rdoc_files: []
|
88
102
|
files:
|
89
103
|
- Gemfile
|
104
|
+
- LICENSE.txt
|
90
105
|
- README.md
|
91
106
|
- Rakefile
|
92
107
|
- chupa-text-decomposer-spreadsheet.gemspec
|
108
|
+
- doc/text/news.md
|
93
109
|
- lib/chupa-text/decomposers/spreadsheet.rb
|
110
|
+
- test/fixture/ods/multi-sheets.ods
|
111
|
+
- test/fixture/xls/multi-sheets.xls
|
112
|
+
- test/fixture/xlsx/multi-sheets.xlsx
|
94
113
|
- test/helper.rb
|
95
114
|
- test/run-test.rb
|
96
115
|
- test/test-spreadsheet.rb
|
@@ -114,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
133
|
version: '0'
|
115
134
|
requirements: []
|
116
135
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.5.2
|
118
137
|
signing_key:
|
119
138
|
specification_version: 4
|
120
139
|
summary: ChupaText decomposer for spreadsheet.
|