Ignore:
Timestamp:
Jan 27, 2009, 11:02:59 PM (16 years ago)
Author:
gav
Message:

Setup Boostrap and DataSource? so that we have demo data in prod env for deployin
g demo. Adjust the entry domain and rebuild views and controller.

Location:
trunk/src/grails-app/conf
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/grails-app/conf/BootStrap.groovy

    r34 r39  
    55    def init = { servletContext ->
    66
    7     println "**** BootStrap; GrailsUtil.environment: ${GrailsUtil.environment}"
     7    println "**** BootStrap GrailsUtil.environment = ${GrailsUtil.environment}"
    88   
    99        switch (GrailsUtil.environment)
    1010        {
    1111            case "development":
    12                         println "**** BootStrap detected development"
    13                         configureForDevelopment()
     12                        bootStrapDemoData()
    1413                        break
    1514            case "test":
    16                         println "**** BootStrap detected test"
    17                         configureForTest()
    1815                        break
    1916            case "production":
    20                         println "**** BootStrap detected production"
    21                         configureForProduction()
     17                        bootStrapDemoData()
    2218                        break
    2319        }
     
    2723    def destroy = {
    2824    }
    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()
    3428    {
    35         println "BootStrap configureForDevelopment() called"
     29        println "BootStrapping demo data..."
    3630   
    3731        //TypeOfPersonGroup
     
    5044        //Person
    5145        new Person(personGroup:PersonGroup.get(1),
    52                    firstName:"FirstNameTech1",
    53                    lastName:"LastNameTech1").save()
     46                   firstName:"Craig",
     47                   lastName:"SuperTech").save()
    5448        new Person(personGroup:PersonGroup.get(2),
    5549                   firstName:"Joe",
    5650                   lastName:"Samples").save()
     51        new Person(personGroup:PersonGroup.get(1),
     52                   firstName:"Production",
     53                   lastName:"Mann").save()
    5754               
    5855        //TaskGroup
     
    8279        new EntryType(name:"Fault").save()
    8380        new EntryType(name:"WorkDone").save()
     81        new EntryType(name:"Production Report").save()
    8482
    8583        //ModificationType
     
    9391        new ModificationType(name:"AssignedToModified").save()
    9492        new ModificationType(name:"NameModified").save()
    95 
    96 
     93       
     94        println "BootStrapping demo data...completed."
    9795   
    98     }
    99    
    100     //---------------------------------------------------------
    101     void configureForTest()
    102     {
    103         println "BootStrap configureForTest() called"
    104     }
    105    
    106     //---------------------------------------------------------
    107     void configureForProduction()
    108     {
    109         println "BootStrap configureForProduction() called"
    11096    }
    11197
  • trunk/src/grails-app/conf/DataSource.groovy

    r16 r39  
    1010    cache.provider_class='com.opensymphony.oscache.hibernate.OSCacheProvider'
    1111}
    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.
    1317environments {
    1418        development {
     
    2630        production {
    2731                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"
    3036                }
    3137        }
Note: See TracChangeset for help on using the changeset viewer.