nearest_time_zone 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/lib/nearest_time_zone/dump.rb +4 -4
- data/lib/nearest_time_zone/version.rb +1 -1
- data/nearest_time_zone.gemspec +1 -6
- data/spec/city_spec.rb +8 -11
- data/spec/nearest_time_zone_spec.rb +3 -7
- data/spec/spec_helper.rb +0 -1
- data/spec/tasks_spec.rb +1 -4
- data/spec/time_zone_spec.rb +4 -8
- metadata +4 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd5ca0900265a6068315c41280dabf4f74664b8b
|
4
|
+
data.tar.gz: 1821c1057da5b18af61a88f0eff80ac94d78b556
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dff758fbf9b2ac0c8f6c8e8e5791a47887974a040f8431455446a4741edafdc2ffd27312d3b96b7cfcef47430f1d4bca524070c4638bc9e66a95844e3eb2bc0b
|
7
|
+
data.tar.gz: 3d59ce486ac86036ff7e8757dbd950efde76b8f04dd28ec5ee66e8a10ada649ba9d2dac3cc884c78055e08982ee9c6b5f561a38e7babb4048f99bf2cb4adabe9
|
data/.rspec
CHANGED
@@ -4,18 +4,18 @@ module NearestTimeZone
|
|
4
4
|
def self.dump
|
5
5
|
data_folder = "../../../data"
|
6
6
|
|
7
|
-
File.open(File.expand_path("#{data_folder}/cities.dump", __FILE__),"
|
7
|
+
File.open(File.expand_path("#{data_folder}/cities.dump", __FILE__),"wb") do |f|
|
8
8
|
f.write Marshal.dump(City.all)
|
9
9
|
end
|
10
10
|
|
11
|
-
File.open(File.expand_path("#{data_folder}/time_zones.dump", __FILE__),"
|
11
|
+
File.open(File.expand_path("#{data_folder}/time_zones.dump", __FILE__),"wb") do |f|
|
12
12
|
f.write Marshal.dump(TimeZone.all)
|
13
13
|
end
|
14
14
|
|
15
|
-
File.open(File.expand_path("#{data_folder}/kdtree.dump", __FILE__),"
|
15
|
+
File.open(File.expand_path("#{data_folder}/kdtree.dump", __FILE__),"wb") do |f|
|
16
16
|
City.kdtree.persist(f)
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
data/nearest_time_zone.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "nearest_time_zone"
|
8
8
|
spec.version = NearestTimeZone::VERSION
|
9
9
|
spec.authors = ["Sean Devine"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["barelyknown@icloud.com"]
|
11
11
|
spec.description = %q{Quickly find the name of a time zone for a latitude and longitude without relying on a web service.}
|
12
12
|
spec.summary = %q{Quickly find the name of a time zone for a latitude and longitude without relying on a web service.}
|
13
13
|
spec.homepage = ""
|
@@ -21,11 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "rspec"
|
24
|
-
spec.add_development_dependency "guard"
|
25
|
-
spec.add_development_dependency "guard-rspec"
|
26
|
-
spec.add_development_dependency "terminal-notifier-guard"
|
27
|
-
spec.add_development_dependency "rb-fsevent", '~> 0.9.1'
|
28
|
-
spec.add_development_dependency "debugger"
|
29
24
|
|
30
25
|
spec.add_dependency "require_all"
|
31
26
|
spec.add_dependency "kdtree"
|
data/spec/city_spec.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
module NearestTimeZone
|
4
2
|
describe City do
|
5
|
-
|
6
3
|
let(:id) { 321123 }
|
7
4
|
let(:latitude) { 12 }
|
8
5
|
let(:longitude) { 21 }
|
@@ -10,36 +7,36 @@ module NearestTimeZone
|
|
10
7
|
subject { City.new(id, latitude, longitude, time_zone_id) }
|
11
8
|
|
12
9
|
it "should have the right latitude" do
|
13
|
-
subject.latitude.
|
10
|
+
expect(subject.latitude).to eq latitude
|
14
11
|
end
|
15
12
|
|
16
13
|
it "should have the right longitude" do
|
17
|
-
subject.longitude.
|
14
|
+
expect(subject.longitude).to eq longitude
|
18
15
|
end
|
19
16
|
|
20
17
|
it "should have the right time zone id" do
|
21
|
-
subject.time_zone_id.
|
18
|
+
expect(subject.time_zone_id).to eq time_zone_id
|
22
19
|
end
|
23
20
|
|
24
21
|
it "the class should have a kdtree method" do
|
25
|
-
City.kdtree.
|
22
|
+
expect(City.kdtree).to be_a_kind_of Kdtree
|
26
23
|
end
|
27
24
|
|
28
25
|
it "should expose all the cities as a hash with the id as the key" do
|
29
|
-
City.all.first[0].
|
26
|
+
expect(City.all.first[0]).to be_a_kind_of Integer
|
30
27
|
end
|
31
28
|
|
32
29
|
it "should have a nearest method that finds the right city" do
|
33
|
-
City.nearest(37.2,68.9).
|
30
|
+
expect(City.nearest(37.2,68.9)).to eq City.find(220)
|
34
31
|
end
|
35
32
|
|
36
33
|
it "should have a time zone" do
|
37
|
-
City.all.first[1].time_zone.
|
34
|
+
expect(City.all.first[1].time_zone).to be_a_kind_of TimeZone
|
38
35
|
end
|
39
36
|
|
40
37
|
it "should ask for the right time zone" do
|
41
38
|
city = City.all.first[1]
|
42
|
-
TimeZone.
|
39
|
+
expect(TimeZone).to receive(:find).with(city.time_zone_id)
|
43
40
|
city.time_zone
|
44
41
|
end
|
45
42
|
end
|
@@ -1,13 +1,9 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe NearestTimeZone do
|
4
|
-
|
5
2
|
it "should have the method to" do
|
6
|
-
expect { NearestTimeZone.to(1, 3) }.
|
3
|
+
expect { NearestTimeZone.to(1, 3) }.not_to raise_error
|
7
4
|
end
|
8
5
|
|
9
6
|
it "should find the time zone name nearest to coordinates" do
|
10
|
-
NearestTimeZone.to(41.8500, -87.6500).
|
7
|
+
expect(NearestTimeZone.to(41.8500, -87.6500)).to eq "America/Chicago"
|
11
8
|
end
|
12
|
-
|
13
|
-
end
|
9
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/tasks_spec.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
require 'spec_helper'
|
2
1
|
require 'rake'
|
3
|
-
|
4
2
|
module NearestTimeZone
|
5
3
|
describe 'rake tasks' do
|
6
4
|
before :all do
|
@@ -19,7 +17,6 @@ module NearestTimeZone
|
|
19
17
|
expect(Dump).to receive(:dump).and_call_original
|
20
18
|
run_rake_task
|
21
19
|
end
|
22
|
-
|
23
20
|
end
|
24
21
|
end
|
25
|
-
end
|
22
|
+
end
|
data/spec/time_zone_spec.rb
CHANGED
@@ -1,20 +1,16 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
module NearestTimeZone
|
4
2
|
describe TimeZone do
|
5
|
-
|
6
3
|
it "should expose all of the time zones with a hash with ids as keys" do
|
7
|
-
TimeZone.all.first[0].
|
4
|
+
expect(TimeZone.all.first[0]).to be_a_kind_of Integer
|
8
5
|
end
|
9
6
|
|
10
7
|
it "should expose all of the time zones as a hash with time zone objects as values" do
|
11
|
-
TimeZone.all.first[1].
|
8
|
+
expect(TimeZone.all.first[1]).to be_a_kind_of TimeZone
|
12
9
|
end
|
13
10
|
|
14
11
|
it "should have the class method find that returns the right time zone" do
|
15
12
|
id = TimeZone.all.first[0]
|
16
|
-
TimeZone.find(id).
|
13
|
+
expect(TimeZone.find(id)).to eq TimeZone.all.first[1]
|
17
14
|
end
|
18
|
-
|
19
15
|
end
|
20
|
-
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nearest_time_zone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Devine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,76 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: guard
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: guard-rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: terminal-notifier-guard
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rb-fsevent
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.9.1
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.9.1
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: debugger
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
55
|
- !ruby/object:Gem::Dependency
|
126
56
|
name: require_all
|
127
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,7 +97,7 @@ dependencies:
|
|
167
97
|
description: Quickly find the name of a time zone for a latitude and longitude without
|
168
98
|
relying on a web service.
|
169
99
|
email:
|
170
|
-
-
|
100
|
+
- barelyknown@icloud.com
|
171
101
|
executables: []
|
172
102
|
extensions: []
|
173
103
|
extra_rdoc_files: []
|
@@ -214,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
144
|
version: '0'
|
215
145
|
requirements: []
|
216
146
|
rubyforge_project:
|
217
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.4.5
|
218
148
|
signing_key:
|
219
149
|
specification_version: 4
|
220
150
|
summary: Quickly find the name of a time zone for a latitude and longitude without
|