<commit_before>package org.codehaus.groovy.grails.cli;

import org.codehaus.groovy.tools.RootLoader
import org.codehaus.groovy.tools.LoaderConfiguration

abstract class AbstractCliTests extends GroovyTestCase {

	protected appBase = "test/cliTestApp"
	protected ant = new AntBuilder()

	void setUp() {
		ant.delete(dir:appBase, failonerror:false)
		System.setProperty("base.dir", appBase)
		System.setProperty("grails.cli.args", "testapp")
		System.setProperty("grails.cli.testing", "true")
		System.setProperty("env.GRAILS_HOME", new File("").absolutePath)
	}
	
	void tearDown() {
		ant.delete(dir:appBase, failonerror:false)
		ant = null
	}

	protected String createTestApp() {
        // Pass the name of the test project to the create-app script.
        def appName = "testapp"
        System.setProperty("grails.cli.args", appName)

        // Create the application.
	    gantRun( ["-f", "scripts/CreateApp.groovy"] as String[])

	    // Update the base directory to the application dir.
        def appDir = appBase + File.separator + appName
        System.setProperty("base.dir", appDir)

		// Finally, clear the CLI arguments.
        System.setProperty("grails.cli.args", "")<commit_msg>Fix for failing PackagePlugin test.<commit_after>package org.codehaus.groovy.grails.cli;

import org.codehaus.groovy.tools.RootLoader
import org.codehaus.groovy.tools.LoaderConfiguration
import org.codehaus.groovy.grails.plugins.PluginManagerHolder

abstract class AbstractCliTests extends GroovyTestCase {

	protected appBase = "test/cliTestApp"
	protected ant = new AntBuilder()

	void setUp() {
		ant.delete(dir:appBase, failonerror:false)
		System.setProperty("base.dir", appBase)
		System.setProperty("grails.cli.args", "testapp")
		System.setProperty("grails.cli.testing", "true")
		System.setProperty("env.GRAILS_HOME", new File("").absolutePath)
	}
	
	void tearDown() {
        PluginManagerHolder.pluginManager = null
        ant.delete(dir:appBase, failonerror:false)
		ant = null
	}

	protected String createTestApp() {
        // Pass the name of the test project to the create-app script.
        def appName = "testapp"
        System.setProperty("grails.cli.args", appName)

        // Create the application.
	    gantRun( ["-f", "scripts/CreateApp.groovy"] as String[])

	    // Update the base directory to the application dir.
        def appDir = appBase + File.separator + appName
        System.setProperty("base.dir", appDir)

		// Finally, clear the CLI arguments.
        System.setProperty("grails.cli.args", "")
{'fraction_non_alphanumeric': 0.11903823413480488, 'fraction_numerical': 0.0, 'mean_word_length': 3.74392523364486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5563698', 'n_tokens_mistral': 815, 'n_tokens_neox': 761, 'n_words': 178}