Sha256: 2d788e16b43f5f7b3e2492f7a1e15631eb37a05a82a29d743c9261ddc313bedf
Contents?: true
Size: 960 Bytes
Versions: 22
Compression:
Stored size: 960 Bytes
Contents
# frozen_string_literal: true require 'rainbow' require_relative 'check_input/check_haml_data' class CheckInput def initialize(verbose = true) @verbose = verbose end def file(filepath) @filepath = filepath self end def verbose(verbose) @verbose = verbose self end def check # Check HAML file syntax exist = check_file_exist return false unless exist check_file_content end private def check_file_exist if @filepath.nil? raise Rainbow("Can't check nil filename") end unless File.exist? @filepath puts Rainbow('File not found!').red.bright if @verbose return false end unless File.extname(@filepath) == '.haml' puts Rainbow('Only check HAML files!').yellow.bright if @verbose return false end true end def check_file_content data = CheckHamlData.new(@filepath) data.check data.show_errors if @verbose data.ok? end end
Version data entries
22 entries across 22 versions & 1 rubygems