Installing a package with an empty directory attribute overwrites my box.json file

I noticed that if I install a package that has box.json directory attribute with an empty string it will overwrite my box.json file with the package box.json. I am not sure if this would be considered a bug or just something I need to be aware of when installing packages since this can be overridden by passing a command line parameter. Thoughts?

What version of CommandBox are you on? Can you point us to the package in question? I want to see what it’s “createpackageDirectory” property is. I thought I had put in a check for this once, but there’s a few million ways a package can install so I might have missed something. Then again, depending on the scenario, it might actually be desirable.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

The package was securityutil (cfml-security/box.json at master · foundeo/cfml-security · GitHub). I was using 2.0.0. but also tried it with 1.1.1 and got the same result.

Ahh yes, that package has createPackageDirectory set to true. I don’t think Pete wants that and I bugged him about it once but it boiled down to him not actually sure what that setting did.

Here’s the docs on how installation paths are calculated:
http://ortus.gitbooks.io/commandbox-documentation/content/packages/installing_packages/installation_path.html

When you install a package that isn’t covered by an installation convention (modules, etc) it gets put in the root of the site. By default, the package will be placed in a sub directory named after the slug. However, setting createPackageDirectory to false will forgo that sub directory and dump the package in the root. In these situations, the box.json is SUPPOSED to be ignored per this line of code if the current directory is already a package:

https://github.com/Ortus-Solutions/commandbox/blob/master/src/cfml/system/services/PackageService.cfc#L368

Basically if you’re installing a package into the web root and there is already a box.json present, CommandBox adds /box.json as an ignore pattern for that install.

After reviewing the code, I remembered why this isn’t working. Ignores used to always be obeyed, but ticket COMMANDBOX-106 changed that so the ignores only kick in when you do a --production install. That explains why this worked back when I wrote and tested it, but the behavior has since changed. Unless we can get Luis to change his mind about ticket 106, I’ll have to implement another internal way to skip the box.json file for development installs.

An alternative is that CommandBox has two types of ignores:

  1. ignore : files/folders that should never be installed with a package, ever. (build artifacts, CI meta files, etc)
  2. productionIgnore : files/folders that aren’t needed in production (API docs, readmes, etc)
    Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Jason, after some internal discussion, we reverted the changes introduced by COMMANDBOX-106 in a new ticket (COMMANDBOX-238). This will release Monday as part of 2.0.0.

Thansk!

~Brad

Thanks for the info Brad. I will be sure to check out the 2.0.0 release.