Called on file(s) modifications that the Guard watches.
 @param [Array<String>] paths the changes files or paths
 @raise [:task_has_failed] when run_on_changes has failed
183823
def run_on_changes(paths)
			cmd = "#{options[:executable]} --config #{@options[:config]} #{paths.map { |p| p.shellescape }.join(' ')}"
			results = `#{cmd}`

			success = ($?.to_i == 0)

			if success
				if options[:notify_on_success]
					::Guard::Notifier.notify('No errors found.', :title => 'JSHint', :image => :success)
				end
			else
				if options[:notify_on_failure]
					::Guard::Notifier.notify(results, :title => 'JSHint Errors', :image => :failed)
				end
				print results
			end
			return success
		end
673015
function Watch(paths,      // @arg PathArray
               options,    // @arg Object   - { delay, action, verbose, ... }
               callback) { // @arg Function - callback(err:Error):void
//{@dev
    _if(!Array.isArray(paths),  "invalid Watch(paths)");
    _if(!_isObject(options),    "invalid Watch(,options)");
    _if(!_isFunction(callback), "invalid Watch(,,callback)");
//}@dev

    var that = this;

    this._options = options || {};

    if (this._options.verbose) {
        console.log("  --- watch ---");
    }
    paths.forEach(function(path) {
        if (_isFile(path)) {
            Watch_file(that, path, function(diff) { // { path: { dir, size, mtime }, ... }
                callback(null, diff);
            });
        } else if (_isDir(path)) {
            Watch_dir(that, path, function(diff) { // { path: { dir, size, mtime }, ... }
                callback(null, diff);
            }, options);
        }
    });
}
671070
function setupWatchers(path) {
    // We want to track the watchers now and return if we are already watching this folder
    if (watchingFolders[path]) { return; }

    watchingFolders[path] = fs.watch(path, getWatcher(path + "/"));
    watchingFolders[path].on('error', function() {  verifyWatches(); });
    var fileList = fs.readdirSync(path);
    var stats;
    for (var i = 0; i < fileList.length; i++) {
        try {
            stats = fs.statSync(path + "/" + fileList[i]);
        }
        catch (e) {
            continue;
        }
        if (isWatching(fileList[i])) {
            timeStamps[path + "/" + fileList[i]] = stats.mtime.getTime();
        } else {
            if (stats.isDirectory()) {
                if (fileList[i] === "node_modules") {
                    watchingFolders[path + "/" + fileList[i]] = true;
                    continue;
                }
                if (fileList[i] === "tns_modules") {
                    watchingFolders[path + "/" + fileList[i]] = true;
                    continue;
                }
                if (fileList[i] === "App_Resources") {
                    watchingFolders[path + "/" + fileList[i]] = true;
                    continue;
                }
                setupWatchers(path + "/" + fileList[i]);
            }
        }
    }
}
263980
def lock_file(file_path, &block) # :nodoc:
      @@file_lock.synchronize do

        # Windows does not support file locking.
        if !windows? && file_path.exist?
          file_path.open('r+') do |f|
            begin
              f.flock File::LOCK_EX
              yield
            ensure
              f.flock File::LOCK_UN
            end
          end
        else
          yield
        end

      end
    end
346806
def run_on_changes(paths)
      if paths.any? { |path| path.match(%r{^db/migrate/(\d+).+\.rb}) } || reset?
        migrations = paths.map { |path| Migration.new(path) }
        migrate(migrations)
      elsif paths.any? { |path| path.match(%r{^db/seeds\.rb$}) }
        seed_only
      end
    end
1031317
def filter_directories(modified_files)
      modified_files.reject do |file|
        File.directory?(file) && !Overcommit::Utils::FileUtils.symlink?(file)
      end
    end
228213
public static void refreshedFiles(String[] filePaths) {
    for (String filePath : filePaths) {
      IFile file = CommonServices.getFileSystem().getIFile(new File(filePath));
      if (file != null) {
        TypeSystem.refreshed(file);
      }
    }
  }
1156439
function(event, path) {
            emitter.emit("file:changed", {
                event: event,
                path: path,
                namespace: namespace
            });
        }
1176679
private static void checkPaths(Configuration conf, List<Path> paths) throws
  IOException {
    for (Path p : paths) {
      FileSystem fs = p.getFileSystem(conf);
      if (!fs.exists(p)) {
        throw new FileNotFoundException("Source " + p + " does not exist.");
      }
    }
  }
309483
public function onFileChanged($path)
    {
        if (!Daemon::lintFile($path)) {
            Daemon::log(__METHOD__ . ': Detected parse error in ' . $path);
            return;
        }
        foreach ($this->files[$path] as $cb) {
            if (is_callable($cb) || is_array($cb)) {
                $cb($path);
            } elseif (!Daemon::$process->IPCManager->importFile($cb, $path)) {
                $this->rmWatch($path, $cb);
            }
        }
    }
1019671
def run_on_changes(paths)
      validate_at_least_one_target('copy')
      with_all_target_paths(paths) do |from_path, to_path|
        to_dir = File.dirname(to_path)
        if !File.directory?(to_dir) && options[:mkpath]
          UI.info("creating directory #{to_dir}") if options[:verbose]
          FileUtils.mkpath(to_dir)
        end
        validate_to_path(to_path)
        UI.info("copying to #{to_path}") if options[:verbose]
        copy(from_path, to_path)
      end
    end
1025465
def run_on_modifications(paths)
      specs = options[:keep_failed] ? paths + last_failed_paths : paths
      specs = Inspector.clean(specs, options) if options[:clean]

      return false if specs.empty?

      results = runner.run(specs)

      if results.empty?
        self.last_failed_paths = last_failed_paths - paths
        run_all if last_run_failed && options[:all_after_pass]
      else
        self.last_failed_paths = last_failed_paths + results.keys
      end

      self.last_run_failed = !results.empty?

      throw :task_has_failed if last_run_failed
    end
550889
def remove_file(paths):
    

    for path in force_list(paths):
        if os.path.exists(path):
            os.remove(path)
435215
def filter_nonexistent(modified_files)
      modified_files.select do |file|
        File.exist?(file) || Overcommit::Utils.broken_symlink?(file)
      end
    end
289922
def run_on_changes(modified, added, removed)
      types = {
        MODIFICATION_TASKS => modified,
        ADDITION_TASKS => added,
        REMOVAL_TASKS => removed
      }

      UI.clearable

      Guard.state.scope.grouped_plugins.each do |_group, plugins|
        _run_group_plugins(plugins) do |plugin|
          UI.clear
          types.each do |tasks, unmatched_paths|
            next if unmatched_paths.empty?
            match_result = Watcher.match_files(plugin, unmatched_paths)
            next if match_result.empty?
            task = tasks.detect { |meth| plugin.respond_to?(meth) }
            _supervise(plugin, task, match_result) if task
          end
        end
      end
    end
929095
def check_and_create_directories(paths):
    
    for path in paths:
        if os.path.exists(path):
            shutil.rmtree(path)
        os.mkdir(path)
66774
def split_paths(paths)
        new_paths = {}
        paths.each do |p|
          if p.split('/').length > 1
            new_paths[p.split('/').last.to_s] = p
          else
            new_paths['home'] = '/'
          end
        end
        new_paths
      end