polish_postal_codes 0.0.1 → 0.0.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.
- checksums.yaml +4 -4
- data/bin/update +7 -12
- data/lib/polish_postal_codes/version.rb +1 -1
- data/lib/polish_postal_codes.pstore +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 454c84acb6a13c24dd20140a25c224c2c5a23990
|
|
4
|
+
data.tar.gz: 94e78adaba8c2fd8fdcbaadefe60e76b948883b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12c8f9f094cbcc5276f4141657c87dc800cd258ab206ad421e6a7499170692bd822ab32b3c1d39f4964edd7950cc6ca3d225181e62bcb360ae59e05fe4c09eea
|
|
7
|
+
data.tar.gz: 9f8af4b93a8bfcd65a595a7cb53d121056e4d6c574b2c3cbe29494ea3b1aa822982efb5839983f1e3fd3f5af2153e0b969f4d2b7240bc1427d134d4014d34a5a
|
data/bin/update
CHANGED
|
@@ -18,22 +18,17 @@ system("pdftotext -layout #{tmp_file.path}")
|
|
|
18
18
|
data.transaction do
|
|
19
19
|
File.open("#{tmp_file.path}.txt", 'r').each_line do |line|
|
|
20
20
|
break if line =~ /Podmioty posiadające odrębne PNA/
|
|
21
|
+
next unless line =~ /([0-9]{2}-[0-9]{3})/
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
county: t[-2].strip,
|
|
28
|
-
province: t[-1].strip }
|
|
29
|
-
end
|
|
23
|
+
t = line.gsub(/\ {2,}/, ' ').split(/ /)
|
|
24
|
+
data[t[0].strip] ||= { city: t[1].split('(').first.strip,
|
|
25
|
+
community: t[-3].strip,
|
|
26
|
+
county: t[-2].strip,
|
|
27
|
+
province: t[-1].strip }
|
|
30
28
|
end
|
|
31
29
|
end
|
|
32
30
|
|
|
33
31
|
at_exit do
|
|
34
32
|
converted_txt_file_path = "#{tmp_file.path}.txt"
|
|
35
|
-
|
|
36
|
-
if File.exist? converted_txt_file_path
|
|
37
|
-
File.delete converted_txt_file_path
|
|
38
|
-
end
|
|
33
|
+
File.delete converted_txt_file_path if File.exist? converted_txt_file_path
|
|
39
34
|
end
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: polish_postal_codes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Damian Baćkowski
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-08-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|