Sha256: b009db34bd19d4ecf9041ccc61d7a08be2dfc207deb3f35f6bbb2a6afca94207
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
# Copyright (c) 2012, SoundCloud Ltd., Tobias Bielohlawek require 's3' require 'retryable' require 'massive_sitemap/writer/gzip_file' module MassiveSitemap module Writer class S3 < MassiveSitemap::Writer::GzipFile def initialize(cfg, options = {}) @service = ::S3::Service.new(cfg) @bucket = @service.buckets.find(cfg[:bucket]) super(options) end protected def close_stream(stream) @filename = filename super # upload to amazon retryable( :tries => 3 ) do @bucket.objects.build(::File.basename(@filename)).tap do |object| object.content = ::File.open(@filename) object.save end end ::File.delete(@filename) unless @options[:keep] end def load_stream_ids @bucket.objects.find_all.each do |object| if ::File.extname(object.key) == ::File.extname(filename) add_stream_id(object.key, object.last_modified) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
massive_sitemap-writer-s3-0.0.1 | lib/massive_sitemap/writer/s3.rb |
massive_sitemap-writer-s3-0.0.1.rc4 | lib/massive_sitemap/writer/s3.rb |