Sha256: d6976eddc6ef0c3b18013559ae5717fe53cfbb1f2a35c3b5916afbe497648b22

Contents?: true

Size: 927 Bytes

Versions: 2

Compression:

Stored size: 927 Bytes

Contents

#!/usr/bin/env ruby
require 'jscop/version'
require_relative '../lib/helpers/lint_ware'
require 'tty-font'
require 'colorize'

def show_title
  font = TTY::Font.new
  font_messge = font.write('Jscop', letter_spacing: 1)
  puts font_messge
end

def print_linter_result(error_bin, fpath)
  puts
  puts "#{error_bin.length.to_s.yellow} Offense(s) Detected" unless error_bin.empty?

  path_exists = File.exist?(fpath) || Dir.exist?(fpath)

  success_msg = 'As clean as Snow!. No offenses found in the $PATH'

  puts "#{success_msg} #{fpath}".green if error_bin.empty? && path_exists == true
  puts
end

def jscop_init
  show_title

  path = ARGV[0]
  path = '.' if ARGV.empty?

  error_bin = []

  js_file_pattern = /(\w|\W)+.js$/

  if js_file_pattern.match?(path)
    LintWare.init_files_linting(error_bin, path)
  else
    LintWare.init_dir_linting(error_bin, path)
  end

  print_linter_result(error_bin, path)
end

jscop_init

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jscop-0.1.4 exe/jscop
jscop-0.1.3 exe/jscop