Module: CheckJsFiles

Defined in:
lib/jscop/check_js_files.rb

Overview

Locate Js files in defined paths on the Terminal

Class Method Summary collapse

Class Method Details

.find_dir(path) ⇒ Object



10
11
12
13
14
# 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) ⇒ Object



4
5
6
7
8
# 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) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# 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