module bundling

I haven’t been able to find much about using commandbox for creating bundles of modules in my app. I was looking to place a bulk of the basic modules (validation, messagebox etc) all into a bundle folder “coldbox-bundle”. I know I can move these all by hand and then edit all of the box.json files but is there a way to move all of these via commandbox so each module’s box.json files stay accurate with locations of each module and the app’s box.json file? Thanks.

Honestly, CommandBox doesn’t know anything about module bundles nor does it really handle them. The ability to bundle modules was something contributed to ColdBox in a pull request late® in ColdBox 4.0 development and no work was ever added to CommandBox to really handle it. I think it’s interesting, but personally I’ve not a huge fan of it since it screws up the conventions of how modules are structured. I think if you’re installing your modules by hand, you can do it to organize them, but if you’re going to be using a package manager to install them you shouldn’t really need to worry about grouping together modules for the sake of folder organization. All you need to worry about is:

install foobar
update foobar
and uninstall foobar

and where foobar lives is just an implementation detail that the package manager takes care for you.

That’s just my opinion though, I’m open to other thoughts on it.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Since modules install to modules folder… and like 3rd parties library dependencies you don’t want them in your git repo… that we could update the template coldbox app to have a .git ignore that ignores the modules folder, and have a 2nd modules folder, modules-private for normal development.
We can add the extra mapping to the coldbox config too.

Change the way coldbox works, I think the way the PackageManager part works, is good.

I hope this makes sense?
I might blog about it later.

Gavin Pickin
gpickin@gmail.com
http://www.gpickin.com

Yea both are good feedback guys, I just wanted to make sure I wasn’t misunderstanding how the modules setup should be used. You both clarified it for me. I am working on setting up a “starter app” so I can quickly throw what I need into my project and getting rolling on new apps down the road and since coldbox broke a lot of key pieces into modules I thought I would organize those back together in a bundle. Thanks again.

Another thing to remember, a module can have modules too… which might get confusing.

Trying to be clearer, this is what I am going to use

/modules - downloaded from forge box with commandBox
/modules-private - modules I create, that I do not want in the open source world.

Inside /config/coldbox.cfc file you can set your conventions in the convention struct

//Conventions
conventions = {
handlersLocation = “controllers”,
pluginsLocation = “plugins”,
viewsLocation = “views”,
layoutsLocation = “views”,
modelsLocation = “model”,
modulesLocation = “modules,modules-private",
eventAction = “index”
};

I believe, you can enter a comma separated list, since its passed into Wirebox to do the mappings.
I guess I’ll have to play and see.

then in /.gitignore you can ignore all forgebox modules by just ignoring the modules folder.
/coldbox
/modules/*

If you do not separate them it just makes GIT life a little tricker, or bloated, keeping track of files you’re not even touching.

Gavin Pickin
gpickin@gmail.com
http://www.gpickin.com

Yeah, I’ve thought a little about the ignore stuff before. That’s how NPM works-- your “node_modules” folder is ignored and if you put anything in there you want to commit ,you’re “doing it wrong”. I think there’s a solid argument that could be made that ALL modules-- even private modules should have a separate package/repo and you “install” that module into your app. NPM (and soon, CommandBox too) allow you to install modules from local repositories, directories, zip files, etc so the private modules could still be right there on your hard drive, but still in their own little repo. I’m not sure ColdBox is that opinionated of a framework though to demand people treat their modules that way.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

> I believe, you can enter a comma separated list, since its passed into Wirebox to do the mappings.

No, the conventions just point to one folder. You’re probably think of the modules external location which is an array You can set as many folders in there as you like.

coldbox.modulesExternalLocation = [ ‘modules-private’ ]

conventions = {
modulesLocation = “modules"
};

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

What I THINK commandBox / forgebox should do then is create a fb_modules folder and store its stuff in there.
That way all the helper coldbox add modules etc wouldn’t put stuff in where forgebox puts stuff.

Keep it clean and tidy.
And then make the convention be modules still, which everyone is used to.
And then have Wirebox map the fb_modules as well.

That would mess with things, but I think its easier going forward for USERs, just not you guys.
Of course that is my opinion.

But if you make it so you have private modules in with forgebox ones, and the gitignore is on the folder, then I have to remember to setup each module as its own git repo, and thats just more headaches.
Trust me, i know people who have to have their ASSISTANT commit their code, you have to make it EASY lol.

Gavin Pickin
gpickin@gmail.com
http://www.gpickin.com

> I am working on setting up a “starter app” so I can quickly throw what I need into my project and getting rolling on new apps

Option 1: create a recipe that creates the app and install what you want
http://ortus.gitbooks.io/commandbox-documentation/content/recipes.html

Option 2: Just add them to the default box.json as dependencies and run the “install” command to install them all in one shot.
http://ortus.gitbooks.io/commandbox-documentation/content/packages/dependencies.html

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

ALL modules-- even private modules should have a separate package/repo and you “install” that module into your app. NPM (and soon, CommandBox too) allow you to install modules from local repositories,

That is exactly what I need :wink: having my private modules ina local repository… or actually at work we have the modules in company wide shared folder and with it’s own repository.

Since our modules are re-used in different applications to control it over command box with dependencies and update functions would bring npm heaven to cfml.

Daniel

As of CommandBox 2.0 you can install from HTTP(s), file, folder, and ForgeBox.

install coldbox
install coldbox@4.0.0
install C:/myZippedPackages/foobar.zip
install C:/myUnzippedPackages/foobar/
install [http://site.com/foobar.zip](http://site.com/foobar.zip)
install [https://site.com/foobar.zip](https://site.com/foobar.zip)

Also note, on the horizon are private ForgeBox packages, and ForgeBox Enterprise.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks Brad. Looks that I didn’t realize it is already there in 2.0! Great work - I think command box is fantastic tool in the hand of cfml developers.

Daniel