fias 1.0.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74d2bb526b9c5ea3f360d6ac0dd82ffed3c16f6c
4
- data.tar.gz: 5a902f0aea4bad5260a8502bd0276f5f62ba3113
3
+ metadata.gz: 5ad5fd97ba62e73095004bd9e6759ea6e4ae17db
4
+ data.tar.gz: 5d7d62bc468d7a4bd643a163f1b9d5374bb0d939
5
5
  SHA512:
6
- metadata.gz: 9d19fc34bb832abacd1579193db308d29e0278adeef76b62abd6a8c9b164a1eb7dd9d993a6bb650bd3dfa932e70488943ec25ebc0d6eff4d27121bf3c05e1ab4
7
- data.tar.gz: f4bfabda5028093b5107cf98ca8e4d7a0ee7d7ff0f95e9df9a967386ec6398c8c2248bc4809a3455d6ee05adfd2bdad7f86fa2c954094e3f2ef62a9f2baf1fc9
6
+ metadata.gz: 973fcd4be6110e1ffaf61e47a21fbb627416801c6e405cd21a55da7685252c87658086c143ba61931500170377d8de55b9934aa1e39d83f9de1d600de3155563
7
+ data.tar.gz: fc60dc7bdd39bc83dab2eff2305afc85b12455660231e03e4ada00dc6e9cf2a1880cc7be7c8c7ee66a417167d4f68f5640cb3f5ebcd29376998960254471f02a
data/README.md CHANGED
@@ -14,6 +14,8 @@ Designed for usage with Ruby on Rails and a PostgreSQL backend.
14
14
 
15
15
  Think twice before you decide to use a standalone copy of FIAS database in your project. [КЛАДР в облаке](https://kladr-api.ru/) could also be a solution.
16
16
 
17
+ ![Мухосраново](http://i.imgur.com/JCwgqjL.jpg) ![Марс](http://i.imgur.com/j8WPtOI.jpg)
18
+
17
19
  ## Installation
18
20
 
19
21
  Add this line to your application's `Gemfile`:
@@ -37,11 +39,15 @@ Or install it yourself:
37
39
  $ unrar e fias_dbf.rar
38
40
  $ bundle exec rake fias:create_tables fias:import DATABASE_URL=postgres://localhost/fias
39
41
 
42
+ If you get an error "Errno::EMFILE: Too many open files @ rb_sysopen" please set ulimit 512 or more before starting rake tasks:
43
+
44
+ ulimit -S -n 512
45
+
40
46
  The rake task accepts options through ENV variables:
41
47
 
42
48
  * `TABLES` to specify a comma-separated list of tables to import or create. See `Fias::Import::Dbf::TABLES` for the list of key names. Use `houses` as an alias for HOUSE* tables and `nordocs` for NORDOC* tables. In most cases you'll need only the `address_objects` table.
43
49
  * `PREFIX` for database tables prefix ('fias_' by default).
44
- * `PATH` to specify DBF files location ('tmp/fias' by default).
50
+ * `FIAS_PATH` to specify DBF files location ('tmp/fias' by default).
45
51
  * `DATABASE_URL` to set database credentials (required explicitly even with a Ruby on Rails project).
46
52
 
47
53
  This gem uses `COPY FROM STDIN BINARY` to import data. At the moment it works with PostgreSQL only.
@@ -68,7 +68,8 @@ module Fias
68
68
  structure_statuses: 'STRSTAT.DBF',
69
69
  address_objects: 'ADDROBJ.DBF',
70
70
  house_intervals: 'HOUSEINT.DBF',
71
- landmarks: 'LANDMARK.DBF'
71
+ landmarks: 'LANDMARK.DBF',
72
+ house_state_statuses: 'HSTSTAT.DBF'
72
73
  }.merge(
73
74
  HOUSE_TABLES
74
75
  ).merge(
@@ -77,24 +77,23 @@ module Fias
77
77
  end
78
78
 
79
79
  def extract_synonyms
80
- @synonyms = @sanitized.map do |key, value|
81
- [key, Fias::Name::Synonyms.expand(value.first)]
82
- end
83
- @synonyms = Hash[@synonyms]
80
+ @synonyms = map_sanitized { |value| Fias::Name::Synonyms.expand(value) }
84
81
  end
85
82
 
86
83
  def split_sanitized
87
- @split = @sanitized.map do |key, value|
88
- [key, Fias::Name::Split.split(value.first)]
89
- end
90
- @split = Hash[@split]
84
+ @split = map_sanitized { |value| Fias::Name::Split.split(value) }
91
85
  end
92
86
 
93
87
  def fill_forms
94
- @forms = @sanitized.map do |key, value|
95
- [key, Fias::Name::Synonyms.forms(value.first)]
88
+ @forms = map_sanitized { |value| Fias::Name::Synonyms.forms(value) }
89
+ end
90
+
91
+ def map_sanitized(&block)
92
+ mapped = @sanitized.map do |key, value|
93
+ [key, yield(value.first)]
96
94
  end
97
- @forms = Hash[@forms]
95
+
96
+ Hash[mapped]
98
97
  end
99
98
  end
100
99
  end
@@ -1,3 +1,3 @@
1
1
  module Fias
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fias
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Sokolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-03 00:00:00.000000000 Z
11
+ date: 2015-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dbf
@@ -333,7 +333,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
333
333
  version: '0'
334
334
  requirements: []
335
335
  rubyforge_project:
336
- rubygems_version: 2.2.2
336
+ rubygems_version: 2.4.6
337
337
  signing_key:
338
338
  specification_version: 4
339
339
  summary: Imports Russian FIAS database into SQL