Sha256: 37af946c90745ce3598ba293096e73b6370f8d5c8c1eac3728484285dfa13436

Contents?: true

Size: 650 Bytes

Versions: 8

Compression:

Stored size: 650 Bytes

Contents

# Locate Js files in defined paths on the Terminal

module CheckJsFiles
  def self.find_file(path)
    puts "No such File as #{path}" if !File.exist?(path)

    File.exist?(path)
  end

  def self.find_dir(path)
    puts "No such Folder as #{path}".yellow unless Dir.exist?(path)

    Dir.exist?(path)
  end

  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
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
jscop-0.1.9 lib/jscop/check_js_files.rb
jscop-0.1.8 lib/jscop/check_js_files.rb
jscop-0.1.7 lib/jscop/check_js_files.rb
jscop-0.1.6 lib/jscop/check_js_files.rb
jscop-0.1.5 lib/jscop/check_js_files.rb
jscop-0.1.4 lib/jscop/check_js_files.rb
jscop-0.1.3 lib/jscop/check_js_files.rb
jscop-0.1.2 lib/jscop/check_js_files.rb