campfire_logic 1.1.8 → 1.1.9
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 +2 -1
- data/Gemfile.local +2 -2
- data/VERSION +1 -1
- data/app/models/location_import.rb +6 -6
- data/campfire_logic.gemspec +9 -6
- data/spec/models/locale_spec.rb +35 -43
- metadata +38 -24
data/Gemfile
CHANGED
data/Gemfile.local
CHANGED
@@ -2,7 +2,7 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'bson_ext'
|
4
4
|
gem 'fastercsv'
|
5
|
-
gem 'google_maps_geocoder'
|
5
|
+
gem 'google_maps_geocoder', :path => '~/Documents/projects/google_maps_geocoder'
|
6
6
|
gem 'mongoid-tree'
|
7
7
|
gem 'rails', '3.0.10'
|
8
8
|
gem 'scaffold_logic', :path => '~/Documents/projects/scaffold_logic'
|
@@ -20,4 +20,4 @@ group :test do
|
|
20
20
|
gem 'launchy'
|
21
21
|
gem 'mocha'
|
22
22
|
gem 'rspec-rails'
|
23
|
-
end
|
23
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.9
|
@@ -14,7 +14,7 @@ class LocationImport < ScaffoldLogic::DataImport
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def process_row
|
17
|
-
@required_fields ||= [:'
|
17
|
+
@required_fields ||= [:'location_#']
|
18
18
|
|
19
19
|
if valid_row? && _location = Location.find_or_initialize_by(:location_number => row_map[@required_fields.first])
|
20
20
|
COLUMNS_BY_MODEL_FIELDS.keys.each do |_field|
|
@@ -33,14 +33,14 @@ class LocationImport < ScaffoldLogic::DataImport
|
|
33
33
|
protected
|
34
34
|
|
35
35
|
COLUMNS_BY_MODEL_FIELDS = {
|
36
|
-
'location_number' => 'row_map[:"
|
36
|
+
'location_number' => 'row_map[:"location_#"]',
|
37
37
|
'name' => 'row_map[:"name"]',
|
38
|
-
'address1' => 'row_map[:"
|
39
|
-
'address2' => 'row_map[:"
|
38
|
+
'address1' => 'row_map[:"address_1"]',
|
39
|
+
'address2' => 'row_map[:"address_2"]',
|
40
40
|
'city' => 'row_map[:"city"]',
|
41
41
|
'state' => 'row_map[:"state"]',
|
42
|
-
'zip' => 'row_map[:"
|
43
|
-
'country' => 'row_map[:"
|
42
|
+
'zip' => 'row_map[:"postal_code"]',
|
43
|
+
'country' => 'row_map[:"country_code"]',
|
44
44
|
'phone' => 'row_map[:"phone"]',
|
45
45
|
'email' => 'row_map[:"email"]',
|
46
46
|
'meta_description' => 'row_map[:"description"]'
|
data/campfire_logic.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "campfire_logic"
|
8
|
-
s.version = "1.1.
|
8
|
+
s.version = "1.1.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Roderick Monje"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-01-12"
|
13
13
|
s.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."
|
14
14
|
s.email = "rod@seologic.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -141,7 +141,7 @@ Gem::Specification.new do |s|
|
|
141
141
|
]
|
142
142
|
s.homepage = "http://github.com/ivanoblomov/campfire_logic"
|
143
143
|
s.require_paths = ["lib"]
|
144
|
-
s.rubygems_version = "1.8.
|
144
|
+
s.rubygems_version = "1.8.11"
|
145
145
|
s.summary = "Rails engine that adds a location directory to your web app"
|
146
146
|
|
147
147
|
if s.respond_to? :specification_version then
|
@@ -151,8 +151,9 @@ Gem::Specification.new do |s|
|
|
151
151
|
s.add_runtime_dependency(%q<bson_ext>, [">= 0"])
|
152
152
|
s.add_runtime_dependency(%q<fastercsv>, [">= 0"])
|
153
153
|
s.add_runtime_dependency(%q<google_maps_geocoder>, [">= 0"])
|
154
|
+
s.add_runtime_dependency(%q<mongoid>, ["< 2.4"])
|
154
155
|
s.add_runtime_dependency(%q<mongoid-tree>, [">= 0"])
|
155
|
-
s.add_runtime_dependency(%q<rails>, ["
|
156
|
+
s.add_runtime_dependency(%q<rails>, ["~> 3.1"])
|
156
157
|
s.add_runtime_dependency(%q<scaffold_logic>, [">= 0"])
|
157
158
|
s.add_runtime_dependency(%q<stateflow>, [">= 0"])
|
158
159
|
s.add_runtime_dependency(%q<stringex>, [">= 0"])
|
@@ -162,8 +163,9 @@ Gem::Specification.new do |s|
|
|
162
163
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
163
164
|
s.add_dependency(%q<fastercsv>, [">= 0"])
|
164
165
|
s.add_dependency(%q<google_maps_geocoder>, [">= 0"])
|
166
|
+
s.add_dependency(%q<mongoid>, ["< 2.4"])
|
165
167
|
s.add_dependency(%q<mongoid-tree>, [">= 0"])
|
166
|
-
s.add_dependency(%q<rails>, ["
|
168
|
+
s.add_dependency(%q<rails>, ["~> 3.1"])
|
167
169
|
s.add_dependency(%q<scaffold_logic>, [">= 0"])
|
168
170
|
s.add_dependency(%q<stateflow>, [">= 0"])
|
169
171
|
s.add_dependency(%q<stringex>, [">= 0"])
|
@@ -174,8 +176,9 @@ Gem::Specification.new do |s|
|
|
174
176
|
s.add_dependency(%q<bson_ext>, [">= 0"])
|
175
177
|
s.add_dependency(%q<fastercsv>, [">= 0"])
|
176
178
|
s.add_dependency(%q<google_maps_geocoder>, [">= 0"])
|
179
|
+
s.add_dependency(%q<mongoid>, ["< 2.4"])
|
177
180
|
s.add_dependency(%q<mongoid-tree>, [">= 0"])
|
178
|
-
s.add_dependency(%q<rails>, ["
|
181
|
+
s.add_dependency(%q<rails>, ["~> 3.1"])
|
179
182
|
s.add_dependency(%q<scaffold_logic>, [">= 0"])
|
180
183
|
s.add_dependency(%q<stateflow>, [">= 0"])
|
181
184
|
s.add_dependency(%q<stringex>, [">= 0"])
|
data/spec/models/locale_spec.rb
CHANGED
@@ -1,64 +1,56 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Locale do
|
4
|
-
before
|
4
|
+
before :all do
|
5
5
|
Locale.delete_all
|
6
6
|
Locale.init_root
|
7
|
-
end
|
8
|
-
|
9
|
-
before(:each) do
|
10
7
|
GoogleMapsGeocoder.stubs(:new).returns(stub('prospect park zoo', :city => 'Brooklyn', :country_long_name => 'United States', :country_short_name => 'US', :formatted_address => '450 Flatbush Avenue', :formatted_street_address => '450 Flatbush Avenue', :lat => 1, :lng => 1, :partial_match? => false, :postal_code => '11217', :state_long_name => 'New York', :state_short_name => 'NY'))
|
11
|
-
location = Location.new
|
8
|
+
location = Location.new :address1 => '450 Flatbush Avenue', :city => 'Brooklyn', :name => 'Prospect Park Zoo', :state => 'NY'
|
12
9
|
location.validate_address!
|
13
10
|
location.localize
|
14
|
-
@locale = location.locale
|
15
11
|
end
|
16
12
|
|
17
|
-
it '
|
18
|
-
Locale.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
Locale.us.first.name.should == 'United States'
|
13
|
+
it 'can skip geocoding on creation' do
|
14
|
+
locale = Locale.new :name => 'White House', :skip_geocoding => true
|
15
|
+
locale.stubs :save
|
16
|
+
locale.save
|
17
|
+
locale.geocoded?.should be_false
|
23
18
|
end
|
24
19
|
|
25
|
-
|
26
|
-
|
20
|
+
context 'when root' do
|
21
|
+
subject { Locale.root }
|
22
|
+
specify{ subject.name.should == 'Earth' }
|
23
|
+
specify{ subject.should be_planet }
|
27
24
|
end
|
28
25
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
context 'when country' do
|
27
|
+
subject { Locale.us.first }
|
28
|
+
specify { subject.name.should == 'United States' }
|
29
|
+
specify { subject.should be_country }
|
30
|
+
specify { subject.geocoding_address.should == 'United States' }
|
34
31
|
end
|
35
32
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
context 'when state' do
|
34
|
+
subject { Locale.states.first }
|
35
|
+
specify { subject.name.should == 'New York' }
|
36
|
+
specify { subject.should be_state }
|
37
|
+
specify { subject.geocoding_address.should == 'New York' }
|
38
|
+
specify { subject.friendly_name.should == 'New York' }
|
40
39
|
end
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
context 'when city' do
|
42
|
+
subject { Locale.cities.first }
|
43
|
+
specify { subject.name.should == 'Brooklyn' }
|
44
|
+
specify { subject.should be_city }
|
45
|
+
specify { subject.geocoding_address.should == 'Brooklyn New York' }
|
46
|
+
specify { subject.friendly_name.should == 'Brooklyn, New York' }
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'returns a friendly name for a state' do
|
58
|
-
state = Locale.states.first
|
59
|
-
state.friendly_name.should == state.name
|
60
|
-
end
|
61
|
-
|
49
|
+
context 'when location' do
|
50
|
+
subject { Locale.locations.first }
|
51
|
+
specify { subject.name.should == 'Prospect Park Zoo' }
|
52
|
+
specify { subject.should be_location }
|
53
|
+
specify { subject.geocoding_address.should be_nil }
|
54
|
+
specify { subject.to_url.should =~ /united-states\/new-york\/brooklyn\/prospect-park-zoo$/ }
|
62
55
|
end
|
63
|
-
|
64
|
-
end
|
56
|
+
end
|
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: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 9
|
10
|
+
version: 1.1.9
|
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:
|
18
|
+
date: 2012-01-12 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: bson_ext
|
@@ -60,9 +60,24 @@ dependencies:
|
|
60
60
|
type: :runtime
|
61
61
|
version_requirements: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: mongoid
|
63
|
+
name: mongoid
|
64
64
|
prerelease: false
|
65
65
|
requirement: &id004 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - <
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
hash: 11
|
71
|
+
segments:
|
72
|
+
- 2
|
73
|
+
- 4
|
74
|
+
version: "2.4"
|
75
|
+
type: :runtime
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: mongoid-tree
|
79
|
+
prerelease: false
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
66
81
|
none: false
|
67
82
|
requirements:
|
68
83
|
- - ">="
|
@@ -72,27 +87,26 @@ dependencies:
|
|
72
87
|
- 0
|
73
88
|
version: "0"
|
74
89
|
type: :runtime
|
75
|
-
version_requirements: *
|
90
|
+
version_requirements: *id005
|
76
91
|
- !ruby/object:Gem::Dependency
|
77
92
|
name: rails
|
78
93
|
prerelease: false
|
79
|
-
requirement: &
|
94
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
80
95
|
none: false
|
81
96
|
requirements:
|
82
|
-
- -
|
97
|
+
- - ~>
|
83
98
|
- !ruby/object:Gem::Version
|
84
|
-
hash:
|
99
|
+
hash: 5
|
85
100
|
segments:
|
86
101
|
- 3
|
87
|
-
-
|
88
|
-
|
89
|
-
version: 3.0.10
|
102
|
+
- 1
|
103
|
+
version: "3.1"
|
90
104
|
type: :runtime
|
91
|
-
version_requirements: *
|
105
|
+
version_requirements: *id006
|
92
106
|
- !ruby/object:Gem::Dependency
|
93
107
|
name: scaffold_logic
|
94
108
|
prerelease: false
|
95
|
-
requirement: &
|
109
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
96
110
|
none: false
|
97
111
|
requirements:
|
98
112
|
- - ">="
|
@@ -102,11 +116,11 @@ dependencies:
|
|
102
116
|
- 0
|
103
117
|
version: "0"
|
104
118
|
type: :runtime
|
105
|
-
version_requirements: *
|
119
|
+
version_requirements: *id007
|
106
120
|
- !ruby/object:Gem::Dependency
|
107
121
|
name: stateflow
|
108
122
|
prerelease: false
|
109
|
-
requirement: &
|
123
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
110
124
|
none: false
|
111
125
|
requirements:
|
112
126
|
- - ">="
|
@@ -116,11 +130,11 @@ dependencies:
|
|
116
130
|
- 0
|
117
131
|
version: "0"
|
118
132
|
type: :runtime
|
119
|
-
version_requirements: *
|
133
|
+
version_requirements: *id008
|
120
134
|
- !ruby/object:Gem::Dependency
|
121
135
|
name: stringex
|
122
136
|
prerelease: false
|
123
|
-
requirement: &
|
137
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
124
138
|
none: false
|
125
139
|
requirements:
|
126
140
|
- - ">="
|
@@ -130,11 +144,11 @@ dependencies:
|
|
130
144
|
- 0
|
131
145
|
version: "0"
|
132
146
|
type: :runtime
|
133
|
-
version_requirements: *
|
147
|
+
version_requirements: *id009
|
134
148
|
- !ruby/object:Gem::Dependency
|
135
149
|
name: jeweler
|
136
150
|
prerelease: false
|
137
|
-
requirement: &
|
151
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
138
152
|
none: false
|
139
153
|
requirements:
|
140
154
|
- - ">="
|
@@ -144,11 +158,11 @@ dependencies:
|
|
144
158
|
- 0
|
145
159
|
version: "0"
|
146
160
|
type: :development
|
147
|
-
version_requirements: *
|
161
|
+
version_requirements: *id010
|
148
162
|
- !ruby/object:Gem::Dependency
|
149
163
|
name: rspec
|
150
164
|
prerelease: false
|
151
|
-
requirement: &
|
165
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
152
166
|
none: false
|
153
167
|
requirements:
|
154
168
|
- - ">="
|
@@ -160,7 +174,7 @@ dependencies:
|
|
160
174
|
- 9
|
161
175
|
version: 1.2.9
|
162
176
|
type: :development
|
163
|
-
version_requirements: *
|
177
|
+
version_requirements: *id011
|
164
178
|
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.
|
165
179
|
email: rod@seologic.com
|
166
180
|
executables: []
|
@@ -321,7 +335,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
321
335
|
requirements: []
|
322
336
|
|
323
337
|
rubyforge_project:
|
324
|
-
rubygems_version: 1.8.
|
338
|
+
rubygems_version: 1.8.11
|
325
339
|
signing_key:
|
326
340
|
specification_version: 3
|
327
341
|
summary: Rails engine that adds a location directory to your web app
|