public ScriptHandler prepareDistribution(PerfTest perfTest) throws IOException {
		File perfTestDistDirectory = getDistributionPath(perfTest);
		User user = perfTest.getCreatedBy();
		String scm = perfTest.getScm();
		FileEntry scriptEntry;

		if (isGitHubScript(scm)) {
			String gitHubConfigName = extractGitHubConfigName(scm);

			GitHubConfig gitHubConfig = gitHubFileEntryService.getGitHubConfig(user, gitHubConfigName);
			GitHub gitHub = gitHubFileEntryService.getGitHubClient(gitHubConfig);
			GHRepository ghRepository = gitHub.getRepository(gitHubConfig.getOwner() + "/" + gitHubConfig.getRepo());

			String scriptName = perfTest.getScriptName();
			gitHubFileEntryService.checkoutGitHubScript(perfTest, ghRepository, gitHubConfig);
			scriptEntry = gitHubFileEntryService.getOne(ghRepository, gitHubConfig, scriptName);
			gitHubFileEntryService.evictGitHubGroovyProjectScriptTypeCache(ghRepository, scriptName, gitHubConfig.getBranch());
		} else {
			scriptEntry = checkNotNull(
				fileEntryService.getOne(user,
					checkNotEmpty(perfTest.getScriptName(), "perfTest should have script name"),
					getSafe(valueOf(perfTest.getScriptRevision()))), "script should exist");
		}

		// Get all files in the script path.
		ScriptHandler handler = scriptHandlerFactory.getHandler(scriptEntry);
		LOGGER.info(format(perfTest, "Script type is '{}'.", handler.getKey()));

		ProcessingResultPrintStream processingResult = new ProcessingResultPrintStream(new ByteArrayOutputStream());
		handler.prepareDist(perfTest, user, scriptEntry, perfTestDistDirectory, config.getControllerProperties(),
				processingResult);
		LOGGER.info(format(perfTest, "File write is completed in {}", perfTestDistDirectory));
		if (!processingResult.isSuccess()) {
			File logDir = new File(getLogFileDirectory(perfTest), "distribution_log.txt");
			try {
				FileUtils.writeByteArrayToFile(logDir, processingResult.getLogByteArray());
			} catch (IOException e) {
				noOp();
			}
			throw processException("Error while file distribution is prepared.\n" +
				"If you run groovy project type script, Please check your build script and make sure Maven or Gradle is installed.");
		}
		return handler;
	}
Prepare files for distribution. This method stores the files on the path
${NGRINDER_HOME}/perftest/{test_id}/dist folder.

@param perfTest perfTest
@return File location in which the perftest script and resources are distributed.
ngrinder-controller/src/main/java/org/ngrinder/perftest/service/PerfTestService.java