BCS Generate Grails App Shell Script

The command line is a horrible place to assigned to in order to accomplish an assigned task.

The shell script below builds a fully functional web site with a MYSQL backed.  The script has been commented so you can easily follow the scrips flow.

#!/bin/sh
#
#  Perform Houskeeping Tasks
#
defpath=/root
hpath=/home/bcs/grails
famid=tc02
#
#  Establish Home Path
#
cd $hpath/
#
#  Greate Grails App Base
#
grails create-app $famid
#
#  witch over the newly created stack
#
cd $hpath/$famid/
#
#  Copy BuildConfig and DatSource file to new stack
#
cp -f $defpath/DataSource.groovy  -t $hpath/$famid/grails-app/conf 
cp -f $defpath/BuildConfig.groovy -t $hpath/$famid/grails-app/conf 
#
#  Create Domains
#
grails create-domain-class amec.Bishops
grails create-domain-class amec.PresidingElders
grails create-domain-class amec.Churches
grails create-domain-class amec.Clergy
grails create-domain-class amec.Members
grails create-domain-class amec.Officers
#
# Copy finilized domains to new trails stack
#
cp -f $defpath/amec/Bishops.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/PresidingElders.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/Churches.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/Clergy.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/Members.groovy -t $hpath/$famid/grails-app/domain/amec 
cp -f $defpath/amec/Officers.groovy -t $hpath/$famid/grails-app/domain/amec 
#
# Generate Scaffolds for data manipulation
#
grails generate-all amec.Bishops
grails generate-all amec.PresidingElders
grails generate-all amec.Churches
grails generate-all amec.Clergy
grails generate-all amec.Officers
grails generate-all amec.Members
#
# Build War (Web Archive) file
#
grails war
pwd

When this script completes the WAR (web archive) file is ready to be deployed to the application server. Deploy the application and welcome your users.

Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.

Leave a Reply