How to use buntstift - 10 common examples

To help you get started, we’ve selected a few buntstift 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 thenativeweb / roboter / test / helpers / createTestsForTask.js View on Github external
let pre;

        try {
          /* eslint-disable global-require */
          pre = require(path.join(cwd, task, testCase, 'pre.js'));
          /* eslint-enable global-require */
        } catch {
          pre = async function () {
            // Dummy method as fallback
          };
        }

        buntstift.line();
        buntstift.info(`${task} - ${testCase}`);
        buntstift.newLine();

        await pre({ dirname: tempTestDirectory });

        const result = await runRoboterTask({ cwd, task, directory: tempTestDirectory });

        /* eslint-disable global-require */
        const expected = require(path.join(cwd, task, testCase, 'expected.js'));
        /* eslint-enable global-require */

        assert.that(result.exitCode).is.equalTo(expected.exitCode);

        assert.that(result.stderr).is.containing(expected.stderr);

        const expectedStdouts = flatten([ expected.stdout ]);

        let previousIndex = -1;
github thenativeweb / roboter / test / helpers / createTestsForTask.js View on Github external
const tempTestDirectory = path.join(tempDirectory, testCase);

        let pre;

        try {
          /* eslint-disable global-require */
          pre = require(path.join(cwd, task, testCase, 'pre.js'));
          /* eslint-enable global-require */
        } catch {
          pre = async function () {
            // Dummy method as fallback
          };
        }

        buntstift.line();
        buntstift.info(`${task} - ${testCase}`);
        buntstift.newLine();

        await pre({ dirname: tempTestDirectory });

        const result = await runRoboterTask({ cwd, task, directory: tempTestDirectory });

        /* eslint-disable global-require */
        const expected = require(path.join(cwd, task, testCase, 'expected.js'));
        /* eslint-enable global-require */

        assert.that(result.exitCode).is.equalTo(expected.exitCode);

        assert.that(result.stderr).is.containing(expected.stderr);

        const expectedStdouts = flatten([ expected.stdout ]);
github thenativeweb / roboter / lib / bin / roboter.js View on Github external
exit();
    }

    const suggestions = findSuggestions({ for: ex.command, in: validCommands });

    buntstift.error(`Unknown command '${ex.command}', did you mean '${suggestions[0].suggestion}'?`);
    buntstift.exit(1);
  }

  if (!parsed.command) {
    parsed.command = defaultCommand;

    if (parsed.argv.length > 0) {
      if (parsed.argv.includes('--version') || parsed.argv.includes('-v')) {
        buntstift.info(packageJson.version);
        buntstift.exit(0);
      }

      if (parsed.argv.includes('--help') || parsed.argv.includes('-h')) {
        parsed.command = 'help';
      }
    }
  }

  const command = commands[parsed.command];
  const validOptionDefinitions = [ ...globalOptionDefinitions, ...await command.getOptionDefinitions() ];

  const args = commandLineArgs(validOptionDefinitions, { argv: parsed.argv, partial: true });

  /* eslint-disable no-underscore-dangle */
  if (args._unknown && args._unknown.length > 0) {
github thenativeweb / roboter / bin / bot.js View on Github external
updateNotifier = require('update-notifier');

const packageJson = require('../package.json');

/* eslint-disable no-sync */
updateNotifier({
  packageName: packageJson.name,
  packageVersion: packageJson.version
}).notify();

if (!fs.existsSync(path.join(process.cwd(), 'node_modules', 'roboter'))) {
  buntstift.error('roboter is not installed locally.');
  buntstift.newLine();
  buntstift.info('Please run the following command:');
  buntstift.newLine();
  buntstift.info('  npm install roboter --save-dev --save-exact');
  buntstift.exit(1);
}

const localRoboterPackageJson = require(path.join(
  process.cwd(), 'node_modules', 'roboter', 'package.json'));

if (semver.gt(localRoboterPackageJson.version, packageJson.version)) {
  buntstift.error('The roboter runner is too old.');
  buntstift.newLine();
  buntstift.info('Please run the following command:');
  buntstift.newLine();
  buntstift.info('  npm install -g roboter');
  buntstift.exit(1);
}

const gulp = path.join(process.cwd(), 'node_modules', '.bin', 'gulp');
github thenativeweb / roboter / bin / bot.js View on Github external
const buntstift = require('buntstift'),
      minimist = require('minimist'),
      semver = require('semver'),
      shell = require('shelljs'),
      updateNotifier = require('update-notifier');

const packageJson = require('../package.json');

/* eslint-disable no-sync */
updateNotifier({
  packageName: packageJson.name,
  packageVersion: packageJson.version
}).notify();

if (!fs.existsSync(path.join(process.cwd(), 'node_modules', 'roboter'))) {
  buntstift.error('roboter is not installed locally.');
  buntstift.newLine();
  buntstift.info('Please run the following command:');
  buntstift.newLine();
  buntstift.info('  npm install roboter --save-dev --save-exact');
  buntstift.exit(1);
}

const localRoboterPackageJson = require(path.join(
  process.cwd(), 'node_modules', 'roboter', 'package.json'));

if (semver.gt(localRoboterPackageJson.version, packageJson.version)) {
  buntstift.error('The roboter runner is too old.');
  buntstift.newLine();
  buntstift.info('Please run the following command:');
  buntstift.newLine();
  buntstift.info('  npm install -g roboter');
github thenativeweb / roboter / bin / bot.js View on Github external
const packageJson = require('../package.json');

/* eslint-disable no-sync */
updateNotifier({
  packageName: packageJson.name,
  packageVersion: packageJson.version
}).notify();

if (!fs.existsSync(path.join(process.cwd(), 'node_modules', 'roboter'))) {
  buntstift.error('roboter is not installed locally.');
  buntstift.newLine();
  buntstift.info('Please run the following command:');
  buntstift.newLine();
  buntstift.info('  npm install roboter --save-dev --save-exact');
  buntstift.exit(1);
}

const localRoboterPackageJson = require(path.join(
  process.cwd(), 'node_modules', 'roboter', 'package.json'));

if (semver.gt(localRoboterPackageJson.version, packageJson.version)) {
  buntstift.error('The roboter runner is too old.');
  buntstift.newLine();
  buntstift.info('Please run the following command:');
  buntstift.newLine();
  buntstift.info('  npm install -g roboter');
  buntstift.exit(1);
}

const gulp = path.join(process.cwd(), 'node_modules', '.bin', 'gulp');
github thenativeweb / roboter / bin / bot.js View on Github external
const configurationFile = minimist(process.argv.slice(2), {
  string: 'file',
  default: 'roboter.js'
}).file || 'roboter.js';

const configurationFileWithPath = path.join(process.cwd(), configurationFile);

if (!fs.existsSync(configurationFileWithPath)) {
  buntstift.error(`${configurationFile} is missing.`);
  buntstift.exit(1);
}

const args = process.argv.slice(2).join(' ');

buntstift.exit(shell.exec(
  `${gulp} --gulpfile ${configurationFileWithPath} --color true ${args}`).code);
/* eslint-enable no-sync */
github thenativeweb / roboter / lib / watchFilesAndExecute.js View on Github external
const watchFilesAndExecute = async function ({ message, files, execute, executeOnStart = false }) {
  if (!message) {
    throw new Error('Message is missing.');
  }
  if (!files) {
    throw new Error('Files are missing.');
  }
  if (!execute) {
    throw new Error('Execute is missing.');
  }

  buntstift.line();
  buntstift.info(message, { prefix: '▸' });

  const handleChange = function () {
    if (isCurrentlyExecuting) {
      return;
    }
    isCurrentlyExecuting = true;

    (async () => {
      try {
        await execute();
      } catch (ex) {
        // In watch mode, we ignore any errors (since we do not have an
        // exit code anyway).

        buntstift.verbose(ex.message);
      } finally {
github thenativeweb / roboter / lib / watchFilesAndExecute.js View on Github external
const watchFilesAndExecute = async function ({ message, files, execute, executeOnStart = false }) {
  if (!message) {
    throw new Error('Message is missing.');
  }
  if (!files) {
    throw new Error('Files are missing.');
  }
  if (!execute) {
    throw new Error('Execute is missing.');
  }

  buntstift.line();
  buntstift.info(message, { prefix: '▸' });

  const handleChange = function () {
    if (isCurrentlyExecuting) {
      return;
    }
    isCurrentlyExecuting = true;

    (async () => {
      try {
        await execute();
      } catch (ex) {
        // In watch mode, we ignore any errors (since we do not have an
        // exit code anyway).

        buntstift.verbose(ex.message);
github thenativeweb / roboter / lib / watchFilesAndExecute.js View on Github external
(async () => {
      try {
        await execute();
      } catch (ex) {
        // In watch mode, we ignore any errors (since we do not have an
        // exit code anyway).

        buntstift.verbose(ex.message);
      } finally {
        isCurrentlyExecuting = false;
      }
    })();
  };