private void processFile(
      Path scriptPath,
      Graph<String> scriptDependencies,
      Set<Path> scriptsToRead,
      Map<String, String> scriptContents) {
    List<String> lines;
    try {
      lines = Files.readAllLines(scriptPath, Charsets.UTF_8);
    } catch (IOException ioEx) {
      throw new LinkException(ioEx);
    }

    String scriptRelativePath = this.rootDir.relativize(scriptPath).toString();
    scriptContents.put(scriptRelativePath, NEWLINE_JOINER.join(lines));
    scriptDependencies.addNode(scriptRelativePath);

    for (String line : lines) {
      Matcher lineMatcher = INCLUDE_PATTERN.matcher(line);
      if (lineMatcher.find()) {
        String includedPath = lineMatcher.group(1);
        scriptDependencies.addEdge(includedPath, scriptRelativePath);
        if (!scriptContents.containsKey(includedPath)) {
          scriptsToRead.add(this.rootDir.resolve(includedPath));
        }
      }
    }
  }