AIM: Create a desktop app(GUI) with Electron(Atom Shell), that runs a gem's commands from io.js.
1. The problem is that I want to know which is the best way to handle the commands call to the gem inside the system.
2. If the gem is not installed inside the system the desktop app is worthless. Which is the best way to handle this dependency?
EXAMPLE CODE THAT I'VE SORTED OUT
var spawn = require("child_process").spawn;
var jk = spawn('jekyll', ['serve']);
jk.stdout.on('data', function(data){
console.log(data.toString('utf8')); // WRITE IN THE CONSOLE GEM OUTPUT
});
Is that code a good way to execute the commands?.
My ideal scenario is "As a user I want to press a button that compile the site" -> On click then run the build command of the gem that will be handled by that code possibly.
Here's a contrived example using "ShellJS" and jekyll as the dependency:
The idea is to use which to check if gem is installed and then install the dependency. You can then use exec to run commands with that gem.