I’m evaluating SproutCore for possible use as a front end with an existing Grails application. How do people typically structure their SproutCore and Grails projects for this type of setup?
The SproutCore docs cover how to connect to a Grails back-end in the ToDos tutorial, but I haven’t yet seen a tutorial for how to integrate the two to build a single war file.
We would prefer to have everything bundled up by the ‘grails war’ task so that we can continue to simply deploy a single war file to deploy the entire application (including the SproutCore front end). So calling the sc-build command on the SC project during the ‘war’ step in the Grails project seems like a reasonable first step. But where in the grails web-app to place the generated SC stuff, etc.? Would love to hear how people are doing this so as to not reinvent the wheel.
I tend to think of RIAs as a separate project from any back-end they use. With SC in particular this is true, as SC is a full application stack for use in the browser. So my advice is the treat the SC client as a separate project.
As you have indicated in your question, the problem becomes how to deploy the SC project with your war. Fortunately the answer is not too bad. Check out the last section of
http://grails.org/doc/latest/guide/17.%20Deployment.html
You will see that you can hook into the grails build process easily. In there all you need to do is invoke the sc-build command and copy the files into where js files go in a war. Just make sure the paths in the gsps that bootstrap the client are correct. SC generates a default index.html, you can probably just use that (copy it to the appropriate place) when you hook into the grails deployment process.