Box install does not install deps defined in box.json

So I run “box install” in a directory with an existing box.json and it is asking me for a slug to install.

My box.json looks like this (certain names changed to “myproject”):

{
“name”:“myproject”,
“version”:“2.6.2”,
“author”:“Sean Coyne my@email.com”,
“location”:"",
“directory”:"",
“Homepage”:“https://myproject.org/”,
“Documentation”:“See README.md”,
“Repository”:{
“type”:“git”,
url":"git@bitbucket.org:seancoyne/myproject.git”
},
“Bugs”:“https://bitbucket.org/seancoyne/myproject/issues”,
“slug”:“myproject”,
“shortDescription”:“My Project”,
“description”:“My Project”,
“instructions”:“See README.md”,
“changelog”:“See README.md”,
“type”:“application”,
“keywords”:[

],
“private”:true,
“engines”:[
{
“type”:“adobe”,
“version”:">=9.0.1"
}
],
“defaultEngine”:“adobe”,
“defaultPort”:80,
“ProjectURL”:“https://myproject.org/”,
“License”:[
{
“type”:“NONE”,
“url”:""
}
],
“Contributors”:[

],
“Dependencies”:{

},
“DevDependencies”:{
“mockbox”: “3.0.0.00028”
},
“ignore”:[
“logs*”,
“readme.md”
],
“PACKAGENAME”:“myproject”
}

Now, since “box install mockbox --saveDev” is not working for me (see my other thread) I took a stab at guessing what the devDependencies object syntax should look like. I created the box.json with “box init” then updated the values.

So, first question is the syntax I used for the devDependencies object correct? If not what should that look like? (I assumed it was npm-like and looking at the commandbox source seems to have confirmed this)

Second question, shouldnt “box install” see the box.json and not ask for a slug?

Thanks

> Now, since “box install mockbox --saveDev” is not working for me

–param is just one way to pass boolean parameters that I added recently. named and positional args have always worked.
box install slug=mockbox saveDev=true

> So, first question is the syntax I used for the devDependencies object correct?

Yes, that looks correct, but keep in mind we are still doing a lot of work around dependency management. Not all features are 100% and we may need to make changes in the near future since this is all pre-release.

> Second question, shouldn’t “box install” see the box.json and not ask for a slug?

Yes, I’m pretty certain you’re just on an old version of the code.
Bleeding edge binaries are available here: http://www.ortussolutions.com/products/commandbox and you may need to remove your user/.CommandBox folder to ensure everything is wiped out.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

OK, so now that I am really on the latest version…

box install seems to work now. However, if a dep is already installed, I get an error. Shouldn’t it just skip dependencies that are already installed?

Output:

$ box install

Installing package: mockbox
Verifying package ‘mockbox’ in ForgeBox, please wait…
Verified entry in ForgeBox: ‘mockbox’
Package found in local artifacts!
BOOM GOES THE DYNAMITE!!
We’re truly sorry, but something horrible has gone wrong when starting up CommandBox.
Here’s what we know:.

directory [/Users/sean/Sites/ari/fdr.aesnet.org/mockbox] already exist

directory [/Users/sean/Sites/ari/fdr.aesnet.org/mockbox] already exist
at railo.runtime.tag.Directory.actionCreate(Directory.java:573):573
at railo.runtime.functions.file.DirectoryCreate.call(DirectoryCreate.java:24):24
at railo.runtime.functions.file.DirectoryCreate.call(DirectoryCreate.java:19):19
at railo.runtime.functions.file.DirectoryCreate.call(DirectoryCreate.java:15):15
at system.services.artifactservice_cfc$cf.udfCall2(/commandbox/system/services/ArtifactService.cfc:256):256
at system.services.artifactservice_cfc$cf.udfCall(/commandbox/system/services/ArtifactService.cfc):-1
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:92):92
at railo.runtime.type.UDFImpl._call(UDFImpl.java:306):306
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:194):194
at railo.runtime.ComponentImpl._call(ComponentImpl.java:624):624
at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1755):1755
at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:755):755
at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1564):1564
at system.services.packageservice_cfc$cf.udfCall1(/commandbox/system/services/PackageService.cfc:159):159
at system.services.packageservice_cfc$cf.udfCall(/commandbox/system/services/PackageService.cfc):-1
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:92):92
at railo.runtime.type.UDFImpl._call(UDFImpl.java:306):306
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:194):194
at railo.runtime.type.scope.UndefinedImpl.callWithNamedValues(UndefinedImpl.java:757):757
at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:755):755
at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1564):1564
at system.services.packageservice_cfc$cf.udfCall1(/commandbox/system/services/PackageService.cfc:238):238
at system.services.packageservice_cfc$cf.udfCall(/commandbox/system/services/PackageService.cfc):-1
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:92):92
at railo.runtime.type.UDFImpl._call(UDFImpl.java:306):306
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:194):194
at railo.runtime.ComponentImpl._call(ComponentImpl.java:624):624
at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1755):1755
at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:755):755
at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1564):1564
at commands.forgebox.install_cfc$cf.udfCall(/commandbox/commands/forgebox/install.cfc:87):87
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:92):92
at railo.runtime.type.UDFImpl._call(UDFImpl.java:306):306
at railo.runtime.type.UDFImpl.callWithNamedValues(UDFImpl.java:194):194
at railo.runtime.ComponentImpl._call(ComponentImpl.java:624):624
at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
at railo.runtime.ComponentImpl.callWithNamedValues(ComponentImpl.java:1755):1755
at railo.runtime.util.VariableUtilImpl.callFunctionWithNamedValues(VariableUtilImpl.java:755):755
at railo.runtime.PageContextImpl.getFunctionWithNamedValues(PageContextImpl.java:1564):1564
at system.services.commandservice_cfc$cf.udfCall1(/commandbox/system/services/CommandService.cfc:222):222
at system.services.commandservice_cfc$cf.udfCall(/commandbox/system/services/CommandService.cfc):-1
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:92):92
at railo.runtime.type.UDFImpl._call(UDFImpl.java:306):306
at railo.runtime.type.UDFImpl.call(UDFImpl.java:207):207
at railo.runtime.ComponentImpl._call(ComponentImpl.java:623):623
at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1738):1738
at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:724):724
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1554):1554
at system.shell_cfc$cf.udfCall2(/commandbox/system/Shell.cfc:379):379
at system.shell_cfc$cf.udfCall(/commandbox/system/Shell.cfc):-1
at railo.runtime.type.UDFImpl.implementation(UDFImpl.java:92):92
at railo.runtime.type.UDFImpl._call(UDFImpl.java:306):306
at railo.runtime.type.UDFImpl.call(UDFImpl.java:207):207
at railo.runtime.ComponentImpl._call(ComponentImpl.java:623):623
at railo.runtime.ComponentImpl._call(ComponentImpl.java:506):506
at railo.runtime.ComponentImpl.call(ComponentImpl.java:1738):1738
at railo.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:724):724
at railo.runtime.PageContextImpl.getFunction(PageContextImpl.java:1554):1554
at users.sean._commandbox46.cfml.system.bootstrap_cfm$cf.call(/Users/sean/.CommandBox/cfml/system/Bootstrap.cfm:36):36
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:913):913
at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:865):865
at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:206):206
at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:18):18
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2218):2218
at railo.runtime.PageContextImpl.execute(PageContextImpl.java:2185):2185
at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:332):332
at railo.runtime.engine.CFMLEngineImpl.cli(CFMLEngineImpl.java:625):625
at railo.loader.engine.CFMLEngineWrapper.cli(CFMLEngineWrapper.java:249):249
at railocli.CLIMain.run(CLIMain.java:75):75
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method):-2
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57):57
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43):43
at java.lang.reflect.Method.invoke(Method.java:606):606
at cliloader.LoaderCLIMain.main(LoaderCLIMain.java:210):210

> However, if a dep is already installed, I get an error.

Oops, good catch. This worked when I first tested it, but that directoryCreate() was a late addition and I forgot it complains if the directory is already there. I just committed a fix for it.

> Shouldn’t it just skip dependencies that are already installed?

Heh, well that’s easier said than done. NPM gets away with a lot because node is very opinionated about what your packages will be called, and where they will be installed. (node_modules). You have no control over this and therefore it is “easy” for Node to know where a package is installed to. (And if you move it, the docs say too bad for you)
Over in CFML land people don’t like being told what to do and we have NO standard packaging system or object creation library (like Node), unless of course you’re using ColdBox where we are hard at work solving those issues. (But then people complain about the oppressive “ColdBox way” )

When a package is installed, the logic goes like this:

  1. If the user specifies a directory to the command, use that
  2. If the package has a box.json that specifies a directory, use that
  3. Use the current working directory

So, if CommandBox wants to know if package “foo” is installed it’s not so simple. Yes, it can be done and we try really hard on the uninstall command, but we’re still working on how to better handle that and what is acceptable to just guess and tell people “tough luck” if they move it. So, keep in mind that the install command is not 100% complete. In fact, if you look on line 218 of PackageService in the installPackage() method, you’ll see the following comment :slight_smile:

// TODO: Logic here to determine if a satisfying version of this package
// is already installed here or at a higher level. if so, skip it.

We talked about it internally and for now we just always reinstall because it’s easy and shouldn’t cause too many issues.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Sending this in a separate message so it doesn’t get mixed in with my other replies. I wanted to say I’m very pleased seeing you trying stuff out and really do appreciate the feedback!
We’re almost ready to release out first beta, but haven’t advertised many of the new features, so I’m curious how you even know about things like the --flag syntax and “box install” commands as those are newer than even my last screencast I did on CommandBox. I’d like to know what information channels people are using to hear about CommandBox.

Also, this is the same info available in the help commands built into the shell, but I am attaching the first version of our HTML command docs. If you have the source code setup, you can also generate these by hitting /apidocs/CommandDocs.cfm. These will eventually (soon!) be hosted on ortussolutions.com along with the general help I’m about to start writing.

Thanks again, and keep the feedback coming. If you’re not already signed up for a JIRA account, do that so you can put in tickets too. This article applies to any of our open source projects: http://blog.coldbox.org/blog/how-to-create-a-jira-account-and-enter-coldbox-tickets

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

CommandBox-CommandDocs.zip (617 KB)

Heh, well that’s easier said than done. NPM gets away with a lot because node is very opinionated about what your packages will be called, and where they will be installed. (node_modules). You have no control over this and therefore it is “easy” for Node to know where a package is installed to. (And if you move it, the docs say too bad for you)
Over in CFML land people don’t like being told what to do and we have NO standard packaging system or object creation library (like Node), unless of course you’re using ColdBox where we are hard at work solving those issues. (But then people complain about the oppressive “ColdBox way” )

When a package is installed, the logic goes like this:

  1. If the user specifies a directory to the command, use that
  2. If the package has a box.json that specifies a directory, use that
  3. Use the current working directory

Ok, I follow that, but… if you know where to install it, then you should be able to know where to look to see if its installed. I’m not looking for something super intelligent, but if the directory already exists, maybe just print a console warning that it already exists or something like that.

For items 1 and 2 you should be able to just print a warning rather than just error out. For #3 I can see how that would be tricky.

Sending this in a separate message so it doesn’t get mixed in with my other replies. I wanted to say I’m very pleased seeing you trying stuff out and really do appreciate the feedback!
We’re almost ready to release out first beta, but haven’t advertised many of the new features, so I’m curious how you even know about things like the --flag syntax and “box install” commands as those are newer than even my last screencast I did on CommandBox. I’d like to know what information channels people are using to hear about CommandBox.

Just saw it when you guys first announced and have been following along. I even had a pull request accepted, and another denied :slight_smile: I watch the repo on github and keep my fork up to date so I see when the changes are made. For the --flag syntax, I did see you added that, but today when I tried it I just assumed it was “npm-like” and tried it. Then when it didn’t work I dug into the source code and found that it should have been working.

I plan to add some commands for FarCry since that is my framework/CMS of choice and what most of my clients are running on.

Also, this is the same info available in the help commands built into the shell, but I am attaching the first version of our HTML command docs. If you have the source code setup, you can also generate these by hitting /apidocs/CommandDocs.cfm. These will eventually (soon!) be hosted on ortussolutions.com along with the general help I’m about to start writing.

Cool, yeah docs are always helpful.

Thanks again, and keep the feedback coming. If you’re not already signed up for a JIRA account, do that so you can put in tickets too. This article applies to any of our open source projects: http://blog.coldbox.org/blog/how-to-create-a-jira-account-and-enter-coldbox-tickets

Yeah, I was set to add a ticket, don’t have an account yet, but I wanted to make sure it wasn’t something I was missing before logging a bug. As it turns out it was something i was missing :slight_smile:

Thanks!

No problem. Good work. I miss having npm/bower/etc when I work on CF stuff. Once this gets going I look forward do doing stuff like “box install fw1” instead of having to go up to github and grab a copy when I setup a new project for a client.

Well, it’s not “erroring out” any more and never was supposed to. LIke I said, I fixed that a few minutes ago on the bleeding edge.

And sure, there are ways to do it, but it’s a bigger conversation than we wanted to tackle right now which is why I put that comment in the code and moved on. Once we get to nested versions of the same dependency in a hierarchy, it gets pretty complicated. You can read more here:
https://www.npmjs.org/doc/cli/npm-install.html
https://www.npmjs.org/doc/files/npm-folders.html

Is there a particular issue you’re having with dependencies being reinstalled (Other than the error that I fixed)?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Well, it’s not “erroring out” any more and never was supposed to. LIke I said, I fixed that a few minutes ago on the bleeding edge.

Yeah, sorry, started typing out my response before I even read the part that you had already fixed that.

And sure, there are ways to do it, but it’s a bigger conversation than we wanted to tackle right now which is why I put that comment in the code and moved on. Once we get to nested versions of the same dependency in a hierarchy, it gets pretty complicated. You can read more here:
https://www.npmjs.org/doc/cli/npm-install.html
https://www.npmjs.org/doc/files/npm-folders.html

OK, no problem.

Is there a particular issue you’re having with dependencies being reinstalled (Other than the error that I fixed)?

Not right now. The only dep I have right now in this project is mockbox. I’ll let you know if I run into any others. I was just offering my $0.02.

That’s excellent Sean. Thanks for the feedback. We welcome people to start building out commands for other frameworks. The Preside CMS guys have already started doing that.

You can put commands on ForgeBox and set the “CommandBox Command” type. When installed, they don’t default to the current directory, but instead to the user commands directory. (user/.CommandBox/commands/) That is also a very recent addition.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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