Skip to content

Commit

Permalink
Merge pull request #23 from pellaea/sitemap
Browse files Browse the repository at this point in the history
First draft of sitemap.

Looks good.  The one little bit of fragility I hit was if a previous run fails, but left and index.xml file, then the updates will only be from the date recorded in index.xml.  However, I note that now it writes the index.xml after the other files, so this was a transitory issue since I'd run the script previously when it was broken.  I don't think it's worth doing anything about this obscure edge case.
  • Loading branch information
mo-nathan committed Jan 19, 2015
2 parents 181a944 + 5ec4375 commit 517849e
Show file tree
Hide file tree
Showing 6 changed files with 385 additions and 229 deletions.
50 changes: 27 additions & 23 deletions app/classes/geocoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,35 @@ def test_place_name(place_name)
end
end

TEST_EXPECTED_LOCATIONS = {
'North Falmouth, Massachusetts, USA' => {
:south => 41.6169329,
:west => -70.6603389,
:north => 41.6592100,
:east => -70.6022670
},
'North bound Rest Area, State Highway 33, between Pomeroy and Athens, Ohio, USA' => {
:north => 39.3043,
:west => -82.1067,
:east => -82.002,
:south => 39.0299
},
'Pasadena, California, USA' => {
:north => 34.251905,
:west => -118.198139,
:east => -118.065479,
:south => 34.1192
unless defined? TEST_EXPECTED_LOCATIONS
TEST_EXPECTED_LOCATIONS = {
'North Falmouth, Massachusetts, USA' => {
:south => 41.6169329,
:west => -70.6603389,
:north => 41.6592100,
:east => -70.6022670
},
'North bound Rest Area, State Highway 33, between Pomeroy and Athens, Ohio, USA' => {
:north => 39.3043,
:west => -82.1067,
:east => -82.002,
:south => 39.0299
},
'Pasadena, California, USA' => {
:north => 34.251905,
:west => -118.198139,
:east => -118.065479,
:south => 34.1192
}
}
}
end

TEST_FAILURE = '<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
<status>ZERO_RESULTS</status>
</GeocodeResponse>'
unless defined? TEST_FAILURE
TEST_FAILURE = '<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
<status>ZERO_RESULTS</status>
</GeocodeResponse>'
end

def test_success(loc)
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
Expand Down
3 changes: 1 addition & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@
<table class="LeftSide" cellpadding="10" style='height:100%; white-space:nowrap'>
<tr style="height:1px">
<td id="banner">
<%= link_to(@page_title || :app_banner.t,
:controller => 'observer', :action => 'index') %>
<%= link_to(:app_banner.t, browser.bot? ? "/sitemap/index.html" : "/") %>
</td>
</tr>
<tr>
Expand Down
1 change: 1 addition & 0 deletions public/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ eol.xml
local_images
pdf
pivotal
robots.txt
test.html
test_images
test_server1
Expand Down
204 changes: 0 additions & 204 deletions public/robots.txt

This file was deleted.

2 changes: 2 additions & 0 deletions public/sitemap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.xml
*.html
Loading

0 comments on commit 517849e

Please sign in to comment.