Sha256: c4fd7410a411afaff62c986e0d70129011428d3cbec457c482a8a5777c1bc756

Contents?: true

Size: 787 Bytes

Versions: 23

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

require "zlib"

module PlatformosCheck
  class AssetFile < AppFile
    DIR_PREFIX = %r{\A/?((marketplace_builder|app)/assets/|modules/((\w|-)*)/(private|public)/assets/)}

    def initialize(relative_path, storage)
      super
      @loaded = false
      @content = nil
    end

    def rewriter
      @rewriter ||= AppFileRewriter.new(@relative_path, source)
    end

    def write
      content = rewriter.to_s
      return unless source != content

      @storage.write(@relative_path, content.gsub("\n", @eol))
      @source = content
      @rewriter = nil
    end

    def gzipped_size
      @gzipped_size ||= Zlib.gzip(source).bytesize
    end

    def dir_prefix
      DIR_PREFIX
    end

    def remove_extension(path)
      path
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
platformos-check-0.4.13 lib/platformos_check/asset_file.rb
platformos-check-0.4.12 lib/platformos_check/asset_file.rb
platformos-check-0.4.11 lib/platformos_check/asset_file.rb
platformos-check-0.4.10 lib/platformos_check/asset_file.rb
platformos-check-0.4.9 lib/platformos_check/asset_file.rb
platformos-check-0.4.8 lib/platformos_check/asset_file.rb
platformos-check-0.4.7 lib/platformos_check/asset_file.rb
platformos-check-0.4.6 lib/platformos_check/asset_file.rb
platformos-check-0.4.5 lib/platformos_check/asset_file.rb
platformos-check-0.4.4 lib/platformos_check/asset_file.rb
platformos-check-0.4.3 lib/platformos_check/asset_file.rb
platformos-check-0.4.2 lib/platformos_check/asset_file.rb
platformos-check-0.4.1 lib/platformos_check/asset_file.rb
platformos-check-0.4.0 lib/platformos_check/asset_file.rb
platformos-check-0.3.3 lib/platformos_check/asset_file.rb
platformos-check-0.3.1 lib/platformos_check/asset_file.rb
platformos-check-0.3.0 lib/platformos_check/asset_file.rb
platformos-check-0.2.2 lib/platformos_check/asset_file.rb
platformos-check-0.2.1 lib/platformos_check/asset_file.rb
platformos-check-0.2.0 lib/platformos_check/asset_file.rb