Sha256: 7a306aeb2a434e2197523c008e353457c0cd978c5250b9510fae90b83e8b22c6

Contents?: true

Size: 575 Bytes

Versions: 10

Compression:

Stored size: 575 Bytes

Contents

module Xing::Services
  module SnapshotWriter
    def write(path, html)
      if Rails.env.test?
        snapshot_file = "#{ Rails.root }/spec/fixtures/sitemap_scratch/#{path.present? ? path : 'index'}.html"
      else
        snapshot_file = "#{ Rails.root }/public/frontend_snapshots/#{path.present? ? path : 'index'}.html"
      end
      dirname = File.dirname(snapshot_file)
      unless File.directory?(dirname)
        FileUtils.mkdir_p(dirname)
      end

      File.open(snapshot_file, "w+:ASCII-8BIT:UTF-8") do |f|
        f.write(html)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
xing-backend-0.0.19 lib/xing/services/snapshot_writer.rb
xing-backend-0.0.18 lib/xing/services/snapshot_writer.rb
xing-backend-0.0.17 lib/xing/services/snapshot_writer.rb
xing-backend-0.0.16 lib/xing/services/snapshot_writer.rb
xing-backend-0.0.15 lib/xing/services/snapshot_writer.rb
xing-backend-0.0.14 lib/xing/services/snapshot_writer.rb
xing-backend-0.0.13 lib/xing/services/snapshot_writer.rb
xing-backend-0.0.12 lib/xing/services/snapshot_writer.rb
xing-backend-0.0.11 lib/xing/services/snapshot_writer.rb
xing-backend-0.0.10 lib/xing/services/snapshot_writer.rb