free_zipcode_data 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfe97e5c2963d4c40da211303f3f3c31ad9b29253c70c3d3f2ff303d92d51c9a
4
- data.tar.gz: 38744e59531dcaf6dbc710a8343c7b97f72b3e35f4c48d73f499eacdfee6ea2b
3
+ metadata.gz: dda92f3d094c519def33805973be1116b84cf060e15bd112defcc1436ef2e0b8
4
+ data.tar.gz: 772e32aabb48de44e36e63875f5dd481b5760885afab159216f688faa11c1a73
5
5
  SHA512:
6
- metadata.gz: a65a8d0bfcece72ef8e8a93bb654f0c50436de7d3639f1fefca845f8e3a1082aba1ae0597be269967715eb2ebcc01090a5f714cb7ec10b141c9c041bdde9349a
7
- data.tar.gz: 0611b47e763d063e84029de8022fda6f2ffd2bceeb6f2ff8a6f04499a5d8814a700bd8b6b14520a627338947ff5aa171b20703d59a9afc7ab5d673b7949d2588
6
+ metadata.gz: 33e594c722a53a24946defa4e0aacc1077b142e096b716606b77153e44e15a819956b65cc800442d0cc89b6ce33b5c06206603e71c4500e27d15904599fce5e4
7
+ data.tar.gz: 9c828694222edca8dcceb667b9bd1bcc7cf9280a9b6581b8522c22dfd5b0bef963853a47d61e8f159c1c7439a85e99a180369093b7f1114b9e699173004f5cc5
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ *1.0.2* (January 11, 2019)
2
+
3
+ * Upgraded RubyZip gem version to address the reported vulnerability
4
+ * Upgrade from Trollop (now deprecated) to Optimist
5
+ * Fix issue #12 (No such file or directory @ rb_sysopen - country_lookup_table.yml) - thanks @srghma
6
+
1
7
  *1.0.1* (April 23, 2018)
2
8
 
3
9
  * Made it a gem with a command line executable bin/free_zipcode_data
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- free_zipcode_data (1.0.1)
4
+ free_zipcode_data (1.0.2)
5
5
  colored (~> 1.2)
6
6
  kiba (~> 2.0)
7
+ optimist (~> 3.0)
7
8
  ruby-progressbar (~> 1.9)
8
- rubyzip (~> 1.2)
9
+ rubyzip (>= 1.2.2)
9
10
  sqlite3 (~> 1.3)
10
- trollop (~> 2.1)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
@@ -20,6 +20,7 @@ GEM
20
20
  json (2.1.0)
21
21
  kiba (2.0.0)
22
22
  method_source (0.8.2)
23
+ optimist (3.0.0)
23
24
  parallel (1.12.1)
24
25
  parser (2.5.1.0)
25
26
  ast (~> 2.4.0)
@@ -54,7 +55,7 @@ GEM
54
55
  unicode-display_width (~> 1.0, >= 1.0.1)
55
56
  ruby-prof (0.17.0)
56
57
  ruby-progressbar (1.9.0)
57
- rubyzip (1.2.1)
58
+ rubyzip (1.2.2)
58
59
  simplecov (0.16.1)
59
60
  docile (~> 1.1)
60
61
  json (>= 1.8, < 3)
@@ -62,7 +63,6 @@ GEM
62
63
  simplecov-html (0.10.2)
63
64
  slop (3.6.0)
64
65
  sqlite3 (1.3.13)
65
- trollop (2.1.2)
66
66
  unicode-display_width (1.3.2)
67
67
 
68
68
  PLATFORMS
@@ -79,4 +79,4 @@ DEPENDENCIES
79
79
  simplecov (~> 0.16)
80
80
 
81
81
  BUNDLED WITH
82
- 1.16.1
82
+ 1.17.1
@@ -35,9 +35,9 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  spec.add_runtime_dependency 'colored', '~> 1.2'
37
37
  spec.add_runtime_dependency 'kiba', '~> 2.0'
38
+ spec.add_runtime_dependency 'optimist', '~> 3.0'
38
39
  spec.add_runtime_dependency 'ruby-progressbar', '~> 1.9'
39
- spec.add_runtime_dependency 'rubyzip', '~> 1.2'
40
+ spec.add_runtime_dependency 'rubyzip', '>= 1.2.2'
40
41
  spec.add_runtime_dependency 'sqlite3', '~> 1.3'
41
- spec.add_runtime_dependency 'trollop', '~> 2.1'
42
42
  end
43
43
  # rubocop:enable Metrics/BlockLength
@@ -24,7 +24,11 @@ module FreeZipcodeData
24
24
  private
25
25
 
26
26
  def country_lookup_table
27
- @country_lookup_table ||= YAML.load_file('country_lookup_table.yml')
27
+ @country_lookup_table ||=
28
+ begin
29
+ path = File.expand_path('../../country_lookup_table.yml', __dir__)
30
+ YAML.load_file(path)
31
+ end
28
32
  end
29
33
 
30
34
  def select_first(sql)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'colored'
4
- require 'trollop'
4
+ require 'optimist'
5
5
  require 'kiba'
6
6
 
7
7
  require_relative '../etl/free_zipcode_data_job'
@@ -35,7 +35,9 @@ module FreeZipcodeData
35
35
 
36
36
  db_file = File.join(options.work_dir, 'free_zipcode_data.sqlite3')
37
37
  database = SqliteRam.new(db_file)
38
- configure_meta(database.conn, datasource.datafile)
38
+
39
+ line_count = datasource_line_count(datasource.datafile)
40
+ configure_meta(database.conn, line_count)
39
41
 
40
42
  %i[country state county zipcode].each { |t| initialize_table(t, database) }
41
43
 
@@ -50,7 +52,7 @@ module FreeZipcodeData
50
52
  end
51
53
 
52
54
  elapsed = Time.at(Time.now - start_time).utc.strftime('%H:%M:%S')
53
- logger.info("Processed #{datasource_line_count} zipcodes in [#{elapsed}].".yellow)
55
+ logger.info("Processed #{line_count} zipcodes in [#{elapsed}].".yellow)
54
56
  end
55
57
 
56
58
  private
@@ -67,14 +69,12 @@ module FreeZipcodeData
67
69
  end
68
70
 
69
71
  def datasource_line_count(filename)
70
- @datasource_line_count ||= begin
71
- count = File.foreach(filename).inject(0) { |c, _line| c + 1 }
72
- logger.verbose("Processing #{count} zipcodes in '#{filename}'...")
73
- count
74
- end
72
+ count = File.foreach(filename).inject(0) { |c, _line| c + 1 }
73
+ logger.verbose("Processing #{count} zipcodes in '#{filename}'...")
74
+ count
75
75
  end
76
76
 
77
- def configure_meta(database, datasource)
77
+ def configure_meta(database, line_count)
78
78
  schema = <<-SQL
79
79
  create table meta (
80
80
  id integer not null primary key,
@@ -86,7 +86,7 @@ module FreeZipcodeData
86
86
 
87
87
  sql = <<-SQL
88
88
  INSERT INTO meta (name, value)
89
- VALUES ('line_count', #{datasource_line_count(datasource)})
89
+ VALUES ('line_count', #{line_count})
90
90
  SQL
91
91
  database.execute(sql)
92
92
  end
@@ -104,7 +104,7 @@ module FreeZipcodeData
104
104
  # rubocop:disable Metrics/BlockLength
105
105
  # rubocop:disable Metrics/MethodLength
106
106
  def collect_args
107
- Trollop.options do
107
+ Optimist.options do
108
108
  opt(
109
109
  :work_dir,
110
110
  'REQUIRED: Specify your work/build directory, where the SQLite and .csv files will be built',
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FreeZipcodeData
4
- VERSION = '1.0.1'.freeze
4
+ VERSION = '1.0.2'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: free_zipcode_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Blackburn
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-24 00:00:00.000000000 Z
12
+ date: 2019-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -138,61 +138,61 @@ dependencies:
138
138
  - !ruby/object:Gem::Version
139
139
  version: '2.0'
140
140
  - !ruby/object:Gem::Dependency
141
- name: ruby-progressbar
141
+ name: optimist
142
142
  requirement: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: '1.9'
146
+ version: '3.0'
147
147
  type: :runtime
148
148
  prerelease: false
149
149
  version_requirements: !ruby/object:Gem::Requirement
150
150
  requirements:
151
151
  - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: '1.9'
153
+ version: '3.0'
154
154
  - !ruby/object:Gem::Dependency
155
- name: rubyzip
155
+ name: ruby-progressbar
156
156
  requirement: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - "~>"
159
159
  - !ruby/object:Gem::Version
160
- version: '1.2'
160
+ version: '1.9'
161
161
  type: :runtime
162
162
  prerelease: false
163
163
  version_requirements: !ruby/object:Gem::Requirement
164
164
  requirements:
165
165
  - - "~>"
166
166
  - !ruby/object:Gem::Version
167
- version: '1.2'
167
+ version: '1.9'
168
168
  - !ruby/object:Gem::Dependency
169
- name: sqlite3
169
+ name: rubyzip
170
170
  requirement: !ruby/object:Gem::Requirement
171
171
  requirements:
172
- - - "~>"
172
+ - - ">="
173
173
  - !ruby/object:Gem::Version
174
- version: '1.3'
174
+ version: 1.2.2
175
175
  type: :runtime
176
176
  prerelease: false
177
177
  version_requirements: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - "~>"
179
+ - - ">="
180
180
  - !ruby/object:Gem::Version
181
- version: '1.3'
181
+ version: 1.2.2
182
182
  - !ruby/object:Gem::Dependency
183
- name: trollop
183
+ name: sqlite3
184
184
  requirement: !ruby/object:Gem::Requirement
185
185
  requirements:
186
186
  - - "~>"
187
187
  - !ruby/object:Gem::Version
188
- version: '2.1'
188
+ version: '1.3'
189
189
  type: :runtime
190
190
  prerelease: false
191
191
  version_requirements: !ruby/object:Gem::Requirement
192
192
  requirements:
193
193
  - - "~>"
194
194
  - !ruby/object:Gem::Version
195
- version: '2.1'
195
+ version: '1.3'
196
196
  description: |
197
197
  Free US and world-wide postal codes in SQLite and CSV format.
198
198
  Automated zipcode/postal code aggregation and processing for any needs.
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
262
  version: '0'
263
263
  requirements: []
264
264
  rubyforge_project:
265
- rubygems_version: 2.7.3
265
+ rubygems_version: 2.7.6
266
266
  signing_key:
267
267
  specification_version: 4
268
268
  summary: Free US and world-wide postal codes in SQLite and CSV format