<commit_before>/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package asset.pipeline.gradle

import org.gradle.api.Plugin
import org.gradle.api.Project
import asset.pipeline.AssetCompiler
import asset.pipeline.AssetPipelineConfigHolder
import asset.pipeline.fs.FileSystemAssetResolver
import org.gradle.api.tasks.Delete

/**
 * This is the Gradle Plugin implementation of asset-pipeline-core. It provides a set of tasks useful for working with your assets directly
 *
 * task: asset-compile Compiles your assets into your build directory
 * task: asset-clean Cleans the build/assets directory
 *
 * @author <NAME>
 * @author <NAME>
*/
class AssetPipelinePlugin implements Plugin<Project> {

	void apply(Project project) {
        def defaultConfiguration = project.extensions.create('assets', AssetPipelineExtension)
        defaultConfiguration.assetsPath = 'grails-app/assets'
        defaultConfiguration.compileDir = 'build/assets'

		project.tasks.create('asset-precompile', AssetCompile)

        def assetPrecompileTask = project.tasks.getByName('asset-precompile')
        def assetCleanTask = project.tasks.create('asset-clean', Delete)

        project.afterEvaluate {
            def assetPipeline = project.extensions.getByType(AssetPipelineExtension)
            assetCleanTask.configure {
                delete project.file(assetPipeline.compileDir)
            }
            assetPrecompileTask.configure {
                destinationDir = project.file(assetPipeline.compileDir)
                assetsDir = project.file(assetPipeline.assetsPath)
                minifyJs = assetPipeline.minifyJs
                minifyCss = assetPipeline.minifyCss
                minifyOptions = assetPipeline.minifyOptions
                includes = assetPipeline.includes
                excludes = assetPipeline.excludes
                excludesGzip = assetPipeline.excludesGzip
            }
        }
		def assembleTask = project.tasks.findByName('assemble')
		if(assembleTask) {
			assembleTask.dependsOn( assetPrecompileTask )
		}

        def cleanTask = project.tasks.findByName('clean')
        if(cleanTask) {
            cleanTask.dependsOn( assetCleanTask )
        }


		// project.task('asset-watch') << {
		// 	//TODO: Implement live watcher to auto recompile assets as they change
		// }
	}
}
<commit_msg>Rename tasks to assetCompile and assetClean which is more idiomatic Gradle<commit_after>/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*    http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package asset.pipeline.gradle

import org.gradle.api.Plugin
import org.gradle.api.Project
import asset.pipeline.AssetCompiler
import asset.pipeline.AssetPipelineConfigHolder
import asset.pipeline.fs.FileSystemAssetResolver
import org.gradle.api.tasks.Delete

/**
 * This is the Gradle Plugin implementation of asset-pipeline-core. It provides a set of tasks useful for working with your assets directly
 *
 * task: assetCompile Compiles your assets into your build directory
 * task: assetClean Cleans the build/assets directory
 *
 * @author <NAME>
 * @author <NAME>
*/
class AssetPipelinePlugin implements Plugin<Project> {

	void apply(Project project) {
        def defaultConfiguration = project.extensions.create('assets', AssetPipelineExtension)
        defaultConfiguration.assetsPath = 'grails-app/assets'
        defaultConfiguration.compileDir = 'build/assets'

		project.tasks.create('assetCompile', AssetCompile)

        def assetPrecompileTask = project.tasks.getByName('assetCompile')
        def assetCleanTask = project.tasks.create('assetClean', Delete)

        project.afterEvaluate {
            def assetPipeline = project.extensions.getByType(AssetPipelineExtension)
            assetCleanTask.configure {
                delete project.file(assetPipeline.compileDir)
            }
            assetPrecompileTask.configure {
                destinationDir = project.file(assetPipeline.compileDir)
                assetsDir = project.file(assetPipeline.assetsPath)
                minifyJs = assetPipeline.minifyJs
                minifyCss = assetPipeline.minifyCss
                minifyOptions = assetPipeline.minifyOptions
                includes = assetPipeline.includes
                excludes = assetPipeline.excludes
                excludesGzip = assetPipeline.excludesGzip
            }
        }
		def assembleTask = project.tasks.findByName('assemble')
		if(assembleTask) {
			assembleTask.dependsOn( assetPrecompileTask )
		}

        def cleanTask = project.tasks.findByName('clean')
        if(cleanTask) {
            cleanTask.dependsOn( assetCleanTask )
        }


		// project.task('asset-watch') << {
		// 	//TODO: Implement live watcher to auto recompile assets as they change
		// }
	}
}

{'fraction_non_alphanumeric': 0.07807652533609101, 'fraction_numerical': 0.002757669769045157, 'mean_word_length': 3.1273115220483643, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5216941', 'n_tokens_mistral': 1528, 'n_tokens_neox': 1454, 'n_words': 434}