Example of bpm with spade ?

12 views
Skip to first unread message

Rob Monie

unread,
Aug 18, 2011, 7:50:27 AM8/18/11
to get...@googlegroups.com
Hi guys... 

I started checking out bpm and spade today (with sproutcore) and am a bit unsure of how to wire everything up. I managed to get a build of sproutcore with the datastore and statechart frameworks which gave me bpm_libs.js. That was step one and is useful enough in itself as I can start building an app with that alone, but i'd like to explore how i'd use bpm for continued development and how this compares to something like the asset pipeline in rails.

Is there a simple example app of showing how to use bpm along with spade ? I can't help but think i'm missing something really obvious about how to bootstrap it but I couldn't get something working based on the docs i've been able to find. 

cheers,
rob

Jeff Schilling

unread,
Aug 18, 2011, 7:59:23 AM8/18/11
to get...@googlegroups.com
Rob,

I don't think you're missing anything :-(

There are a few examples out there, but most are for the sc20 packages themselves.

There a few scattered bpm enabled examples out there (but most I found were using earlier versions of bpm)

a bpm rebuild will gen two assets/bpm files - one for dependencies (loaded first) and then one for my app.

I've laid out my project.json file thusly:

{
"name": "Project",
"bpm": "1.0.0",
"bpm:build": {
"bpm_libs.js": {
"spade:format": "function",
"directories": [
]
},
"bpm_styles.css": {
"directories": [

]
},
"Project/bpm_libs.js": {
"spade:format": "function",

"directories": [
"lib",
"templates"
]
},
"Project/bpm_styles.css": {
"directories": [
]
}
},
"dependencies:development": {
"spade-qunit": "~> 1.0.0",
"qunit": ">= 0"
},
"dependencies": {
"jquery": ">= 0",
"spade": ">= 0",
"uglify-js": ">= 0",
"sproutcore": ">= 0-pre",
"sproutcore-datastore": ">= 0-pre"
}

}

and in my html file I bootstrap thusly:

<!-- load all of the dependencies -->
<script type="text/javascript" src="assets/bpm_libs.js"></script>
<!-- load my app assets -->
<script type="text/javascript" src="assets/Project/bpm_libs.js"></script>
<script type="text/javascript">
spade.ready(function() {
console.log("spading main now");
spade.require('Project/main');
});
</script>

All of my app code is in

./lib
./models
./views
./controllers

etc

my .lib/main.js file bootstraps the balance of my app
require("sproutcore");
require("sproutcore-datastore");

Project = SC.Application.create({
store: SC.Store.create().from(SC.Record.fixtures)
});

require ('./models');
require ('./controllers');

require ('./views');
require ('./core');

HTH
-jeff

Rob Monie

unread,
Aug 18, 2011, 8:06:31 AM8/18/11
to get...@googlegroups.com, get...@googlegroups.com
Thanks Jeff... that's exactly what i'm after!

-rob

Peter Wagenet

unread,
Aug 18, 2011, 12:22:59 PM8/18/11
to get...@googlegroups.com
There are some docs on the BPM github READMe and wiki.
We'll be working on getting more up soon.
Also, if you have questions, please checkout #getbpm on IRC.

-Peter

David Feinberg

unread,
Oct 13, 2011, 2:39:59 PM10/13/11
to get...@googlegroups.com, get...@googlegroups.com
Thanks for sharing your project.json file. I'm also trying to use Spade/BPM with Sproutcore 2.0. Is there anyway to get Spade to dynamically include/update files so you can see changes as you're developing? Seems like the only option is to run bpm rebuild for every change you make, is that the case? 

Peter Wagenet

unread,
Oct 13, 2011, 2:41:00 PM10/13/11
to get...@googlegroups.com
If you use `bpm preview` it should do this automatically.

-Peter

David Feinberg

unread,
Oct 13, 2011, 2:43:09 PM10/13/11
to get...@googlegroups.com, get...@googlegroups.com
Anyway to do this without BPM preview? The project is part of a larger app that using PHP.

Peter Wagenet

unread,
Oct 13, 2011, 4:33:58 PM10/13/11
to get...@googlegroups.com
So you want an auto-rebuild of sorts. Currently, we don't have anything like that.
You might be able to set up a script that watches your files and runs rebuild.

-Peter

Reply all
Reply to author
Forward
0 new messages