diff --git a/.gitignore b/.gitignore index ba826255a..54e086dc4 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ public/getinvolved.html public/index.html public/stylesheets/compiled public/sitemap.xml -public/sitemap*.xml.gz +public/sitemaps/sitemap*.xml.gz public/javascripts/all.js public/javascripts/mxn_bundle.js webrat.log diff --git a/app/models/sitemap.rb b/app/models/sitemap.rb index 864bc15e7..d6e25bb36 100644 --- a/app/models/sitemap.rb +++ b/app/models/sitemap.rb @@ -51,7 +51,7 @@ class Sitemap def initialize(root_url, root_path, logger = Logger.new(STDOUT)) @root_url, @root_path, @logger = root_url, root_path, logger - #FileUtils.mkdir_p "#{@root_path}/sitemaps" + FileUtils.mkdir_p "#{@root_path}/sitemaps" # Index of current sitemap file @index = 0 @@ -130,7 +130,7 @@ def sitemap_index_relative_path end def sitemap_relative_path - "sitemap#{@index + 1}.xml.gz" + "sitemaps/sitemap#{@index + 1}.xml.gz" end # Notify the search engines (like Google, Yahoo, etc..) of the new sitemap diff --git a/spec/models/sitemap_spec.rb b/spec/models/sitemap_spec.rb index 5015fa487..e103757a4 100644 --- a/spec/models/sitemap_spec.rb +++ b/spec/models/sitemap_spec.rb @@ -15,14 +15,14 @@ file1.should_receive(:<<).with("") file1.should_receive(:<<).with("") file1.should_receive(:<<).with("") - file1.should_receive(:<<).with("http://domain.org/sitemap1.xml.gz") + file1.should_receive(:<<).with("http://domain.org/sitemaps/sitemap1.xml.gz") file1.should_receive(:<<).with("2010-02-01T00:00:00+00:00") file1.should_receive(:<<).with("") file1.should_receive(:<<).with("") file1.should_receive(:close) file2 = mock("file2") - Zlib::GzipWriter.should_receive(:open).with("#{public}/sitemap1.xml.gz").and_return(file2) + Zlib::GzipWriter.should_receive(:open).with("#{public}/sitemaps/sitemap1.xml.gz").and_return(file2) file2.should_receive(:<<).with("") file2.should_receive(:<<).with("") file2.should_receive(:<<).with("http://domain.org/hourly2010-02-01T00:00:00+00:00") @@ -49,7 +49,7 @@ it "should have the path to one of the sitemaps" do public = Rails.root.join('public').to_s s = Sitemap.new("http://domain.org", public, @logger) - s.sitemap_relative_path.should == "sitemap1.xml.gz" + s.sitemap_relative_path.should == "sitemaps/sitemap1.xml.gz" s.finish end