Acconut/brackets-nodejs

Allow execute shell commands

Closed this issue · 35 comments

Would it be possible to allow shell commands from the plugin eg/nodemon server.js or provide additional menu items for nodemon and/or node-theseus?

Of course. I've had thought about this but never had a usecase for it.
I'll have a look at it.
Until then you can make an npm start script.

Cool!

Also trying to find an extension that allows breakpoints in Brackets that
will debug somehow. There is one extension but I think it's dead
https://github.com/jdiehl/brackets-debugger

I will use this change and move the command builder from server.js directly into main.js.
I don't plan to make an entire IDE out of Brackets.
node-webkit-agent could be what you're looking for.

Thanks

WebKit project looks interesting!

I've used it several times but personally I prefer the built in debugger in node. node-webkit-agent had some bugs back then but it's cool.

Just thought there may be scenarios where you want to execute nodemon –debug app.js & node-inspector ie/2 at the same time

That's a good scenario but you should remember that the terminal isn't a real one. No input and bad displaying sometimes (e.g. npm). Later we could switch to https://github.com/chjj/tty.js/ which offers real terminal experience.

Yeah did see tty.js and thought about installing https://t.co/ypLFHGOTRPbut felt it was a bit OTT. I guess there needs to be a fine line somewhere.

@jchannon Please test the last commit before I'll publish it to the registry. You have to install it from github.

Cool. Will do

On 16 February 2014 10:28, Acconut notifications@github.com wrote:

@jchannon https://github.com/jchannon Please test the last commit
before I'll publish it to the registry. You have to install it from github.

Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-35181764
.

It outputs this no matter what i do

module.js:340
throw err;
^
Error: Cannot find module '/undefined'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
Programm exited.

On 16 February 2014 10:34, Jonathan Channon jonathan.channon@gmail.comwrote:

Cool. Will do

On 16 February 2014 10:28, Acconut notifications@github.com wrote:

@jchannon https://github.com/jchannon Please test the last commit
before I'll publish it to the registry. You have to install it from github.

Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-35181764
.

Well, that's wired. Are you sure this isn't produced by your code? Have you opened a file? Which OS are you running on? Try using the command execution with something like dir or ls.

Hi.

Yup tried ls and did the same.

I'm on OSX 10.9.1 and latest Brackets

On 16 February 2014 10:49, Acconut notifications@github.com wrote:

Well, that's wired. Are you sure this isn't produced by your code? Have
you opened a file? Which OS are you running on? Try using the command
execution with something like dir or ls.

Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-35187029
.

Might be my node version though. Its unstable.

On 16 February 2014 10:54, Jonathan Channon jonathan.channon@gmail.comwrote:

Hi.

Yup tried ls and did the same.

I'm on OSX 10.9.1 and latest Brackets

On 16 February 2014 10:49, Acconut notifications@github.com wrote:

Well, that's wired. Are you sure this isn't produced by your code? Have
you opened a file? Which OS are you running on? Try using the command
execution with something like dir or ls.

Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-35187029
.

Please also do the following:

  • Open Debug > Developer Tool or F12
  • Go to the Network tab
  • Use brackets-nodejs in some way.
  • Go to the networks tab and past me the last requested urls (They begin with something like "/?command=...")

I don't think it's your version since server.js is executed by Brackets' built-in node binary.

Hmm ,bear with me. Uninstalled node and install stable version but now
running node from your plugin I get

/bin/sh: node: command not found
Programm exited.

On 16 February 2014 10:56, Acconut notifications@github.com wrote:

Please also do the following:

  • Open Debug > Developer Tool or F12
  • Go to the Network tab
  • Use brackets-nodejs in some way.
  • Go to the networks tab and past me the last requested urls (They
    begin with something like "/?command=...")

I don't think it's your version since server.js is executed by Brackets'
built-in node binary.

Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-35193875
.

By default we just run node. As it seems your node binary isn't in the PATH and therefore can't be found. You either have to add it to the PATH env or (what I recommend) use the Nodejs > Configuration modal.
Remember you have to input the path to the binary not to it's directory (/bin/node and not /bin/, depending where you installed node to).

But this seems as if the extension works.

OK got node working.

Installed version in the registry and it executed my js file via node fine.

Installed from URL and it failed to run my file via node with same error as above

Ran brackets-nodejs via Developer Tools and got the below screenshot results

screen shot 2014-02-16 at 11 41 50

Here is a ls command

screen shot 2014-02-16 at 11 43 40

Does node work from the command line? If not add it to the PATH else set the path inside Brackets as I sad in my comment above.

node works from the command line

Jonathans-iMac:~ jonathanchannon$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
Jonathans-iMac:~ jonathanchannon$ node --version
v0.10.25

Here's the developer tools output from the previous version of the plugin when executing node

screen shot 2014-02-16 at 11 51 34

As far as I can see that issue is that node's exec function can't find node. To solve this set the path to node in Configuration.

Ok, done that and same 😦

screen shot 2014-02-16 at 11 56 20

Running "/usr/local/bin/node" /Users/jonathanchannon/Projects/jstestbed/greeting.js from Terminal works as expected

I don't see an issue with the extension. Please post your code to see whether there's the issue.

var personGreeter = (function () {
'use strict';

var test = "poo";

var personGreeter = function (spec) {
    var that = this;
    var name = spec.greeting || "";
    var greeter = function () {
        return "Hello " + name + test;
    };

    var getname = function () {
        return name;
    };

    return {
        greet: greeter,
        getname: getname
    };
};

return personGreeter;

}());

var fredPerson = personGreeter({
greeting: 'fred'
});
console.log(fredPerson.greet());

var jimPerson = personGreeter({
greeting: 'jim'
});
console.log(jimPerson.greet());

console.log(fredPerson.getname());

Ah, I think I got the error: Somehow the command node /undefined is executed. Node is trying to find /undefined but it fails, obviously. Your code and environment seems to be fine. I'll just need to find the bug.

Wait? Did you restart Brackets after installing the new version of brackets-nodejs? If not please do!

ROFL!

That was it :)

Weird seeing as Brackets says when the new version is installed, "Reload
with Extensions?" which I said yes to!

Awesome work, thanks!

Haha, it's 2014 and restarting is still a solution. Thank you for your patience while I tried to figure it out. :)

Thank you for such a quick implementation. Great example of OSS.

Also check out http://gitter.im, it allows you to chat via IM and interact
with your Github repos. Suddenly thought of it and would have been good in
this scenario!

Are you on Twitter?

On 16 February 2014 12:57, Acconut notifications@github.com wrote:

Haha, it's 2014 and restarting is still a solution. Thank you for your
patience while I tried to figure it out. :)

Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-35196053
.

That's a good service. Hopefully I'll remember it.
I'm @Acconut_ but don't expect me to tweet much. :)

OK :)

Gimme a shout when you put it in the Brackets registry and I'll put a tweet
out!

On 16 February 2014 13:02, Acconut notifications@github.com wrote:

That's a good service. Hopefully I'll remember it.
I'm @Acconut_ https://twitter.com/Acconut_ but don't expect me to tweet
much. :)

Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-35196138
.

Just a quick update.

If you run npm install async via the Execute Command menu item it doesnt
seem to do anything

On 16 February 2014 13:04, Jonathan Channon jonathan.channon@gmail.comwrote:

OK :)

Gimme a shout when you put it in the Brackets registry and I'll put a
tweet out!

On 16 February 2014 13:02, Acconut notifications@github.com wrote:

That's a good service. Hopefully I'll remember it.
I'm @Acconut_ https://twitter.com/Acconut_ but don't expect me to
tweet much. :)

Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-35196138
.

I want to implement a button to rerun the last command. When I've done this I'll bump the version and push to the registry. Today or tomorrow.