campfire_logic 1.1.10 → 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.
- data/Gemfile +4 -4
- data/Gemfile.local +4 -3
- data/VERSION +1 -1
- data/app/controllers/directory_controller.rb +1 -4
- data/app/models/geocoder_google_result.rb +106 -0
- data/app/models/locale.rb +9 -27
- data/app/models/location.rb +26 -31
- data/app/views/shared/_map.html.erb +4 -4
- data/campfire_logic.gemspec +14 -12
- data/config/environments/test.rb +1 -0
- data/config/initializers/geocoder.rb +5 -0
- data/db/seeds.rb +0 -2
- data/features/step_definitions/directory_steps.rb +0 -1
- data/spec/controllers/directory_controller_spec.rb +1 -1
- data/spec/models/locale_spec.rb +0 -1
- data/spec/models/location_spec.rb +3 -13
- metadata +38 -25
- data/app/models/zip_code.rb +0 -48
- data/app/models/zip_code_import.rb +0 -19
- data/db/zip_codes.txt +0 -42742
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: campfire_logic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 1.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Roderick Monje
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-01-
|
18
|
+
date: 2012-01-29 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bson_ext
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: geocoder
|
50
50
|
prerelease: false
|
51
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
type: :runtime
|
61
61
|
version_requirements: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: mongoid
|
63
|
+
name: mongoid-tree
|
64
64
|
prerelease: false
|
65
65
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
@@ -74,33 +74,33 @@ dependencies:
|
|
74
74
|
type: :runtime
|
75
75
|
version_requirements: *id004
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: rails
|
78
78
|
prerelease: false
|
79
79
|
requirement: &id005 !ruby/object:Gem::Requirement
|
80
80
|
none: false
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - ~>
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
hash:
|
84
|
+
hash: 7
|
85
85
|
segments:
|
86
|
+
- 3
|
86
87
|
- 0
|
87
|
-
|
88
|
+
- 0
|
89
|
+
version: 3.0.0
|
88
90
|
type: :runtime
|
89
91
|
version_requirements: *id005
|
90
92
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
93
|
+
name: redis
|
92
94
|
prerelease: false
|
93
95
|
requirement: &id006 !ruby/object:Gem::Requirement
|
94
96
|
none: false
|
95
97
|
requirements:
|
96
|
-
- -
|
98
|
+
- - ">="
|
97
99
|
- !ruby/object:Gem::Version
|
98
|
-
hash:
|
100
|
+
hash: 3
|
99
101
|
segments:
|
100
|
-
- 3
|
101
102
|
- 0
|
102
|
-
|
103
|
-
version: 3.0.0
|
103
|
+
version: "0"
|
104
104
|
type: :runtime
|
105
105
|
version_requirements: *id006
|
106
106
|
- !ruby/object:Gem::Dependency
|
@@ -146,7 +146,7 @@ dependencies:
|
|
146
146
|
type: :runtime
|
147
147
|
version_requirements: *id009
|
148
148
|
- !ruby/object:Gem::Dependency
|
149
|
-
name:
|
149
|
+
name: SystemTimer
|
150
150
|
prerelease: false
|
151
151
|
requirement: &id010 !ruby/object:Gem::Requirement
|
152
152
|
none: false
|
@@ -157,12 +157,26 @@ dependencies:
|
|
157
157
|
segments:
|
158
158
|
- 0
|
159
159
|
version: "0"
|
160
|
-
type: :
|
160
|
+
type: :runtime
|
161
161
|
version_requirements: *id010
|
162
162
|
- !ruby/object:Gem::Dependency
|
163
|
-
name:
|
163
|
+
name: jeweler
|
164
164
|
prerelease: false
|
165
165
|
requirement: &id011 !ruby/object:Gem::Requirement
|
166
|
+
none: false
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
hash: 3
|
171
|
+
segments:
|
172
|
+
- 0
|
173
|
+
version: "0"
|
174
|
+
type: :development
|
175
|
+
version_requirements: *id011
|
176
|
+
- !ruby/object:Gem::Dependency
|
177
|
+
name: rspec
|
178
|
+
prerelease: false
|
179
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
166
180
|
none: false
|
167
181
|
requirements:
|
168
182
|
- - ">="
|
@@ -174,7 +188,7 @@ dependencies:
|
|
174
188
|
- 9
|
175
189
|
version: 1.2.9
|
176
190
|
type: :development
|
177
|
-
version_requirements: *
|
191
|
+
version_requirements: *id012
|
178
192
|
description: Users can browse locations by country, city, and state and search locations by string or zip code. Administrators can manage locations and the services they offer.
|
179
193
|
email: rod@seologic.com
|
180
194
|
executables: []
|
@@ -194,12 +208,11 @@ files:
|
|
194
208
|
- app/controllers/locations_controller.rb
|
195
209
|
- app/controllers/services_controller.rb
|
196
210
|
- app/helpers/application_helper.rb
|
211
|
+
- app/models/geocoder_google_result.rb
|
197
212
|
- app/models/locale.rb
|
198
213
|
- app/models/location.rb
|
199
214
|
- app/models/location_import.rb
|
200
215
|
- app/models/service.rb
|
201
|
-
- app/models/zip_code.rb
|
202
|
-
- app/models/zip_code_import.rb
|
203
216
|
- app/views/directory/_search_form.html.erb
|
204
217
|
- app/views/directory/_show_children.html.erb
|
205
218
|
- app/views/directory/_show_location.html.erb
|
@@ -230,6 +243,7 @@ files:
|
|
230
243
|
- config/environment.rb
|
231
244
|
- config/environments/test.rb
|
232
245
|
- config/initializers/campfire_logic.rb
|
246
|
+
- config/initializers/geocoder.rb
|
233
247
|
- config/initializers/metric_fu.rb
|
234
248
|
- config/initializers/secret_token.rb
|
235
249
|
- config/initializers/session_store.rb
|
@@ -237,7 +251,6 @@ files:
|
|
237
251
|
- config/mongoid.yml
|
238
252
|
- config/routes.rb
|
239
253
|
- db/seeds.rb
|
240
|
-
- db/zip_codes.txt
|
241
254
|
- features/admin_manages_locations.feature
|
242
255
|
- features/customer_browses_directory.feature
|
243
256
|
- features/customer_searches_directory.feature
|
@@ -335,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
335
348
|
requirements: []
|
336
349
|
|
337
350
|
rubyforge_project:
|
338
|
-
rubygems_version: 1.8.
|
351
|
+
rubygems_version: 1.8.11
|
339
352
|
signing_key:
|
340
353
|
specification_version: 3
|
341
354
|
summary: Rails engine that adds a location directory to your web app
|
data/app/models/zip_code.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
class ZipCode
|
2
|
-
include Mongoid::Document
|
3
|
-
include Mongoid::Timestamps
|
4
|
-
|
5
|
-
# Attributes =====================================================================================
|
6
|
-
field :zip
|
7
|
-
field :city
|
8
|
-
field :state
|
9
|
-
field :county
|
10
|
-
field :lat_lng, :type => Array
|
11
|
-
index [[ :lat_lng, Mongo::GEO2D ]], :min => -200, :max => 200
|
12
|
-
|
13
|
-
# Indices ========================================================================================
|
14
|
-
|
15
|
-
# Constants ======================================================================================
|
16
|
-
|
17
|
-
# Scopes =========================================================================================
|
18
|
-
|
19
|
-
# Relationships ==================================================================================
|
20
|
-
|
21
|
-
# Behavior =======================================================================================
|
22
|
-
|
23
|
-
# Callbacks ======================================================================================
|
24
|
-
before_save :geocode
|
25
|
-
|
26
|
-
# Validations ====================================================================================
|
27
|
-
|
28
|
-
# Class methods ==================================================================================
|
29
|
-
|
30
|
-
# Instance methods ===============================================================================
|
31
|
-
|
32
|
-
# Geocodes this zip code.
|
33
|
-
def geocode
|
34
|
-
return if geocoded?
|
35
|
-
|
36
|
-
unless @geocoder
|
37
|
-
@geocoder = GoogleMapsGeocoder.new(self.zip)
|
38
|
-
self.city, self.state, self.county, self.lat_lng = @geocoder.city, @geocoder.state_short_name, @geocoder.county, [@geocoder.lat, @geocoder.lng], @geocoder.state_long_name
|
39
|
-
end
|
40
|
-
rescue SocketError
|
41
|
-
Rails.logger.error "Can't geocode without a network connection!"
|
42
|
-
end
|
43
|
-
|
44
|
-
# Returns true if this location has a latitude and longitude.
|
45
|
-
def geocoded?
|
46
|
-
self.lat_lng.is_a?(Array)
|
47
|
-
end
|
48
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class ZipCodeImport < ScaffoldLogic::DataImport
|
2
|
-
def self.save(upload)
|
3
|
-
# create file path
|
4
|
-
_path = File.join('tmp', upload['datafile'].original_filename)
|
5
|
-
|
6
|
-
# write file
|
7
|
-
File.open(_path, 'wb') { |f| f.write(upload['datafile'].read) }
|
8
|
-
|
9
|
-
self.run(_path)
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.test(path='db/zip_codes.txt')
|
13
|
-
self.run(path)
|
14
|
-
end
|
15
|
-
|
16
|
-
def process_row
|
17
|
-
zip = ZipCode.create :zip => row_map[:zip], :city => row_map[:city], :state => row_map[:state], :county => row_map[:zip_class], :lat_lng => [row_map[:latitude].to_f, row_map[:longitude].to_f]
|
18
|
-
end
|
19
|
-
end
|