Added in AwsAdapert, uploads the sitemap to an s3 using the aws-sdk gem #76

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

I am working on a project that uses paperclip and aws-sdk, so I didn't want to install carrierwave. I saw that you had made a rake task that does this, but I thought for ease of use I might as well create an adapter.

Requirements
aws-sdk gem
Requires an config/s3.yml file. Set up the same way paperclip does.

The config is just about the same

SitemapGenerator::Sitemap.default_host = "http://www.example.com/"
SitemapGenerator::Sitemap.sitemaps_host = "http://s3.amazonaws.com/bucketnamehere/"
SitemapGenerator::Sitemap.public_path = 'tmp/'
SitemapGenerator::Sitemap.sitemaps_path = 'sitemaps/'
SitemapGenerator::Sitemap.adapter = SitemapGenerator::AwsAdapter.new
SitemapGenerator::Sitemap.create do
  #your set up here
end

I hope this helps!

Owner

kjvarga commented Jul 12, 2012

Hi, thanks for contributing your code. I would like to include it, but there are a couple issues that prevent me from doing so.

It's very Rails-centric by the way it manually parses the s3.yml file and uses Rails.root. I have SitemapGenerator.app.root as a generic way to get the application root directory, but then the yml file still uses the Rails environment to pick which config options to use, so that's not very nice for people trying to use it outside of Rails. I would rather use environment variables or something which is framework agnostic and have the code that reads the configuration file kept outside of the adapter.

Secondly it should get the sitemaps_path from the location object passed to write() rather than via SitemapGenerator::Sitemap.sitemaps_path.

Very cool thanks for your feed back. I just got buried under a pile of work, but when I get a chance in the next few weeks I will try again using your suggestions.

kjvarga closed this May 2, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment