How would you guys recommend handling the followin...
# box-products
p
How would you guys recommend handling the following. I am trying to build a package that has a dependency of another package. But I need one of the files of the dependent package to not override my main package. Using the ignore attribute in the box.json of my package doesn't help because it refers to files in my package not files in the dependent package.
b
@Peter Amiri I don't quite understand the issue
Are these modules?
Because the actual files for deps are nested in the file system in the
modules
folder
So it's literally not possible for another module to "overwrite" a file in the parent module
install a package like cborm and look at the file system and you'll see what I mean
Copy code
install cborm
p
Let me try to explain what I’m trying to do. So I’m trying to create a skeleton system for CFWheels similar to the ColdBox skeletons. I have my basic HelloWorld skeleton (https://github.com/bpamiri/cfwheels-template-helloworld). It basically has a views/main/index.cfm file in it. I also have a config/routes.cfm file in it. These are all the files my basic skeleton needs. When I do a box install git://github.com/bpamiri/cfwheels-template-helloworld#main the skeleton gets downloaded from my repository. Then the dependency setting in the box.json will download a copy of CFWheels from ForgeBox. The issue is CFWheels also has a /config/routes.cfm file in it and overwrites the one in my skeleton. I’m trying to figure out if there is a way to tell CommandBox to ignore that file when installing the dependency. I just need to change the default route in that routes file. So if it isn’t possible I may have to figure out how to change it after CFWheels gets installed.
b
@Peter Amiri I don't know anything about the structure of the CFWeels framework, but it sounds like you have poor separation of • application code • framework code
Take ColdBox for instance-- when you run
Copy code
install coldbox
you get ONLY THE FRAMEWORK. There are no files whatsoever downloaded that go in your actual application
p
LOL, I would agree with you. I’m just trying to see if I can do something without requiring the structure of the main code to be changed.
b
Plus, the entire framework goes in a subfolder called
/coldbox
so it's not even mixed into the application
I don't think there's much you can do as the setup of these packages doesn't seem to be very good in the first place
The framework package should contain only the framework and should go in its own folder
The app template should be another concern
This appears to be the main part of the issue https://github.com/cfwheels/cfwheels/blob/master/box.json#L8
The framework itself should not be expected to just dump in the root of the current folder
That has several related issues-- the biggest of which is • you can't uninstall it • you can't update it effectively (because of bullet #1)
It's rather important for package management that every package be in a dedicated subfolder. The
createpackageDirectory
flag was only there for backwards compat on some very old packages back when we first made CommandBox
I would recommend working with the CFWheels devs to clean up their repo and forgebox packages to properly separate out their framework code and app template code
As a hacky workaround, remove cfwheels as a dep to your package and made a task runner or custom command that • installs cfwheels • overlays your template code on top of it That's still really messy, but at least you have the final say
There's no way to force ignores onto someone else's package. Only they get to decide that.
@Peter Amiri
p
Thanks Brad. I figured as much and you’re right I could probably manually get around it only to have it fail the next time someone changes a directory or something silly like that. I’ll see what I can do to change the packages as you recommended.
b
@neokoenig ☝️
n
I did start a massive experimental rewrite which allows for wheels to be moved into it's own folder structure as a package using mappings: https://github.com/cfwheels/cfwheels/blob/move-wheels/wheels/V3NOTES.md But life is just so damn busy at the moment, I slightly lost the will to continue.
r
@Peter Amiri Not sure of everything you are trying to accomplish but I saw on another post something about making it easier for beginners to scaffold a hello world example. Couldn't you just build off something like this?
wheels scaffold helloworld
n
@risto he's already playing around with / improving the CLI
r
@neokoenig Woops! Didn't know
🙂 1
p
Ya. This all started with me wanting to create a hello world module that could be checked into ForgeBox. The idea being that anyone could come by and install the Wheels CLI and issue a command and have a simple Hello World app running. Creating a module with a views/main/index.cfm file was easy. Setting that module to be dependent on CFWheels was also easy. My module was small, it got installed and then CFWheels was pulled down and since views/main/index.cfm didn't exist in the core CFWheels module it was all good. But the route still pointed to wheels##wheels. So I figured no problem I'll just add a config/routes.cfm file as well into my module and change the wheels##wheels to main##index. But when the dependent CFWheels module was installed it would overwrite the route file in my module with the generic one again. After trying all kinds of ways of trying to get it to ignore the routes I found out that can't be done. I think I now have a handle on how this can be accomplished. I'm studying a little about CommandBox modules and ForgeBox before attempting to do this. I should have first stabs done by the end of the day and I'll post my results.