lib/theme_check/theme_file.rb in theme-check-1.8.0 vs lib/theme_check/theme_file.rb in theme-check-1.9.0

- old
+ new

@@ -1,14 +1,17 @@ # frozen_string_literal: true require "pathname" module ThemeCheck class ThemeFile + attr_reader :version, :storage + def initialize(relative_path, storage) @relative_path = relative_path @storage = storage @source = nil + @version = nil @eol = "\n" end def path @storage.path(@relative_path) @@ -34,10 +37,14 @@ # So in here we track whether the source file has \r\n in it and # we'll make sure that the file we write has the same eol as the # source file. def source return @source if @source - @source = @storage.read(@relative_path) + if @storage.versioned? + @source, @version = @storage.read_version(@relative_path) + else + @source = @storage.read(@relative_path) + end @eol = @source.include?("\r\n") ? "\r\n" : "\n" @source = @source.gsub("\r\n", "\n") end def json?