free_zipcode_data 1.1.0 → 1.2.0
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/.dockerignore +10 -0
- data/.gitignore +1 -0
- data/CHANGELOG +6 -0
- data/Dockerfile +21 -0
- data/Gemfile.lock +1 -1
- data/README.md +35 -0
- data/docker-entrypoint.sh +14 -0
- data/lib/free_zipcode_data/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5a29b38bacdbf91fb1aad6732c0378eac3588a8bc9efd05c09b48470427da87e
|
|
4
|
+
data.tar.gz: 3b309917f7e87235ddc201f0db852d81b6f1310b85a32c18bc027600eceb34a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7d8e5b4a3b22359d46f3def15e4801d6ba39d70a8ec019bb1e302c6f98510b5fe6d0166bb7f9c2d8e35a3fda66572b4f4dbd6bc78a87874819864ea6225f8727
|
|
7
|
+
data.tar.gz: e26f46c2be8dfbb7f69c85a494de27a9607276e6958c56e58b4e63d20a2c9baca9da9fe95a35d4b3cb083f00f24bf0064e1be8aa815b1c6e417ed3cf32b48edd
|
data/.dockerignore
ADDED
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
*1.2.0* (February 17, 2026)
|
|
2
|
+
|
|
3
|
+
* Add Dockerfile for containerized data generation without requiring a local Ruby installation
|
|
4
|
+
* Add docker-entrypoint.sh with COUNTRY environment variable support and input validation
|
|
5
|
+
* Add .dockerignore to keep Docker build context lean
|
|
6
|
+
|
|
1
7
|
*1.1.0* (February 14, 2026)
|
|
2
8
|
|
|
3
9
|
* Fix state abbreviation uniqueness: state lookups are now scoped by country, allowing the same abbreviation (e.g., "NY") in different countries
|
data/Dockerfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
FROM ruby:3.4-slim
|
|
2
|
+
|
|
3
|
+
RUN apt-get update && \
|
|
4
|
+
apt-get install -y --no-install-recommends build-essential git pkg-config && \
|
|
5
|
+
rm -rf /var/lib/apt/lists/*
|
|
6
|
+
|
|
7
|
+
WORKDIR /app
|
|
8
|
+
|
|
9
|
+
COPY Gemfile Gemfile.lock free_zipcode_data.gemspec .ruby-version ./
|
|
10
|
+
COPY lib/free_zipcode_data/version.rb lib/free_zipcode_data/version.rb
|
|
11
|
+
RUN git init && git add . && \
|
|
12
|
+
bundle config set --local without development && \
|
|
13
|
+
bundle install
|
|
14
|
+
|
|
15
|
+
COPY . .
|
|
16
|
+
RUN git add .
|
|
17
|
+
|
|
18
|
+
ENV COUNTRY=""
|
|
19
|
+
VOLUME /output
|
|
20
|
+
|
|
21
|
+
ENTRYPOINT ["./docker-entrypoint.sh"]
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -105,6 +105,41 @@ create table zipcodes (
|
|
|
105
105
|
|
|
106
106
|
Both `lat` and `lon`, geocodes, are populated for each zipcode record.
|
|
107
107
|
|
|
108
|
+
## Docker
|
|
109
|
+
|
|
110
|
+
If you prefer not to install Ruby locally, you can use Docker to generate the database. You only need [Docker](https://docs.docker.com/get-docker/) installed.
|
|
111
|
+
|
|
112
|
+
### Build the image
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
$ git clone https://github.com/midwire/free_zipcode_data.git
|
|
116
|
+
$ cd free_zipcode_data
|
|
117
|
+
$ docker build -t free_zipcode_data .
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Generate data
|
|
121
|
+
|
|
122
|
+
Use the `COUNTRY` environment variable to specify a 2-letter country code. Omit it to process all available countries.
|
|
123
|
+
|
|
124
|
+
**Single country (e.g., US):**
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
$ docker run --rm -v $(pwd)/output:/output -e COUNTRY=US free_zipcode_data
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**All countries:**
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
$ docker run --rm -v $(pwd)/output:/output free_zipcode_data
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
The following files will be written to the `./output/` directory on your host:
|
|
137
|
+
|
|
138
|
+
* `free_zipcode_data.sqlite3` - SQLite database with countries, states, counties, and zipcodes tables
|
|
139
|
+
* `countries.csv`, `states.csv`, `counties.csv`, `zipcodes.csv` - CSV exports of each table
|
|
140
|
+
|
|
141
|
+
Look up supported country codes at [GeoNames](http://download.geonames.org/export/zip/).
|
|
142
|
+
|
|
108
143
|
## Data License
|
|
109
144
|
|
|
110
145
|
The zipcode data is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>, carried forward from [GeoNames](http://www.geonames.org).<br />
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
args=(--work-dir /output --generate-files --clobber)
|
|
5
|
+
|
|
6
|
+
if [ -n "${COUNTRY:-}" ]; then
|
|
7
|
+
if [[ ! "$COUNTRY" =~ ^[A-Z]{2}$ ]]; then
|
|
8
|
+
echo "Error: COUNTRY must be a 2-letter uppercase code (e.g., US, AD)" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
args+=(--country "$COUNTRY")
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
exec bundle exec ruby bin/free_zipcode_data "${args[@]}"
|
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.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Blackburn
|
|
@@ -133,6 +133,7 @@ executables:
|
|
|
133
133
|
extensions: []
|
|
134
134
|
extra_rdoc_files: []
|
|
135
135
|
files:
|
|
136
|
+
- ".dockerignore"
|
|
136
137
|
- ".gitignore"
|
|
137
138
|
- ".rspec"
|
|
138
139
|
- ".rubocop.yml"
|
|
@@ -141,6 +142,7 @@ files:
|
|
|
141
142
|
- CLAUDE.md
|
|
142
143
|
- CODE_OF_CONDUCT.md
|
|
143
144
|
- CONTRIBUTING.md
|
|
145
|
+
- Dockerfile
|
|
144
146
|
- Gemfile
|
|
145
147
|
- Gemfile.lock
|
|
146
148
|
- ISSUE_TEMPLATE.md
|
|
@@ -155,6 +157,7 @@ files:
|
|
|
155
157
|
- bin/free_zipcode_data
|
|
156
158
|
- counties_states_zipcodes.sql
|
|
157
159
|
- country_lookup_table.yml
|
|
160
|
+
- docker-entrypoint.sh
|
|
158
161
|
- free_zipcode_data.gemspec
|
|
159
162
|
- lib/etl/common.rb
|
|
160
163
|
- lib/etl/csv_source.rb
|