How to use the shelljs.exec function in shelljs

To help you get started, we’ve selected a few shelljs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / react-native / scripts / run-android-ci-instrumentation-tests.js View on Github external
tryExecNTimes(() => {
      echo(`Starting ${testClass}`);
      // any faster means Circle CI crashes
      exec('sleep 10s');
      return exec(
        `./scripts/run-instrumentation-tests-via-adb-shell.sh ${
          argv.package
        } ${testClass}`,
      ).code;
    }, numberOfRetries)
  ) {
github Dugnist / jsberry / tasks / install.js View on Github external
type.substring(0, (type.length - 1))
            }`) === -1 && !checkForExternal
        ) throw new Error(`Not found "${pluginName}" in ${type}!\n`);
        
        // check current directory to exist required directories/files
        if (
            fs.existsSync(`${currentPath}/src`) &&
            fs.existsSync(`${currentPath}/src/${type}`) &&
            fs.existsSync(`${currentPath}/package.json`)
        ) {
            console.log(chalk.green(`Installing ${pluginName} ${
                type.substring(0, (type.length - 1))
            } for JSBerry \n`));

            // try to clone module/plugin 
            shell.exec(
                `git clone ${
                    checkForExternal ? pluginName : modulesList[pluginName]
                } ${outputPath}`
            ).output;

            // get data from plugin config
            const {
                name = pluginName, install = [], postinstall = ''
            } = require(`${outputPath}/config.json`);

            const tick = setInterval(() => process.stdout.write('.'), 500);
            const commands = install.map((m) => `npm i ${m}`).join(' && ');
            const installProcess = exec(commands);

            installProcess.stdout.on('data', (data) => {
                process.stdout.write(data.toString());
github kickstarts / kickstarts / init / bp-ionic.js View on Github external
// Setup
// ----------------------------------

sh.echo(info('→ Setting up project...'));

// Move on to "./src" folder
sh.cd('./src');

// Check if NodeJS exists and install dependencies
if (!nodeCheck) {
    sh.echo(error('✖ This task requires NodeJS to run.'));
    process.exit(1);
} else {
    sh.echo(info('→ Installing dependencies....'));
    sh.exec('bower install');
    sh.exec('npm install');
    sh.echo(done('✔ Node Modules successfully installed!'));

}

sh.echo(done('✔ All Done!'));
github webcom-components / reach / deploy-gh-pages.js View on Github external
index.end();

// Copy coverage report
mkdir('-p', path.join(esdoc, 'coverage'));
cp('-r', path.join(coverage, 'html', '*'), path.join(esdoc, 'coverage'));

// Copy bundle analysis report
mkdir('-p', path.join(esdoc, 'analysis'));
cp(path.join(__dirname, 'bundleAnalysis.html'), path.join(esdoc, 'analysis', 'index.html'));
cp(path.join(__dirname, 'bundleAnalysis.json'), path.join(esdoc, 'analysis', 'stats.json'));

// deploy gh pages
cd(esdoc);
exec('git init');
exec('git config user.name "webcomOps"');
exec('git config user.email "webcom.ops@orange.com"');
exec('git add .');
exec('git commit -m "Deploy to GitHub Pages"');
exec(`git push --force --quiet "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" master:gh-pages > /dev/null 2>&1`);
github leonardoanalista / corp-semantic-release / src / lib / addFilesAndCreateTag.js View on Github external
module.exports = function addFilesAndCreateTag(newVersion, mockPush, ciSkip) {
  let code;
  // ###### Add edited files to git #####
  log.info('>>> About to add and commit package.json and CHANGELOG...');
  code = shell.exec('git add package.json CHANGELOG.md').code;
  terminateProcess(code);

  // ###### Commit files #####
  const commitMessage = 'git commit -m "chore(release): ' + newVersion
    + (ciSkip ? ' [ci skip] ***NO_CI***' : '') + '"';
  code = shell.exec(commitMessage).code;
  terminateProcess(code);

  // ###### TAG NEW VERSION #####
  log.info(`>> Time to create the Semantic Tag: ${newVersion}`);
  code = shell.exec('git tag ' + newVersion).code;
  terminateProcess(code);

  // ###### PUSH CHANGES #####
  log.info('>>...and push to remote...');
  if (mockPush === undefined) {
    code = shell.exec('git push && git push --tags').code;
  } else {
    log.info(`mocking git push with return code ${mockPush}`);
    code = mockPush;
  }
  terminateProcess(code);
github schmich / connect-browser-sync / gulpfile.js View on Github external
gulp.task('npm:publish', function(next, err) {
  log('Creating package...');

  var result = shell.exec('npm pack', { silent: true });
  if (result.code == 0) {
    log('OK');
  } else {
    // TODO: Better error.
    error('Error creating package:\n' + result.output);
    next();
    return;
  }

  var archive = result.output.trim();
  shell.exec('tar -ztvf "' + archive + '"');

  var question = {
    type: 'confirm',
    name: 'publish',
    message: 'Publish package?',
github sulu-one / sulu / app / packages / sulu-file-system-view-copy / index.js View on Github external
var run = function() { 
					if(started) return;
					started = true;
					var shelljs = require("shelljs");
					var selection = view.selected();
					var files = [];
					for (var i = selection.length - 1; i >= 0; i--) {
						var item = selection[i];
						files.push("\"" + path.join(item.path, item.name) + item.ext + "\"");
					}
					var target = self.app.GUI.target.model.path;
					var cmd = "cp -r " + files.join(" ") + " " + "\"" + target + "\"";
				  	console.debug(cmd);

					win.eval("log('<span>' + " + JSON.stringify(cmd) + " + '...<span>')");
					var child = shelljs.exec(cmd, {async:true}, function(code,out,err){ 
						if (out !== ""){
							win.eval("log('<span>' + " + JSON.stringify("done") + " + '<span>')");						
						}
						if (err !== ""){
							win.eval("log('<span class="error">' + " + JSON.stringify("done") + " + '<span>')");
						}
						if (err === "" &amp;&amp; out === ""){
							win.eval("log('<span>' + " + JSON.stringify("ok") + " + '<span>')");						
							win.close()
						}
						self.app.GUI.target.model.refresh();
					});
					child.stdout.on("data", function(data) {
						window.removeEventListener("message", readyEventListener);
						win.eval("log('<span>' + " + JSON.stringify(data) + " + '<span>')");
					});				</span></span></span></span></span></span></span></span></span></span>
github yupkey / tizen-utils / lib / tizen-utils.js View on Github external
function checkTarget() {
    exec('sdb root on', {
      silent: true
    });
    var res = exec('sdb shell type wrt-launcher', {
      silent: true
    });
    var data;

    if (!/not/.test(res.output)) {
      data = {
        user: 'root',
        version: '2.4',
        launcher: 'wrt-launcher'
      };
    } else {
      data = {
        user: 'owner',
        version: '3.0',
        launcher: 'app_launcher'
      };
github AlekseyLeshko / phonegap-seed / gulp / tasks / cordova / emulate-to-android.js View on Github external
gulp.task('emulate-to-android', ['build-for-device'], function() {
  sh.exec('cordova emulate android');
});
github smks / nobot-examples / examples / scripts / branch-exists.js View on Github external
const branchExists = branchName => (shell.exec(`git branch --list ${branchName}`).stdout.length !== 0);