Sha256: ada04ddd85d22238d1db67ec4e7ce1efa3e602fe52013189e04696a0c292d8a7
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
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 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
massive_sitemap-writer-s3-0.0.1.rc3 | lib/massive_sitemap/writer/s3.rb |