Permalink
Browse files

switching to cloud foundry

  • Loading branch information...
1 parent d9a0d1b commit dc160f252c9fc2b02f116a18d24b6ffa9c9092b9 @ctoestreich committed Apr 23, 2012
@@ -6,26 +6,11 @@ import com.team4.s4b.domain.Recipient
class BootStrap {
+ def dataService
+
def init = { servletContext ->
- populateData()
+ dataService.populateData()
}
def destroy = {
}
-
- private populateData(){
-
-
- Benefactor b = Benefactor.build(name: 'Demo', password: '1234')
- BribePortfolio bp = BribePortfolio.build(name: 'Special Prizes', benefactor: b)
- Recipient r = Recipient.build(name: 'Kid A', benefactor: b)
-
-
- Bribe.build(name: 'Hot Wheels', probability: 10, availableCount: 2, bribePortfolio: bp)
- Bribe.build(name: 'Chocolate', probability: 15, availableCount: 3, bribePortfolio: bp)
- Bribe.build(name: '$100', probability: 1, availableCount: 1, bribePortfolio: bp)
- Bribe.build(name: 'Playtime', probability: 10, availableCount: 4, bribePortfolio: bp)
- Bribe.build(name: 'Movie', probability: 10, availableCount: 2, bribePortfolio: bp)
- Bribe.build(name: 'TV', probability: 10, availableCount: -1, bribePortfolio: bp)
- Bribe.build(name: 'Sleepover', probability: 5, availableCount: 3, bribePortfolio: bp)
- }
}
@@ -0,0 +1,12 @@
+package com.team4.s4b.controller
+
+class DataController {
+
+ def dataService
+
+ def reset() {
+ dataService.populateData()
+
+ forward(controller: 'shake')
+ }
+}
@@ -0,0 +1,30 @@
+package com.team4.s4b.service
+
+import com.team4.s4b.domain.*
+
+class DataService {
+
+ def populateData() {
+
+ if(BribeContract.list()) BribeContract.list()*.delete()
+ if(Bribe.list()) Bribe.list()*.delete()
+ if(Recipient.list()) Recipient.list()*.delete()
+ if(BribePortfolio.list()) BribePortfolio.list()*.delete()
+ if(Opportunity.list()) Opportunity.list()*.delete()
+ if(Benefactor.list()) Benefactor.list()*.delete()
+
+
+ Benefactor b = Benefactor.build(name: 'Demo', password: '1234')
+ BribePortfolio bp = BribePortfolio.build(name: 'Special Prizes', benefactor: b)
+ Recipient r = Recipient.build(name: 'Kid A', benefactor: b)
+
+
+ Bribe.build(name: 'Hot Wheels', probability: 10, availableCount: 2, bribePortfolio: bp)
+ Bribe.build(name: 'Chocolate', probability: 15, availableCount: 3, bribePortfolio: bp)
+ Bribe.build(name: '$100', probability: 1, availableCount: 1, bribePortfolio: bp)
+ Bribe.build(name: 'Playtime', probability: 10, availableCount: 4, bribePortfolio: bp)
+ Bribe.build(name: 'Movie', probability: 10, availableCount: 2, bribePortfolio: bp)
+ Bribe.build(name: 'TV', probability: 10, availableCount: -1, bribePortfolio: bp)
+ Bribe.build(name: 'Sleepover', probability: 5, availableCount: 3, bribePortfolio: bp)
+ }
+}
View
@@ -1,122 +1,14 @@
<!doctype html>
<html>
- <head>
- <meta name="layout" content="main"/>
- <title>Welcome to Grails</title>
- <style type="text/css" media="screen">
- #status {
- background-color: #eee;
- border: .2em solid #fff;
- margin: 2em 2em 1em;
- padding: 1em;
- width: 12em;
- float: left;
- -moz-box-shadow: 0px 0px 1.25em #ccc;
- -webkit-box-shadow: 0px 0px 1.25em #ccc;
- box-shadow: 0px 0px 1.25em #ccc;
- -moz-border-radius: 0.6em;
- -webkit-border-radius: 0.6em;
- border-radius: 0.6em;
- }
-
- .ie6 #status {
- display: inline; /* float double margin fix http://www.positioniseverything.net/explorer/doubled-margin.html */
- }
-
- #status ul {
- font-size: 0.9em;
- list-style-type: none;
- margin-bottom: 0.6em;
- padding: 0;
- }
-
- #status li {
- line-height: 1.3;
- }
-
- #status h1 {
- text-transform: uppercase;
- font-size: 1.1em;
- margin: 0 0 0.3em;
- }
-
- #page-body {
- margin: 2em 1em 1.25em 18em;
- }
-
- h2 {
- margin-top: 1em;
- margin-bottom: 0.3em;
- font-size: 1em;
- }
-
- p {
- line-height: 1.5;
- margin: 0.25em 0;
- }
-
- #controller-list ul {
- list-style-position: inside;
- }
-
- #controller-list li {
- line-height: 1.3;
- list-style-position: inside;
- margin: 0.25em 0;
- }
-
- @media screen and (max-width: 480px) {
- #status {
- display: none;
- }
-
- #page-body {
- margin: 0 1em 1em;
- }
-
- #page-body h1 {
- margin-top: 0;
- }
- }
- </style>
- </head>
- <body>
- <a href="#page-body" class="skip"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
- <div id="status" role="complementary">
- <h1>Application Status</h1>
- <ul>
- <li>App version: <g:meta name="app.version"/></li>
- <li>Grails version: <g:meta name="app.grails.version"/></li>
- <li>Groovy version: ${org.codehaus.groovy.runtime.InvokerHelper.getVersion()}</li>
- <li>JVM version: ${System.getProperty('java.version')}</li>
- <li>Reloading active: ${grails.util.Environment.reloadingAgentEnabled}</li>
- <li>Controllers: ${grailsApplication.controllerClasses.size()}</li>
- <li>Domains: ${grailsApplication.domainClasses.size()}</li>
- <li>Services: ${grailsApplication.serviceClasses.size()}</li>
- <li>Tag Libraries: ${grailsApplication.tagLibClasses.size()}</li>
- </ul>
- <h1>Installed Plugins</h1>
- <ul>
- <g:each var="plugin" in="${applicationContext.getBean('pluginManager').allPlugins}">
- <li>${plugin.name} - ${plugin.version}</li>
- </g:each>
- </ul>
- </div>
- <div id="page-body" role="main">
- <h1>Welcome to Grails</h1>
- <p>Congratulations, you have successfully started your first Grails application! At the moment
- this is the default page, feel free to modify it to either redirect to a controller or display whatever
- content you may choose. Below is a list of controllers that are currently deployed in this application,
- click on each to execute its default action:</p>
-
- <div id="controller-list" role="navigation">
- <h2>Available Controllers:</h2>
- <ul>
- <g:each var="c" in="${grailsApplication.controllerClasses.sort { it.fullName } }">
- <li class="controller"><g:link controller="${c.logicalPropertyName}">${c.fullName}</g:link></li>
- </g:each>
- </ul>
- </div>
- </div>
- </body>
+<head>
+ <meta name="layout" content="main"/>
+ <title>Shake 4 Bribe</title>
+</head>
+
+<body>
+<g:link controller="shake" action="index">Go Shake 4 Bribe</g:link><BR>
+<g:link controller="benefactor" action="list">Manage Benefactor</g:link><Br>
+<g:link controller="recipient" action="list">Manage Recipient</g:link><Br>
+<g:link controller="data" action="reset">Reset Data</g:link>
+</body>
</html>
@@ -18,7 +18,7 @@
<r:layoutResources />
</head>
<body>
- <div id="grailsLogo" role="banner">SHAKE 4 BRIBE</div>
+ <div id="grailsLogo" role="banner"><p align="center">SHAKE 4 BRIBE</p></div>
<g:layoutBody/>
<div class="footer" role="contentinfo"></div>
<div id="spinner" class="spinner" style="display:none;"><g:message code="spinner.alt" default="Loading&hellip;"/></div>
@@ -13,7 +13,7 @@
<body>
<div style="padding: 5px">
- <g:link controller="bribeContract" action="list">Bribe Contracts</g:link>
+ <g:link controller="bribeContract" action="list">Bribe Contracts</g:link>&nbsp;|&nbsp;<g:link controller="data" action="reset">Reset Database</g:link>
<g:formRemote name="myForm" on404="alert('not found!')" onSuccess="logBribe(data, status)"
url="[controller: 'shake', action: 'shake']">
<g:hiddenField name="benefactor.id" value="${benefactor.id}" />
@@ -24,18 +24,13 @@
<sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/build-test-data-2.0.2/grails-app/i18n" isTestSource="false" />
<sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/build-test-data-2.0.2/grails-app/services" isTestSource="false" />
</content>
- <content url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-support-1.0.8">
- <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-support-1.0.8/src/groovy" isTestSource="false" />
+ <content url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-foundry-1.2.1">
+ <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-foundry-1.2.1/src/java" isTestSource="false" />
+ <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-foundry-1.2.1/src/groovy" isTestSource="false" />
+ <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-foundry-1.2.1/grails-app/taglib" isTestSource="false" />
</content>
- <content url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/database-session-1.1.2">
- <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/database-session-1.1.2/src/java" isTestSource="false" />
- <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/database-session-1.1.2/grails-app/jobs" isTestSource="false" />
- <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/database-session-1.1.2/grails-app/domain" isTestSource="false" />
- <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/database-session-1.1.2/grails-app/services" isTestSource="false" />
- </content>
- <content url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/heroku-1.0.1">
- <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/heroku-1.0.1/src/groovy" isTestSource="false" />
- <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/heroku-1.0.1/grails-app/taglib" isTestSource="false" />
+ <content url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-support-1.0.9">
+ <sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-support-1.0.9/src/groovy" isTestSource="false" />
</content>
<content url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/hibernate-2.0.3">
<sourceFolder url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/hibernate-2.0.3/grails-app/i18n" isTestSource="false" />
@@ -61,9 +56,14 @@
<orderEntry type="library" scope="PROVIDED" name="grails-2.0.3" level="application" />
<orderEntry type="module-library" exported="">
<library name="Grails User Library (shake4bribe-grailsPlugins)">
- <CLASSES />
+ <CLASSES>
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.jackson/jackson-mapper-asl/jars/jackson-mapper-asl-1.4.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.jackson/jackson-core-asl/jars/jackson-core-asl-1.4.1.jar!/" />
+ <root url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-foundry-1.2.1/lib" />
+ </CLASSES>
<JAVADOC />
<SOURCES />
+ <jarDirectory url="file://$USER_HOME$/.grails/2.0.3/projects/shake4bribe/plugins/cloud-foundry-1.2.1/lib" recursive="false" />
</library>
</orderEntry>
</component>
View
@@ -47,6 +47,8 @@
<library name="Grails User Library (shake4bribe)">
<CLASSES>
<root url="file://$MODULE_DIR$/lib" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.jackson/jackson-mapper-asl/jars/jackson-mapper-asl-1.4.1.jar!/" />
+ <root url="jar://$USER_HOME$/.grails/ivy-cache/org.codehaus.jackson/jackson-core-asl/jars/jackson-core-asl-1.4.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

0 comments on commit dc160f2

Please sign in to comment.