Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Burt Beckwith committed Jan 5, 2013
0 parents commit e47b653
Show file tree
Hide file tree
Showing 92 changed files with 5,428 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .classpath
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/groovy"/>
<classpathentry kind="src" path="src/java"/>
<classpathentry kind="src" path="src/docs"/>
<classpathentry kind="src" path="grails-app/conf"/>
<classpathentry kind="src" path="grails-app/migrations"/>
<classpathentry kind="src" path="test/integration"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry excluding="BuildConfig.groovy|*DataSource.groovy|UrlMappings.groovy|Config.groovy|BootStrap.groovy|spring/resources.groovy" kind="src" path=".link_to_grails_plugins/database-migration-1.3.2/grails-app/conf">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/database-migration-1.3.2/grails-app/controllers">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/database-migration-1.3.2/grails-app/views">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/database-migration-1.3.2/src/groovy">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/release-2.2.0/src/groovy">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/release-2.2.0/src/java">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".link_to_grails_plugins/rest-client-builder-1.0.3/src/groovy">
<attributes>
<attribute name="org.grails.ide.eclipse.core.SOURCE_FOLDER" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.grails.ide.eclipse.core.CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/eclipseclasses"/>
</classpath>
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,6 @@
*.log
/target
/docs
/grails-*.zip
/plugin.xml
.settings
32 changes: 32 additions & 0 deletions .project
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>grails-database-migration-jaxb</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.grails.ide.eclipse.core.nature</nature>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
<linkedResources>
<link>
<name>.link_to_grails_plugins</name>
<type>2</type>
<location>/home/burt/workspace/grails/plugins/grails-database-migration-jaxb/target/plugins</location>
</link>
</linkedResources>
</projectDescription>
44 changes: 44 additions & 0 deletions DatabaseMigrationJaxbGrailsPlugin.groovy
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,44 @@
/* Copyright 2013 SpringSource.
*
* 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.GrailsChangeLogParser
import grails.plugin.databasemigration.jaxb.JaxbChangeLogParser
import liquibase.parser.ChangeLogParserFactory

class DatabaseMigrationJaxbGrailsPlugin {
String version = '0.1'
String grailsVersion = '2.0 > *'
String author = 'Burt Beckwith'
String authorEmail = 'beckwithb@vmware.com'
String title = 'Grails JAXB Database Migration Plugin'
String description = 'Adds support for migrations using JAXB classes'
String documentation = 'http://grails-plugins.github.com/grails-database-migration-jaxb/'

List pluginExcludes = [
'docs/**',
'src/docs/**',
'grails-app/migrations/**'
]

String license = 'APACHE'
def organization = [name: 'SpringSource', url: 'http://www.springsource.org/']
def issueManagement = [system: 'Github', url: 'https://github.com/grails-plugins/grails-database-migration-jaxb/issues']
def scm = [url: 'https://github.com/grails-plugins/grails-database-migration-jaxb']

def doWithApplicationContext = { ctx ->
// adds support for compiled JAXB .class files
ChangeLogParserFactory.instance.register new JaxbChangeLogParser(new GrailsChangeLogParser(ctx))
}
}
1 change: 1 addition & 0 deletions application.properties
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
app.grails.version=2.0.4
63 changes: 63 additions & 0 deletions build.xml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,63 @@
<project name='database-migration-jaxb' default='package'>

<condition property='grails' value='grails.bat'>
<os family='windows' />
</condition>
<property name='grails' value='grails' />

<macrodef name='grails'>
<attribute name='action' />
<attribute name='environment' default='dev' />
<element name='args' optional='true' />
<sequential>
<exec executable='${grails}' failonerror='true'>
<args />
<arg value='@{environment}' />
<arg value='@{action}' />
</exec>
</sequential>
</macrodef>

<target name='clean' description='Cleans generated resources'>
<grails action='clean' />
<delete><fileset dir='.' includes='*.log*' /></delete>
<delete><fileset dir='target' includes='*.log*' /></delete>

<mkdir dir='grails-app/conf/spring' />
</target>

<target name='test' description='Run unit tests' depends='clean'>
<delete file='target/stacktrace.log' />
<delete dir='target/cli-output' />
<delete dir='target/testdb' />

<grails action='test-app' environment='test' />

<delete dir='target/cli-output' />
<delete dir='target/testdb' />
</target>

<target name='package' description='Package the plugin'
depends='test, doPackage, post-package-cleanup' />

<target name='doPackage'>
<grails action='package-plugin' />
</target>

<target name='post-package-cleanup' description='Deletes unneeded folders'>
<delete dir='grails-app/conf/hibernate' />
<delete dir='grails-app/conf/spring' />
<delete dir='grails-app/controllers' />
<delete dir='grails-app/domain' />
<delete dir='grails-app/i18n' />
<delete dir='grails-app/services' />
<delete dir='grails-app/taglib' />
<delete dir='grails-app/utils' />
<delete dir='grails-app/views' />
<delete dir='lib' />
<delete dir='scripts' />
<delete dir='test/unit' />
<delete dir='web-app' />
</target>

</project>
5 changes: 5 additions & 0 deletions doc.sh
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,5 @@
rm -rf docs
grails doc --pdf
rm -rf docs/manual/api
rm -rf docs/manual/gapi
grails add-tracking
25 changes: 25 additions & 0 deletions grails-app/conf/BuildConfig.groovy
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,25 @@
grails.project.work.dir = 'target'
grails.project.target.level = 1.7
grails.project.docs.output.dir = 'docs/manual' // for backwards-compatibility, the docs are checked into gh-pages branch

grails.project.dependency.resolution = {

inherits 'global'
log 'warn'

repositories {
grailsCentral()
}

plugins {
build ':release:2.2.0', ':rest-client-builder:1.0.3', {
export = false
}

compile ":hibernate:$grailsVersion", {
export = false
}

compile ':database-migration:1.3.2'
}
}
7 changes: 7 additions & 0 deletions grails-app/conf/Config.groovy
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,7 @@
log4j = {
error 'org.codehaus.groovy.grails',
'org.springframework',
'org.hibernate',
'net.sf.ehcache.hibernate'
debug 'grails.plugin.databasemigration'
}
14 changes: 14 additions & 0 deletions grails-app/conf/DataSource.groovy
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,14 @@
dataSource {
pooled = true
driverClassName = 'org.h2.Driver'
username = 'sa'
password = ''
dbCreate = 'update'
url = 'jdbc:h2:mem:testDb'
}

hibernate {
cache.use_second_level_cache = false
cache.use_query_cache = false
cache.provider_class = 'org.hibernate.cache.EhCacheProvider'
}
29 changes: 29 additions & 0 deletions grails-app/migrations/changelog.groovy
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,29 @@
databaseChangeLog = {

changeSet(author: 'burt', id: 't1') {
createTable(tableName: 't1') {
column(autoIncrement: true, name: 'id', type: 'BIGINT') {
constraints(nullable: false, primaryKey: true)
}
column(name: 'name', type: 'VARCHAR(255)') {
constraints(nullable: false)
}
}
}

include file: 'changelog.xml'

include file: 'grails.plugin.databasemigration.jaxb.CreateDepartmentTable.class'

include file: 'grails.plugin.databasemigration.jaxb.CreateDepartment2Table.class'

changeSet(author: 'burt', id: 'change_t2') {
addColumn(tableName: 't2') {
column(name: 'new_col', type: 'varchar(123)') {
constraints(nullable: false)
}
}
}

include file: 'changelog.sql'
}
1 change: 1 addition & 0 deletions grails-app/migrations/changelog.sql
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
create table ssqqll (id varchar(255) not null, bytes binary(100000) not null, primary key (id));
17 changes: 17 additions & 0 deletions grails-app/migrations/changelog.xml
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<databaseChangeLog xmlns='http://www.liquibase.org/xml/ns/dbchangelog'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd'>

<changeSet author='burt' id='t2'>
<createTable tableName='t2'>
<column autoIncrement='true' name='id' type='BIGINT'>
<constraints nullable='false' primaryKey='true' />
</column>
<column name='name' type='VARCHAR(255)'>
<constraints nullable='false' />
</column>
</createTable>
</changeSet>

</databaseChangeLog>
9 changes: 9 additions & 0 deletions release.sh
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,9 @@
rm -rf target/release
mkdir target/release
cd target/release
git clone git@github.com:grails-plugins/grails-database-migration-jaxb.git
cd grails-database-migration-jaxb
grails clean
grails compile
#grails publish-plugin --noScm --snapshot --stacktrace
grails publish-plugin --noScm --stacktrace
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1 @@
The Database Migration JAXB plugin extends the Database Migration plugin to add the ability to write changelogs in Java or Groovy code using JAXB classes.
4 changes: 4 additions & 0 deletions src/docs/guide/1.1 History.gdoc
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,4 @@
h4. History

* January 5, 2013
** initial 0.1 release
17 changes: 17 additions & 0 deletions src/docs/guide/2 Getting Started.gdoc
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,17 @@
h4. The first step is to add a dependency for the plugin in @BuildConfig.groovy@:

{code}
plugins {
...
runtime ':database-migration-jaxb:0.1'
}
{code}

This should pull in the @database-migration@ plugin transitively but you can also explicitly add in a dependency for that, in particular if you want to use a newer version than the plugin requires:

{code}
plugins {
...
runtime ':database-migration:1.3.2'
}
{code}
Loading

0 comments on commit e47b653

Please sign in to comment.