campfire_logic 1.1.8 → 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,8 +3,9 @@ source 'http://rubygems.org'
3
3
  gem 'bson_ext'
4
4
  gem 'fastercsv'
5
5
  gem 'google_maps_geocoder'
6
+ gem 'mongoid', '< 2.4'
6
7
  gem 'mongoid-tree'
7
- gem 'rails', '3.0.10'
8
+ gem 'rails', '~> 3.1'
8
9
  gem 'scaffold_logic'
9
10
  gem 'stateflow'
10
11
  gem 'stringex'
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.8
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 ||= [:'location #']
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[:"location #"]',
36
+ 'location_number' => 'row_map[:"location_#"]',
37
37
  'name' => 'row_map[:"name"]',
38
- 'address1' => 'row_map[:"address 1"]',
39
- 'address2' => 'row_map[:"address 2"]',
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[:"postal code"]',
43
- 'country' => 'row_map[:"country code"]',
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"]'
@@ -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"
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 = "2011-11-30"
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.10"
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>, ["= 3.0.10"])
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>, ["= 3.0.10"])
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>, ["= 3.0.10"])
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"])
@@ -1,64 +1,56 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Locale do
4
- before(:all) do
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(:address1 => '450 Flatbush Avenue', :city => 'Brooklyn', :name => 'Prospect Park Zoo', :state => 'NY')
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 'inits the root locale' do
18
- Locale.root.name.should == 'Earth'
19
- end
20
-
21
- it 'inits a country locale' do
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
- it 'sets its slug' do
26
- @locale.to_url.include?('new-york/brooklyn/prospect-park-zoo').should be_true
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
- it 'returns an address for geocoding' do
30
- @locale.location.state_locale.parent.geocoding_address.should == 'United States'
31
- @locale.location.state_locale.geocoding_address.should == 'New York'
32
- @locale.location.city_locale.geocoding_address.should == 'Brooklyn New York'
33
- @locale.geocoding_address.should be_nil
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
- it 'returns its geographical kind' do
37
- @locale.kind.should == 'location'
38
- @locale.parent.kind.should == 'city'
39
- @locale.parent.parent.kind.should == 'state'
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
- it 'can skip geocoding on creation' do
43
- @locale = Locale.new :name => 'White House', :skip_geocoding => true
44
- @locale.stubs(:save)
45
- @locale.save
46
- @locale.geocoded?.should be_false
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
- describe "friendly names" do
50
-
51
- it 'returns a friendly name for a city' do
52
- city = Locale.cities.first
53
- city.friendly_name.should =~ /#{city.name}/
54
- city.friendly_name.should =~ /#{city.parent.name}/
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: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 8
10
- version: 1.1.8
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: 2011-11-30 00:00:00 Z
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-tree
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: *id004
90
+ version_requirements: *id005
76
91
  - !ruby/object:Gem::Dependency
77
92
  name: rails
78
93
  prerelease: false
79
- requirement: &id005 !ruby/object:Gem::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: 19
99
+ hash: 5
85
100
  segments:
86
101
  - 3
87
- - 0
88
- - 10
89
- version: 3.0.10
102
+ - 1
103
+ version: "3.1"
90
104
  type: :runtime
91
- version_requirements: *id005
105
+ version_requirements: *id006
92
106
  - !ruby/object:Gem::Dependency
93
107
  name: scaffold_logic
94
108
  prerelease: false
95
- requirement: &id006 !ruby/object:Gem::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: *id006
119
+ version_requirements: *id007
106
120
  - !ruby/object:Gem::Dependency
107
121
  name: stateflow
108
122
  prerelease: false
109
- requirement: &id007 !ruby/object:Gem::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: *id007
133
+ version_requirements: *id008
120
134
  - !ruby/object:Gem::Dependency
121
135
  name: stringex
122
136
  prerelease: false
123
- requirement: &id008 !ruby/object:Gem::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: *id008
147
+ version_requirements: *id009
134
148
  - !ruby/object:Gem::Dependency
135
149
  name: jeweler
136
150
  prerelease: false
137
- requirement: &id009 !ruby/object:Gem::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: *id009
161
+ version_requirements: *id010
148
162
  - !ruby/object:Gem::Dependency
149
163
  name: rspec
150
164
  prerelease: false
151
- requirement: &id010 !ruby/object:Gem::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: *id010
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.10
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