Changeset 39 for trunk/src/grails-app/conf
- Timestamp:
- Jan 27, 2009, 11:02:59 PM (16 years ago)
- Location:
- trunk/src/grails-app/conf
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/grails-app/conf/BootStrap.groovy
r34 r39 5 5 def init = { servletContext -> 6 6 7 println "**** BootStrap ; GrailsUtil.environment:${GrailsUtil.environment}"7 println "**** BootStrap GrailsUtil.environment = ${GrailsUtil.environment}" 8 8 9 9 switch (GrailsUtil.environment) 10 10 { 11 11 case "development": 12 println "**** BootStrap detected development" 13 configureForDevelopment() 12 bootStrapDemoData() 14 13 break 15 14 case "test": 16 println "**** BootStrap detected test"17 configureForTest()18 15 break 19 16 case "production": 20 println "**** BootStrap detected production" 21 configureForProduction() 17 bootStrapDemoData() 22 18 break 23 19 } … … 27 23 def destroy = { 28 24 } 29 30 /* 31 Tasks to do when Grails is running in each environment. 32 */ 33 void configureForDevelopment() 25 26 //Insert some demo/startup data. 27 void bootStrapDemoData() 34 28 { 35 println "BootStrap configureForDevelopment() called"29 println "BootStrapping demo data..." 36 30 37 31 //TypeOfPersonGroup … … 50 44 //Person 51 45 new Person(personGroup:PersonGroup.get(1), 52 firstName:" FirstNameTech1",53 lastName:" LastNameTech1").save()46 firstName:"Craig", 47 lastName:"SuperTech").save() 54 48 new Person(personGroup:PersonGroup.get(2), 55 49 firstName:"Joe", 56 50 lastName:"Samples").save() 51 new Person(personGroup:PersonGroup.get(1), 52 firstName:"Production", 53 lastName:"Mann").save() 57 54 58 55 //TaskGroup … … 82 79 new EntryType(name:"Fault").save() 83 80 new EntryType(name:"WorkDone").save() 81 new EntryType(name:"Production Report").save() 84 82 85 83 //ModificationType … … 93 91 new ModificationType(name:"AssignedToModified").save() 94 92 new ModificationType(name:"NameModified").save() 95 96 93 94 println "BootStrapping demo data...completed." 97 95 98 }99 100 //---------------------------------------------------------101 void configureForTest()102 {103 println "BootStrap configureForTest() called"104 }105 106 //---------------------------------------------------------107 void configureForProduction()108 {109 println "BootStrap configureForProduction() called"110 96 } 111 97 -
trunk/src/grails-app/conf/DataSource.groovy
r16 r39 10 10 cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider' 11 11 } 12 // environment specific settings 12 13 //environment specific settings 14 //create-drop: drop tables and data between sessions, then insert from Bootstrap. 15 //create: drop data between sessions, can't explain the rest. 16 //update: keep data, update tables as required, keeps inserting from BootStrap. 13 17 environments { 14 18 development { … … 26 30 production { 27 31 dataSource { 28 dbCreate = "update" 29 url = "jdbc:hsqldb:file:prodDb;shutdown=true" 32 //Delete dbCreate line after setup! 33 dbCreate = "create-drop" 34 //url = "jdbc:hsqldb:file:prodDb;shutdown=true" 35 url = "jdbc:hsqldb:mem:devDB" 30 36 } 31 37 }
Note: See TracChangeset
for help on using the changeset viewer.