public function createRoleFiles($inputDir, $outputDir, $roleFileDir = null)
    {
        $roleFileDir = $roleFileDir ?  : $inputDir;
        $outputDir = realpath($outputDir);
        $seenDirs = array();
        $longPaths = array();
        $roleFiles = array();

        foreach ($this->getWebRoleNames() as $roleName) {
            $dir = realpath($inputDir);
            $roleFilePath = sprintf('%s/%s.roleFiles.txt', $roleFileDir, $roleName);
            $roleFiles[$roleName] = $roleFilePath;

            if (isset($seenDirs[$dir])) {
                // we have seen this directory already, just copy the known
                // file with a new role file name.
                copy($seenDirs[$dir], $roleFilePath);
                continue;
            }
            $seenDirs[$dir] = $roleFilePath;
            $roleFile = $this->computeRoleFileContents($dir, $roleName, $outputDir, $longPaths);

            file_put_contents($roleFilePath, $roleFile);
        }

        if ($longPaths) {
            throw new \RuntimeException("Paths are too long. Not more than 248 chars per directory and 260 per file name allowed:\n" . implode("\n", $longPaths));
        }
        return $roleFiles;
    }