swissmedic-diff 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +1 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +26 -27
- data/History.txt +4 -0
- data/lib/compatibility.rb +19 -4
- data/lib/swissmedic-diff.rb +7 -2
- data/lib/version.rb +1 -1
- data/swissmedic-diff.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjYzOTlmOTY3NjE1MTVkOGZhN2I5YzViMWQyYzYxMjU4NmZhZDg5MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWUxY2U2MTRjOWFiNjEwNTNhMWQ1ZGI0ZDVjNGQ3NzRkNzA0MjViNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MTJiY2QwMThmMDU1ZGJlZGI4YzljYTA3YjIwNjU1OThhZGJiYTBhN2RhMGQ3
|
10
|
+
ZWM0MTdhMjNiYTM2M2ZjOGM2MzQ5YzYwMjExMTcxN2I4YjhmMDZmZDMyMTk4
|
11
|
+
NDg2NjRhNWY0NTZlMDM0MDdiYzZlYzMwMTQ1MTQ1ZTFmYmIzMTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTdjNWQ4ZDFkZWNiYTI4NTllYWRhOGVjYTk1MThmZDY2YTc5NWM5MjQ5MTg4
|
14
|
+
OWYxZDFlNGM3NmZjY2Q4OGZjNWQyODFmYTIzYWI4ZGYwMmU0ZDAyMTI4NDhh
|
15
|
+
NTYzYjk0OGUzM2MwYTk3ZjdiOGVlYzFiNTRkMDY5ZDhjNDk5OWE=
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
swissmedic-diff (0.1.
|
4
|
+
swissmedic-diff (0.1.8)
|
5
5
|
nokogiri
|
6
6
|
rubyXL
|
7
|
-
rubyzip
|
7
|
+
rubyzip
|
8
8
|
spreadsheet
|
9
9
|
|
10
10
|
GEM
|
@@ -13,42 +13,41 @@ GEM
|
|
13
13
|
ansi (1.4.3)
|
14
14
|
builder (3.2.2)
|
15
15
|
coderay (1.1.0)
|
16
|
-
columnize (0.
|
17
|
-
debugger (1.6.
|
16
|
+
columnize (0.8.9)
|
17
|
+
debugger (1.6.8)
|
18
18
|
columnize (>= 0.3.1)
|
19
19
|
debugger-linecache (~> 1.2.0)
|
20
|
-
debugger-ruby_core_source (~> 1.3.
|
20
|
+
debugger-ruby_core_source (~> 1.3.5)
|
21
21
|
debugger-linecache (1.2.0)
|
22
|
-
debugger-ruby_core_source (1.3.
|
23
|
-
|
24
|
-
hoe (3.7.4)
|
22
|
+
debugger-ruby_core_source (1.3.5)
|
23
|
+
hoe (3.12.0)
|
25
24
|
rake (>= 0.8, < 11.0)
|
26
25
|
method_source (0.8.2)
|
27
|
-
mini_portile (0.
|
28
|
-
minitest (5.
|
29
|
-
minitest-reporters (1.0.
|
26
|
+
mini_portile (0.6.0)
|
27
|
+
minitest (5.3.5)
|
28
|
+
minitest-reporters (1.0.5)
|
30
29
|
ansi
|
31
30
|
builder
|
32
31
|
minitest (>= 5.0)
|
33
|
-
|
34
|
-
nokogiri (1.6.
|
35
|
-
mini_portile (
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
pry (0.9.12.4)
|
40
|
-
coderay (~> 1.0)
|
41
|
-
method_source (~> 0.8)
|
32
|
+
ruby-progressbar
|
33
|
+
nokogiri (1.6.2.1)
|
34
|
+
mini_portile (= 0.6.0)
|
35
|
+
pry (0.10.0)
|
36
|
+
coderay (~> 1.1.0)
|
37
|
+
method_source (~> 0.8.1)
|
42
38
|
slop (~> 3.4)
|
43
|
-
pry-debugger (0.2.
|
39
|
+
pry-debugger (0.2.3)
|
44
40
|
debugger (~> 1.3)
|
45
|
-
pry (
|
46
|
-
rake (10.
|
41
|
+
pry (>= 0.9.10, < 0.11.0)
|
42
|
+
rake (10.3.2)
|
47
43
|
ruby-ole (1.2.11.7)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
44
|
+
ruby-progressbar (1.5.1)
|
45
|
+
rubyXL (3.1.2)
|
46
|
+
nokogiri (>= 1.4.4)
|
47
|
+
rubyzip (>= 1.1.6)
|
48
|
+
rubyzip (1.1.6)
|
49
|
+
slop (3.5.0)
|
50
|
+
spreadsheet (0.9.7)
|
52
51
|
ruby-ole (>= 1.0)
|
53
52
|
|
54
53
|
PLATFORMS
|
data/History.txt
CHANGED
data/lib/compatibility.rb
CHANGED
@@ -26,18 +26,28 @@ module Spreadsheet
|
|
26
26
|
row.at(idx) && row.date(idx)
|
27
27
|
else
|
28
28
|
data = row[idx]
|
29
|
-
|
29
|
+
if data.is_a?(RubyXL::Cell)
|
30
|
+
return data.value.respond_to?(:to_i) ? data.value.to_i : data.value
|
31
|
+
return data.value if data.value.is_a?(DateTime)
|
32
|
+
if data.value.class.to_s == 'DateTime'
|
33
|
+
puts "data is_a RubyXL::Cell and value #{data.value.class} is_a? Date #{data.value.is_a?(Date)} DateTime #{data.value.is_a?(DateTime)}"
|
34
|
+
return Date.new(1899,12,30)+data.to_date.value.to_i
|
35
|
+
else
|
36
|
+
return Date.new(1899,12,30)+data.value.to_i if data.is_a?(RubyXL::Cell)
|
37
|
+
end
|
38
|
+
end
|
30
39
|
end
|
31
40
|
end
|
32
41
|
end
|
33
42
|
|
34
43
|
module RubyXL
|
35
|
-
class Worksheet
|
44
|
+
class Worksheet
|
36
45
|
def row(row_index)
|
37
46
|
x = @sheet_data[row_index]
|
38
47
|
def x.date(column_index)
|
39
48
|
data = self[column_index]
|
40
|
-
return
|
49
|
+
return data.value.respond_to?(:to_i) ? data.value.to_i : data.value
|
50
|
+
# return Date.new(1899,12,30)+data.value.to_i if data.is_a?(RubyXL::Cell)
|
41
51
|
end unless defined?(x.date)
|
42
52
|
x
|
43
53
|
end
|
@@ -47,9 +57,14 @@ module RubyXL
|
|
47
57
|
self[idx]
|
48
58
|
end
|
49
59
|
end
|
60
|
+
class Row < OOXMLObject
|
61
|
+
def []=(ind, value)
|
62
|
+
cells[ind] = value
|
63
|
+
end
|
64
|
+
end
|
50
65
|
class Cell
|
51
66
|
def to_i
|
52
|
-
self.value.to_i
|
67
|
+
self.value.respond_to?(:to_i) ? self.value.to_i : self.value
|
53
68
|
end
|
54
69
|
def to_s
|
55
70
|
self.value.to_s
|
data/lib/swissmedic-diff.rb
CHANGED
@@ -301,7 +301,7 @@ class SwissmedicDiff
|
|
301
301
|
|row|
|
302
302
|
row_nr += 1
|
303
303
|
next if row_nr <= skipRows
|
304
|
-
if row.size < COLUMNS.size/2
|
304
|
+
if row.size < COLUMNS.size/2
|
305
305
|
$stdout.puts "Data missing in \n(line " + (row_nr).to_s + "): " + row.join(", ").to_s + "\n"
|
306
306
|
next
|
307
307
|
end
|
@@ -317,7 +317,12 @@ class SwissmedicDiff
|
|
317
317
|
# Packungen.xls of swissmedic before October 2013 had 3 leading rows
|
318
318
|
# Packungen.xls of swissmedic after October 2013 have 4 leading rows
|
319
319
|
j = 0
|
320
|
-
|
320
|
+
while true
|
321
|
+
cell = spreadsheet.worksheet(0).row(j)[0]
|
322
|
+
cell = cell.value if cell.is_a?(RubyXL::Cell)
|
323
|
+
break if cell.respond_to?(:to_i) and cell.to_i != 0
|
324
|
+
j += 1
|
325
|
+
end
|
321
326
|
j
|
322
327
|
end
|
323
328
|
|
data/lib/version.rb
CHANGED
data/swissmedic-diff.gemspec
CHANGED
@@ -17,7 +17,7 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.executables << 'swissmedic-diff'
|
18
18
|
s.add_dependency('rubyXL')
|
19
19
|
s.add_dependency('nokogiri')
|
20
|
-
s.add_dependency('rubyzip'
|
20
|
+
s.add_dependency('rubyzip')
|
21
21
|
s.add_dependency('spreadsheet')
|
22
22
|
s.add_development_dependency "hoe"
|
23
23
|
s.add_development_dependency "minitest"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swissmedic-diff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaomi Hatakeyama, Zeno R.R. Davatz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|