ziptz 2.1.8 → 3.0.18

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: 5dd97f760f0ba59d304c4444d9a156117ec7a0603d329d0c176a7c39d75c7e8e
4
- data.tar.gz: 1505f07dc5662e8d0952589011006dbdc60705739e829822a676f3d2640a74a2
3
+ metadata.gz: 8584f30a48d305cf57165059fdf89bc90ff1169b540b07e4810dd08facf3bb76
4
+ data.tar.gz: 974d31d4c7ab3f17e7e5bf86d875eca5b29f9d44087a09ae9b83c4694fd68945
5
5
  SHA512:
6
- metadata.gz: 420bf9382484a923daa55b062ca4e2493959d532b58c0363e82ed767a87683217e939fb1be7ddefe194fa48ab570ffabfa1db7d6b36c668329c661398dead825
7
- data.tar.gz: add80be0a28baaa305a18af687ec51887942b16b402e6c78847d0797149d7c9cd91c008fe53fa3054428fe3853ea7f12dbc85d00d8b9f16fcc4b60d94f011ddb
6
+ metadata.gz: e12dbe849abc336a65894be858be518433b97b9b9ac2622581534b7da9078de2f10fe21270dfed58cee58bb7a0f2003f40f86d9d3e1dcf662cad952dd2e41e20
7
+ data.tar.gz: dd9b487f4a8a868e07c39837732433662879696f12378666d700a69ed561743e47dd5a0bd607b87e381b7abe63ffe6d36ebfba61a7efc848e95fedfd7cf4f0f8
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015-2020 Keith Morrison <keithm@infused.org>
1
+ Copyright (c) 2015-2023 Keith Morrison <keithm@infused.org>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,12 +1,18 @@
1
1
  # Ziptz
2
2
  [![Version](http://img.shields.io/gem/v/ziptz.svg?style=flat)](https://rubygems.org/gems/ziptz)
3
- [![Build Status](http://img.shields.io/travis/infused/ziptz/master.svg?style=flat)](http://travis-ci.org/infused/ziptz)
3
+ [![Build Status](https://github.com/infused/ziptz/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/infused/ziptz/actions/workflows/build.yml)
4
4
  [![Total Downloads](https://img.shields.io/gem/dt/ziptz.svg)](https://rubygems.org/gems/ziptz/)
5
5
  [![License](https://img.shields.io/github/license/infused/ziptz.svg)](https://github.com/infused/ziptz)
6
6
 
7
- Get time zone and daylight saving time for any US ZIP code.
7
+ Get time zone, daylight saving time, and base offset for any US ZIP code.
8
8
 
9
- <i>ZIP codes are up to date as of <b>July 2020</b>.</i>
9
+ <i>ZIP codes are up to date as of <b>July 2023</b>.</i>
10
+
11
+ ## Compatibility
12
+
13
+ Ziptz is tested to work with the following versions of Ruby:
14
+
15
+ * Ruby 2.3.x, 2.4.x, 2.5.x, 2.6.x, 2.7.x, 3.x
10
16
 
11
17
  ## Installation
12
18
 
@@ -24,7 +30,7 @@ Get the time zone name for any ZIP code:
24
30
 
25
31
  Get the time zone offset for any ZIP code:
26
32
 
27
- z.time_zone_offset('97213') #=> -8
33
+ z.time_zone_offset('97213') #=> -28800
28
34
 
29
35
  <em>Note that offsets do not include daylight saving time.</em>
30
36
 
@@ -34,28 +40,106 @@ Determine if the ZIP code uses Daylight Saving Time:
34
40
 
35
41
  Get all the zip codes in a time zone:
36
42
 
37
- z.zips('Pacific/Pago_Pago') #=> ["96799", "96941", "96942", "96943", "96944"]
43
+ z.zips('Pacific/Chuuk') #=> ["96942", "96943"]
38
44
 
39
45
 
40
46
  ## Supported Time Zones
41
47
 
42
- * "America/Puerto_Rico" UTC -04:00
43
- * "America/New_York" UTC -05:00
44
- * "America/Chicago" UTC -06:00
45
- * "America/Denver" UTC -07:00
46
- * "America/Phoenix" UTC -07:00
47
- * "America/Los_Angeles" UTC -08:00
48
- * "America/Anchorage" UTC -09:00
49
- * "America/Adak" UTC -10:00
50
- * "Pacific/Honolulu" UTC -10:00
51
- * "Pacific/Pago_Pago" UTC -11:00
52
- * "Pacific/Majuro" UTC +12:00
53
- * "Pacific/Guam" UTC +10:00
54
- * "Pacific/Palau" UTC +09:00
55
- * "Pacific/Pohnpei" UTC +11:00
48
+ * America/Adak
49
+ * America/Anchorage
50
+ * America/Boise
51
+ * America/Chicago
52
+ * America/Denver
53
+ * America/Detroit
54
+ * America/Indiana/Indianapolis
55
+ * America/Indiana/Knox
56
+ * America/Indiana/Marengo
57
+ * America/Indiana/Petersburg
58
+ * America/Indiana/Tell_City
59
+ * America/Indiana/Vevay
60
+ * America/Indiana/Vincennes
61
+ * America/Indiana/Winamac
62
+ * America/Juneau
63
+ * America/Kentucky/Louisville
64
+ * America/Kentucky/Monticello
65
+ * America/Los_Angeles
66
+ * America/Menominee
67
+ * America/Metlakatla
68
+ * America/New_York
69
+ * America/Nome
70
+ * America/North_Dakota/Beulah
71
+ * America/North_Dakota/Center
72
+ * America/North_Dakota/New_Salem
73
+ * America/Phoenix
74
+ * America/Puerto_Rico
75
+ * America/Sitka
76
+ * America/St_Thomas
77
+ * America/Yakutat
78
+ * Pacific/Chuuk
79
+ * Pacific/Guam
80
+ * Pacific/Honolulu
81
+ * Pacific/Kosrae
82
+ * Pacific/Kwajalein
83
+ * Pacific/Majuro
84
+ * Pacific/Pago_Pago
85
+ * Pacific/Palau
86
+ * Pacific/Pohnpei
87
+ * Pacific/Saipan
88
+ * Pacific/Wake
56
89
 
57
90
  <em>Note that APO/FPO zip codes will not return a known time zone offset.</em>
58
91
 
92
+ ## Prefer raw data?
93
+
94
+ If you would prefer raw data instead of a gem, see my [ZIP Code Time Zones](https://us-west-2.console.aws.amazon.com/dataexchange/home#/products/prodview-4vcapflqwntdw) product on AWS Data Exchange to subscribe.
95
+
96
+ ## Version 3 breaking changes
97
+
98
+ * APO, DPO, and FPO zip codes are no longer included, because they are non-geographic.
99
+ * Time zone offsets are now specified in seconds instead of hours.
100
+ * Time zone are now more granular. The full list of time zones is:
101
+ * America/Adak
102
+ * America/Anchorage
103
+ * America/Boise
104
+ * America/Chicago
105
+ * America/Denver
106
+ * America/Detroit
107
+ * America/Indiana/Indianapolis
108
+ * America/Indiana/Knox
109
+ * America/Indiana/Marengo
110
+ * America/Indiana/Petersburg
111
+ * America/Indiana/Tell_City
112
+ * America/Indiana/Vevay
113
+ * America/Indiana/Vincennes
114
+ * America/Indiana/Winamac
115
+ * America/Juneau
116
+ * America/Kentucky/Louisville
117
+ * America/Kentucky/Monticello
118
+ * America/Los_Angeles
119
+ * America/Menominee
120
+ * America/Metlakatla
121
+ * America/New_York
122
+ * America/Nome
123
+ * America/North_Dakota/Beulah
124
+ * America/North_Dakota/Center
125
+ * America/North_Dakota/New_Salem
126
+ * America/Phoenix
127
+ * America/Puerto_Rico
128
+ * America/Sitka
129
+ * America/St_Thomas
130
+ * America/Yakutat
131
+ * Pacific/Chuuk
132
+ * Pacific/Guam
133
+ * Pacific/Honolulu
134
+ * Pacific/Kosrae
135
+ * Pacific/Kwajalein
136
+ * Pacific/Majuro
137
+ * Pacific/Pago_Pago
138
+ * Pacific/Palau
139
+ * Pacific/Pohnpei
140
+ * Pacific/Saipan
141
+ * Pacific/Wake
142
+
59
143
  ## Version 2 breaking changes
60
144
 
61
145
  Time zone names now reflect standard tz-database names.
@@ -76,7 +160,7 @@ Time zone names now reflect standard tz-database names.
76
160
 
77
161
  ## License
78
162
 
79
- Copyright (c) 2015-2020 Keith Morrison <<keithm@infused.org>>
163
+ Copyright (c) 2015-2023 Keith Morrison <<keithm@infused.org>>
80
164
 
81
165
  Permission is hereby granted, free of charge, to any person
82
166
  obtaining a copy of this software and associated documentation
data/data/tz.data CHANGED
Binary file
data/data/tzm.data ADDED
Binary file
data/lib/ziptz.rb CHANGED
@@ -1,41 +1,37 @@
1
1
  require 'yaml'
2
+ require 'zlib'
2
3
 
3
4
  class Ziptz
4
- VERSION = '2.1.8'.freeze
5
-
6
- TZ_INFO = {
7
- '0' => {name: 'APO/FPO (time zone unknown)', offset: 0},
8
- '4' => {name: 'America/Puerto_Rico', offset: -4},
9
- '5' => {name: 'America/New_York', offset: -5},
10
- '6' => {name: 'America/Chicago', offset: -6},
11
- '7' => {name: 'America/Denver', offset: -7},
12
- '8' => {name: 'America/Los_Angeles', offset: -8},
13
- '9' => {name: 'America/Anchorage', offset: -9},
14
- '10' => {name: 'Pacific/Honolulu', offset: -10},
15
- '11' => {name: 'Pacific/Pago_Pago', offset: -11},
16
- '13' => {name: 'Pacific/Majuro', offset: 12},
17
- '14' => {name: 'Pacific/Guam', offset: 10},
18
- '15' => {name: 'Pacific/Palau', offset: 9},
19
- '16' => {name: 'Pacific/Pohnpei', offset: 11},
20
- 'AZ' => {name: 'America/Phoenix', offset: -7},
21
- 'AD' => {name: 'America/Adak', offset: -10}
22
- }.freeze
5
+ VERSION = '3.0.18'.freeze
6
+
7
+ def self.instance
8
+ @instance ||= new
9
+ end
23
10
 
24
11
  def time_zone_name(zip)
25
- get_time_zone(zip)
12
+ tz_info = time_zone_info(zip)
13
+ return unless tz_info
14
+
15
+ tz_info[:tz]
26
16
  end
27
17
 
28
18
  def time_zone_offset(zip)
29
- tz = time_zone_info(zip)
30
- tz && tz[:offset]
19
+ tz_info = time_zone_info(zip)
20
+ return unless tz_info
21
+
22
+ tzm_info = tzm[tz_info[:tz]]
23
+ tzm_info[:offset] && tzm_info[:offset].to_i
31
24
  end
32
25
 
33
26
  def time_zone_uses_dst?(zip)
34
- dst[zip.to_s.slice(0, 5)]
27
+ tz_info = time_zone_info(zip)
28
+ return unless tz_info
29
+
30
+ tz_info[:dst]
35
31
  end
36
32
 
37
33
  def zips(tz_name)
38
- zips_by_code(tz_name)
34
+ tz.select { |_, v| v[:tz].downcase == tz_name.downcase }.keys
39
35
  end
40
36
 
41
37
  def inspect
@@ -44,45 +40,53 @@ class Ziptz
44
40
 
45
41
  protected
46
42
 
47
- def tz
48
- @tz ||= load_tz_data
43
+ def tzm
44
+ @tzm ||= load_tzm_data
49
45
  end
50
46
 
51
- def dst
52
- @dst ||= load_dst_data
47
+ def lazy_tz
48
+ @lazy_tz ||= lazy_load_tz_data
53
49
  end
54
50
 
55
- def zips_by_code(tz_code)
56
- tz.select { |_, v| v.match(/#{tz_code}/i) }.keys.sort
51
+ def tz
52
+ @tz ||= load_tz_data
57
53
  end
58
54
 
59
55
  def time_zone_info(zip)
60
- TZ_INFO.values.detect { |v| v[:name] == get_time_zone(zip) }
56
+ if (data = lazy_tz[zip.to_s.slice(0, 5)])
57
+ _, tz, dst = data.strip.split('|')
58
+ {tz: tz, dst: dst == '1'}
59
+ end
61
60
  end
62
61
 
63
- def get_time_zone(zip)
64
- tz[zip.to_s.slice(0, 5)]
62
+ def tzm_data_path
63
+ File.join(File.dirname(__FILE__), '..', 'data', 'tzm.data')
65
64
  end
66
65
 
67
66
  def tz_data_path
68
67
  File.join(File.dirname(__FILE__), '..', 'data', 'tz.data')
69
68
  end
70
69
 
71
- def load_tz_data
72
- File.foreach(tz_data_path).with_object({}) do |line, data|
73
- zip, tz = line.strip.split('=')
74
- data[zip] = tz
70
+ def lazy_load_tz_data
71
+ uncompressed = Zlib::Inflate.inflate(File.read(tz_data_path, encoding: 'ASCII-8BIT'))
72
+ uncompressed.each_line.with_object({}) do |line, data|
73
+ data[line.slice(0, 5)] = line
75
74
  end
76
75
  end
77
76
 
78
- def dst_data_path
79
- File.join(File.dirname(__FILE__), '..', 'data', 'dst.data')
77
+ def load_tz_data
78
+ uncompressed = Zlib::Inflate.inflate(File.read(tz_data_path, encoding: 'ASCII-8BIT'))
79
+ uncompressed.each_line.with_object({}) do |line, data|
80
+ zip, tz, dst = line.strip.split('|')
81
+ data[zip] = {tz: tz, dst: dst == '1'}
82
+ end
80
83
  end
81
84
 
82
- def load_dst_data
83
- File.foreach(dst_data_path).with_object({}) do |line, data|
84
- zip, dst = line.strip.split('=')
85
- data[zip] = dst == '1'
85
+ def load_tzm_data
86
+ uncompressed = Zlib::Inflate.inflate(File.read(tzm_data_path, encoding: 'ASCII-8BIT'))
87
+ uncompressed.each_line.with_object({}) do |line, data|
88
+ tz, offset = line.strip.split('|')
89
+ data[tz] = {offset: offset}
86
90
  end
87
91
  end
88
92
  end
data/spec/ziptz_spec.rb CHANGED
@@ -74,13 +74,13 @@ RSpec.describe Ziptz do
74
74
  describe '#time_zone_offset' do
75
75
  context 'when given a 5-digit zipcode' do
76
76
  it 'returns the time zone number' do
77
- expect(ziptz.time_zone_offset('97034')).to eq(-8)
77
+ expect(ziptz.time_zone_offset('97034')).to eq(-28800)
78
78
  end
79
79
  end
80
80
 
81
81
  context 'when given a 9-digit zipcode' do
82
82
  it 'returns the time zone number' do
83
- expect(ziptz.time_zone_offset('97034-1234')).to eq(-8)
83
+ expect(ziptz.time_zone_offset('97034-1234')).to eq(-28800)
84
84
  end
85
85
  end
86
86
 
@@ -106,4 +106,18 @@ RSpec.describe Ziptz do
106
106
  end
107
107
  end
108
108
  end
109
+
110
+ describe '#instance' do
111
+ context 'when given a 5 digit zip code' do
112
+ it 'matches the behavior of Ziptz.new' do
113
+ expect(Ziptz.instance.time_zone_name('97034')).to eq ziptz.time_zone_name('97034')
114
+ end
115
+ end
116
+
117
+ context 'when called twice' do
118
+ it 'returns identical instances' do
119
+ expect(Ziptz.instance.object_id).to eq Ziptz.instance.object_id
120
+ end
121
+ end
122
+ end
109
123
  end
data/ziptz.gemspec CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.rdoc_options = ['--charset=UTF-8']
15
15
  s.extra_rdoc_files = ['README.md', 'LICENSE']
16
- s.files = Dir['[A-Z]*', '{data,lib,spec}/**/*', 'ziptz.gemspec']
17
- s.test_files = Dir.glob('spec/**/*_spec.rb')
16
+ s.files = Dir['README.md', 'LICENSE', '{data,lib,spec}/**/*', 'ziptz.gemspec']
18
17
  s.require_paths = ['lib']
19
18
  s.required_ruby_version = '>= 2.0.0'
19
+ s.metadata['rubygems_mfa_required'] = 'true'
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ziptz
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 3.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keith Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-03 00:00:00.000000000 Z
11
+ date: 2023-10-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Get timezone info for all 5-digit US zip codes
14
14
  email: keithm@infused.org
@@ -18,17 +18,10 @@ extra_rdoc_files:
18
18
  - README.md
19
19
  - LICENSE
20
20
  files:
21
- - Gemfile
22
- - Gemfile.lock
23
- - Gemfile.travis
24
- - Guardfile
25
21
  - LICENSE
26
22
  - README.md
27
- - Rakefile
28
- - data/dst.data
29
23
  - data/tz.data
30
- - database.yml
31
- - lib/zip_code.rb
24
+ - data/tzm.data
32
25
  - lib/ziptz.rb
33
26
  - spec/spec_helper.rb
34
27
  - spec/ziptz_spec.rb
@@ -36,7 +29,8 @@ files:
36
29
  homepage: http://github.com/infused/ziptz
37
30
  licenses:
38
31
  - MIT
39
- metadata: {}
32
+ metadata:
33
+ rubygems_mfa_required: 'true'
40
34
  post_install_message:
41
35
  rdoc_options:
42
36
  - "--charset=UTF-8"
@@ -53,9 +47,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
47
  - !ruby/object:Gem::Version
54
48
  version: '0'
55
49
  requirements: []
56
- rubygems_version: 3.0.6
50
+ rubygems_version: 3.4.10
57
51
  signing_key:
58
52
  specification_version: 4
59
53
  summary: TimeZone info for any 5-digit US zip code
60
- test_files:
61
- - spec/ziptz_spec.rb
54
+ test_files: []
data/Gemfile DELETED
@@ -1,18 +0,0 @@
1
- gemspec
2
- source 'https://rubygems.org'
3
-
4
- group :development, :test do
5
- gem 'activerecord'
6
- gem 'bundler'
7
- gem 'byebug'
8
- gem 'guard'
9
- gem 'guard-rspec'
10
- gem 'irb'
11
- gem 'mysql2'
12
- gem 'rake'
13
- gem 'rspec'
14
- gem 'rubocop'
15
- gem 'rubocop-performance'
16
- gem 'rubocop-rspec'
17
- gem 'tty-spinner'
18
- end
data/Gemfile.lock DELETED
@@ -1,123 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- ziptz (2.1.8)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- activemodel (6.0.0)
10
- activesupport (= 6.0.0)
11
- activerecord (6.0.0)
12
- activemodel (= 6.0.0)
13
- activesupport (= 6.0.0)
14
- activesupport (6.0.0)
15
- concurrent-ruby (~> 1.0, >= 1.0.2)
16
- i18n (>= 0.7, < 2)
17
- minitest (~> 5.1)
18
- tzinfo (~> 1.1)
19
- zeitwerk (~> 2.1, >= 2.1.8)
20
- ast (2.4.0)
21
- byebug (11.0.1)
22
- coderay (1.1.2)
23
- concurrent-ruby (1.1.5)
24
- diff-lcs (1.3)
25
- ffi (1.11.1)
26
- formatador (0.2.5)
27
- guard (2.15.1)
28
- formatador (>= 0.2.4)
29
- listen (>= 2.7, < 4.0)
30
- lumberjack (>= 1.0.12, < 2.0)
31
- nenv (~> 0.1)
32
- notiffany (~> 0.0)
33
- pry (>= 0.9.12)
34
- shellany (~> 0.0)
35
- thor (>= 0.18.1)
36
- guard-compat (1.2.1)
37
- guard-rspec (4.7.3)
38
- guard (~> 2.1)
39
- guard-compat (~> 1.1)
40
- rspec (>= 2.99.0, < 4.0)
41
- i18n (1.7.0)
42
- concurrent-ruby (~> 1.0)
43
- irb (1.0.0)
44
- jaro_winkler (1.5.3)
45
- listen (3.2.0)
46
- rb-fsevent (~> 0.10, >= 0.10.3)
47
- rb-inotify (~> 0.9, >= 0.9.10)
48
- lumberjack (1.0.13)
49
- method_source (0.9.2)
50
- minitest (5.12.2)
51
- mysql2 (0.5.2)
52
- nenv (0.3.0)
53
- notiffany (0.1.3)
54
- nenv (~> 0.1)
55
- shellany (~> 0.0)
56
- parallel (1.18.0)
57
- parser (2.6.5.0)
58
- ast (~> 2.4.0)
59
- pry (0.12.2)
60
- coderay (~> 1.1.0)
61
- method_source (~> 0.9.0)
62
- rainbow (3.0.0)
63
- rake (13.0.0)
64
- rb-fsevent (0.10.3)
65
- rb-inotify (0.10.0)
66
- ffi (~> 1.0)
67
- rspec (3.9.0)
68
- rspec-core (~> 3.9.0)
69
- rspec-expectations (~> 3.9.0)
70
- rspec-mocks (~> 3.9.0)
71
- rspec-core (3.9.0)
72
- rspec-support (~> 3.9.0)
73
- rspec-expectations (3.9.0)
74
- diff-lcs (>= 1.2.0, < 2.0)
75
- rspec-support (~> 3.9.0)
76
- rspec-mocks (3.9.0)
77
- diff-lcs (>= 1.2.0, < 2.0)
78
- rspec-support (~> 3.9.0)
79
- rspec-support (3.9.0)
80
- rubocop (0.75.0)
81
- jaro_winkler (~> 1.5.1)
82
- parallel (~> 1.10)
83
- parser (>= 2.6)
84
- rainbow (>= 2.2.2, < 4.0)
85
- ruby-progressbar (~> 1.7)
86
- unicode-display_width (>= 1.4.0, < 1.7)
87
- rubocop-performance (1.5.0)
88
- rubocop (>= 0.71.0)
89
- rubocop-rspec (1.36.0)
90
- rubocop (>= 0.68.1)
91
- ruby-progressbar (1.10.1)
92
- shellany (0.0.1)
93
- thor (0.20.3)
94
- thread_safe (0.3.6)
95
- tty-cursor (0.7.0)
96
- tty-spinner (0.9.1)
97
- tty-cursor (~> 0.7)
98
- tzinfo (1.2.5)
99
- thread_safe (~> 0.1)
100
- unicode-display_width (1.6.0)
101
- zeitwerk (2.1.10)
102
-
103
- PLATFORMS
104
- ruby
105
-
106
- DEPENDENCIES
107
- activerecord
108
- bundler
109
- byebug
110
- guard
111
- guard-rspec
112
- irb
113
- mysql2
114
- rake
115
- rspec
116
- rubocop
117
- rubocop-performance
118
- rubocop-rspec
119
- tty-spinner
120
- ziptz!
121
-
122
- BUNDLED WITH
123
- 2.1.0.pre.2
data/Gemfile.travis DELETED
@@ -1,7 +0,0 @@
1
- gemspec
2
- source 'https://rubygems.org'
3
-
4
- group :test do
5
- gem 'bundler'
6
- gem 'rspec'
7
- end
data/Guardfile DELETED
@@ -1,8 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard :rspec, cmd: 'bundle exec rspec' do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { 'spec' }
8
- end
data/Rakefile DELETED
@@ -1,24 +0,0 @@
1
- require 'bundler/setup'
2
- Bundler.setup(:default, :development)
3
-
4
- require 'rspec/core/rake_task'
5
- RSpec::Core::RakeTask.new :spec do |t|
6
- t.rspec_opts = %w[--color]
7
- end
8
-
9
- RSpec::Core::RakeTask.new :specdoc do |t|
10
- t.rspec_opts = %w[-fl]
11
- end
12
-
13
- task default: :spec
14
-
15
- desc 'Open an irb session preloaded with this library'
16
- task :console do
17
- sh 'irb -r rubygems -I lib -r ziptz.rb'
18
- end
19
-
20
- desc 'Create ziptz db from zipcodes database'
21
- task :create_ziptz do
22
- require 'zip_code'
23
- ZipCode.import
24
- end