Apologies if this should be obvious, but I haven’t yet fount the right solution.
Essentially, I have a task runner script that needs to initiate a an object which uses a extension. Precisely: FORGEBOX: cfspreadsheet
So, I’m trying to install the extension so that any user running the task from CommandBox CLI will be able to run the task / use the tag and extension.
and yes it did install and works IF I start server and try a script from my browser from http://127.0.0.1:54536/…
That’s all good, but I need it to work from a task runner script which I’m running from CLI. The extension should be available to any users running the task.
I’ve managed to get it working by placing the .lex file found here and saving it in:
In the mean time, you can do any of the following-- they’re really all about as good/bad as the rest:
Copy the lex file to the Lucee engine’s deploy folder for the CLI
Specify the LUCEE_EXTENSIONS env var in the environment where box is starting, which Lucee will pick up and process (there’s at least 3 ways of doing this)
Run the new Administrator(type,pw).updateExtension(id[,version]) example Micha put in the comments of the ticket above
Well yes, that would happen automatically. It’s not even possible to install an extension such that only some users of the CLi can use it. An extension is either installed or it’s not. And all users of the same CLI installation are using the same Lucee web/server context.
That’s just going to download the lex file and dump it into your current directory (or a Lucee server, if found in that folder), which has nothing to do with the actual Lucee engine powering the CLI.
Nope, it’s as good as any. I agree, it’s sort of lame, but again – I really wish my 5-year-old ticket had been completed a long time ago and I would have built in some functions into Task Runners to ask for extensions to be installed.
I could probably build something using Micha’s hacky workarounds but
I’d really rather it be a first class citizen of the language/engine
There’s not a lot of demand for this so I don’t think of it that often
The one you had above looks correct. You can check where the CommandBox home is by running the
info
command and looking at the CommandBox Home line. The Lucee engine that powers the CLI lives in the engine directory inside of that folder.
It depends on a number of things. For example, setting env vars in Windows is not the same as setting them in Linux. Based on your file path above, I’ll assume you’re on Windows. You can set the env var in
user variables for your user (under environment variables under system properties)
system variables (under environment variables under system properties)
with the SET or SETX shell builtin in the cmd terminal before you run box
as a Java system property in a command.properties file in the same directory as the box.exe (read automatically by convention)
as a Java system property specified as a JVM arg in a box.l4j.ini file in the same directory as the box.exe (read automatically by convention – only works on Windows)
So yeah, lots of options. Lucee will look EITHER for an env var or a java system property.
The first 3 options above are sort of crap. I’d recommend the penultimate one personally. It’s the most self contained and simplest.
So basically, wherever you have your box.exe living, create a commandbox.properties file and put something like this in it:
The next time you start box, it will download and install that extension, assuming it finds it in one of the extension providers. To confirm if it worked, check the deploy log in Lucee’s server context somewhere in the neighborhood of C:\Users\jdoe\.CommandBox\engine\cfml\cli\lucee-server\context\logs\deploy.log Or, just run something like this:
I must be doing something wrong, but setting the commandbox.properties as you mentioned and then listing the extensions inside the CLI doesn’t show it. I’ll search some more on this properties or env variables. Really appreciate your help with this one
Yeah, that means Lucee isn’t seeing it. Probably needs to be named differently. I THOUGHT Lucee looked for LUCEE_EXTENSIONS in both env vars and java properties, but maybe it doesn’t. Try this instead
Still not quite working, though getting somewhat better results in the deploy.log:
“INFO”,“main”,“03/02/2022”,“15:38:14”,“controller”,“no extension to add/install”
“INFO”,“main”,“03/02/2022”,“15:38:14”,“controller”,“extensions to install defined in env variable or system property:=037A27FF-0B80-4CBA-B954BEBD790B460E;name=cfspreadsheet;version=3.0.3”
“INFO”,“main”,“03/02/2022”,“15:38:14”,“controller”,“successfully installed extensions :null;=037A27FF-0B80-4CBA-B954BEBD790B460E;name=cfspreadsheet;version=3.0.3”
still reveal false after closing/reopening box.exe, and everytime, same new entries in deploy.log (when this works, it wont actually re-download the extension every time right?)
Hmm, interesting-- it defo looks like it installed correctly. Did you try using it?
Beats me. You’d have to check the Lucee source. This is one of the many reasons I’m a little salty my 5 year old ticket is just rotting away in the Lucee backlog. Someone did say if you added a specific version to the GUID it wouldn’t download if it was already installed. I haven’t tested it myself.
No worries, that’s what I was thinking may have happened. In your defense, this shouldn’t really be such a pain, but we’re sort of working with what we’re dealt Glad you’ve got yourself going again.