Sha256: 87f12a24687deb92c2e3fc0bd4e9e9c3e66219ef84ff18c05dafc276e7416e10

Contents?: true

Size: 495 Bytes

Versions: 28

Compression:

Stored size: 495 Bytes

Contents

module SitemapGenerator
  class FileAdapter
    def write(location, raw_data)
      # Ensure that the directory exists
      dir = location.directory
      if !File.exists?(dir)
        FileUtils.mkdir_p(dir)
      elsif !File.directory?(dir)
        raise SitemapError.new("#{dir} should be a directory!")
      end

      gzip(open(location.path, 'wb'), raw_data)
    end

    def gzip(stream, data)
      gz = Zlib::GzipWriter.new(stream)
      gz.write data
      gz.close
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
sitemap_generator-4.3.1 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-4.3.0 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-4.2.0 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-4.1.1 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-4.1.0 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-4.0.1 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-4.0 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-4.0.alpha lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-3.4 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-3.3 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-3.2.1 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-3.2 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-3.1.1 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-3.1.0 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-3.0.0 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-2.2.1 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-2.1.8 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-2.1.7 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-2.1.7.pre1 lib/sitemap_generator/adapters/file_adapter.rb
sitemap_generator-2.1.6 lib/sitemap_generator/adapters/file_adapter.rb