module CheckJsFiles

Locate Js files in defined paths on the Terminal

Public Class Methods

find_dir(path) click to toggle source
# File lib/jscop/check_js_files.rb, line 10
def self.find_dir(path)
  puts "No such Folder as #{path}".yellow unless Dir.exist?(path)

  Dir.exist?(path)
end
find_file(path) click to toggle source
# File lib/jscop/check_js_files.rb, line 4
def self.find_file(path)
  puts "No such File as #{path}" if !File.exist?(path)

  File.exist?(path)
end
seek_js(*path) click to toggle source
# File lib/jscop/check_js_files.rb, line 16
def self.seek_js(*path)
  if path[0]
    files = Dir["#{path[0]}/**/*.js"]
    return files if !files.empty?

    puts "No JS files found in #{path[0]} Path" if files.empty?
  else
    files = Dir['./**/*.js']
    return files if !files.empty?

    puts 'No JS files found in this Folder' if files.empty?
  end
end