<commit_before>/* Copyright 2006-2010 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.
 */

import grails.plugin.databasemigration.GormDatabaseSnapshotGenerator
import grails.plugin.databasemigration.GrailsChange
import grails.plugin.databasemigration.GrailsChangeLogParser
import grails.plugin.databasemigration.GrailsClassLoaderResourceAccessor
import grails.plugin.databasemigration.GrailsDiffStatusListener
import grails.plugin.databasemigration.GrailsPrecondition
import grails.plugin.databasemigration.Log4jLogger
import grails.plugin.databasemigration.MigrationRunner
import grails.plugin.databasemigration.MigrationUtils
import grails.plugin.databasemigration.MysqlAwareCreateTableGenerator

import liquibase.change.ChangeFactory
import liquibase.logging.Logger
import liquibase.logging.LogFactory
import liquibase.parser.ChangeLogParserFactory
import liquibase.precondition.PreconditionFactory
import liquibase.resource.FileSystemResourceAccessor
import liquibase.servicelocator.ServiceLocator
import liquibase.snapshot.DatabaseSnapshotGeneratorFactory
import liquibase.sqlgenerator.SqlGeneratorFactory
import liquibase.sqlgenerator.core.CreateTableGenerator

class DatabaseMigrationGrailsPlugin {

	String version = '0.1'
	String grailsVersion = '1.3.0 > *'
	String author = '<NAME>'
	String authorEmail = '<EMAIL>'
	String title = 'Grails Database Migration Plugin'
	String description = 'Grails Database Migration Plugin'
	String documentation = 'http://grails.org/plugin/database-migration'

	List pluginExcludes = [
		'grails-app/domain/**',
		'src/groovy/grails/plugin/databasemigration/test/**'
	]

	def doWithSpring = {

		MigrationUtils.application = application

		if (application.warDeployed) {
			migrationResourceAccessor(GrailsClassLoaderResourceAccessor, application.classLoader)
		}
		else {
			String changelogLocation = MigrationUtils.changelogLocation
			String changelogLocationPath = new File(changelogLocation).path
			migrationResourceAccessor(FileSystemResourceAccessor, changelogLocationPath)
		}

		diffStatusListener(GrailsDiffStatusListener)
	}

	def doWithApplicationContext = { ctx ->
		register ctx

		fixLogging()

		MigrationRunner.autoRun()
	}
<commit_msg>excluding docs and doc source from plugin zip<commit_after>/* Copyright 2006-2010 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.
 */

import grails.plugin.databasemigration.GormDatabaseSnapshotGenerator
import grails.plugin.databasemigration.GrailsChange
import grails.plugin.databasemigration.GrailsChangeLogParser
import grails.plugin.databasemigration.GrailsClassLoaderResourceAccessor
import grails.plugin.databasemigration.GrailsDiffStatusListener
import grails.plugin.databasemigration.GrailsPrecondition
import grails.plugin.databasemigration.Log4jLogger
import grails.plugin.databasemigration.MigrationRunner
import grails.plugin.databasemigration.MigrationUtils
import grails.plugin.databasemigration.MysqlAwareCreateTableGenerator

import liquibase.change.ChangeFactory
import liquibase.logging.Logger
import liquibase.logging.LogFactory
import liquibase.parser.ChangeLogParserFactory
import liquibase.precondition.PreconditionFactory
import liquibase.resource.FileSystemResourceAccessor
import liquibase.servicelocator.ServiceLocator
import liquibase.snapshot.DatabaseSnapshotGeneratorFactory
import liquibase.sqlgenerator.SqlGeneratorFactory
import liquibase.sqlgenerator.core.CreateTableGenerator

class DatabaseMigrationGrailsPlugin {

	String version = '0.1'
	String grailsVersion = '1.3.0 > *'
	String author = '<NAME>'
	String authorEmail = '<EMAIL>'
	String title = 'Grails Database Migration Plugin'
	String description = 'Grails Database Migration Plugin'
	String documentation = 'http://grails.org/plugin/database-migration'

	List pluginExcludes = [
		'grails-app/domain/**',
		'docs/**',
		'src/docs/**',
		'src/groovy/grails/plugin/databasemigration/test/**'
	]

	def doWithSpring = {

		MigrationUtils.application = application

		if (application.warDeployed) {
			migrationResourceAccessor(GrailsClassLoaderResourceAccessor, application.classLoader)
		}
		else {
			String changelogLocation = MigrationUtils.changelogLocation
			String changelogLocationPath = new File(changelogLocation).path
			migrationResourceAccessor(FileSystemResourceAccessor, changelogLocationPath)
		}

		diffStatusListener(GrailsDiffStatusListener)
	}

	def doWithApplicationContext = { ctx ->
		register ctx

		fixLogging()

		MigrationRunner.autoRun()
	}

{'fraction_non_alphanumeric': 0.07160894660894661, 'fraction_numerical': 0.006493506493506494, 'mean_word_length': 5.888198757763975, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '3206051', 'n_tokens_mistral': 1617, 'n_tokens_neox': 1478, 'n_words': 379}