Sha256: a9f78ac603e2031e503bee36898fdebba5335de706b43bfc7e44c5f8b97b193b
Contents?: true
Size: 929 Bytes
Versions: 2
Compression:
Stored size: 929 Bytes
Contents
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
asker-tool-2.5.9 | lib/asker/check_input.rb |
asker-tool-2.5.8 | lib/asker/check_input.rb |