jcberquist / sublimetext-cfml

CFML (ColdFusion and Lucee) package for Sublime Text
MIT License
115 stars 24 forks source link

CommandBox path? #14

Closed atuttle closed 8 years ago

atuttle commented 8 years ago

CommandBox integration seems pretty awesome!

I installed CommandBox via homebrew (OSX), which puts it here:

$ which box
/usr/local/bin/box

My system path definition (at least in zshell...) is:

echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/atcodes/.bin/:/Users/atcodes/.npm_globals/bin

When I try to run a build from sublime, I get:

[Errno 2] No such file or directory: 'box'
[cmd: ['box', 'foo.cfm']]
[dir: /Users/atcodes/Desktop]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

It's clear that the path list is not the same, and I expect this is because I use zshell instead of the system default bash.

I can symlink /usr/local/bin/box to /usr/bin/box with ln -s /usr/local/bin/box /usr/bin/box (and then it works fine) but this is a little bit of a dirty hack. I'm curious if you know how to adjust the path list that Sublime is using.

jcberquist commented 8 years ago

To execute files via CommandBox I use the ST build system, you can see the config here: https://github.com/jcberquist/sublimetext-cfml/blob/master/build/CFML.sublime-build

The line that matters here is "cmd": ["box", "$file_name"]. I don't think that runs via a shell, so that might be why the PATH doesn't match (though perhaps not, as you don't use bash). If you would be willing to try, you could save a copy of CFML.sublime-build to your User package folder so that it overrides this one, and change that line to "shell_cmd": "box $file_name" (You might have to restart ST to get that change picked up.) That will run box via cmd.exe on Windows and /bin/bash on OSX and Linux. That might get the path sorted out; if it does, I will update the package to run box via a shell since that will work on Windows as well.

If not, there is another argument you can add to that build file: path. This lets you set the PATH with which to run the command, so you could add the path to box there. It does look like you can use $PATH in that so you could try "path": "$PATH:/usr/local/bin".

I hope this helps!

jcberquist commented 8 years ago

@atuttle: sorry to ping you after so long, but I am guessing this is not an issue for you anymore? (One way or another.)

I do have access to a Mac (though I am not very familiar with it), and I just installed CommandBox via homebrew - like you said, it gets installed at /usr/local/bin/box. I am able to run the build command successfully in ST after the switch to a shell command that happened here: https://github.com/jcberquist/sublimetext-cfml/commit/9f00aa663096fc90b9ba91eb0f83c79172c48757

I tested with the previous version of the build file (that had "cmd": ["box", "$file_name"]), and I saw the same error you reported. So I do think the switch has fixed this issue and I would like to close it :smile: .

atuttle commented 8 years ago

Go ahead and close it. I haven't tried to use commandbox in a while and don't even recall what I was doing to test it. :)