How to use the gluegun.print.spin function in gluegun

To help you get started, we’ve selected a few gluegun 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 SplitmediaLabsLimited / devctl / src / utils / getDockerHost.js View on Github external
await system.run(`docker image inspect ${DOCKER_CURL}`);
    print.info(
      `docker image ${print.colors.success('✔')} ${print.colors.warning(
        DOCKER_CURL
      )} already exists`
    );
  } catch (err) {
    const spinner1 = print.spin(
      `Fetching ${print.colors.warning(DOCKER_CURL)} image`
    );
    await system.run(`docker pull ${DOCKER_CURL}`);
    spinner1.succeed();
  }

  const port = await getPort();
  const spinner2 = print.spin(
    `Starting dummy HTTP server on port ${print.colors.warning(
      port
    )} and fetch IP`
  );
  const server = await startServer(port);

  // check the list, and ping inside of docker to see if it's reachable
  const ips = await Promise.map(listDeviceIps(), async ip => {
    const reachable = await isIpReachableInsideDocker(ip.address, port);

    return {
      ...ip,
      reachable,
    };
  }).filter(ip => ip.reachable);
github SplitmediaLabsLimited / devctl / src / utils / getDockerHost.js View on Github external
async function getReachableIP() {
  print.info(`Starting Docker IP Detection`);
  try {
    await system.run(`docker image inspect ${DOCKER_CURL}`);
    print.info(
      `docker image ${print.colors.success('✔')} ${print.colors.warning(
        DOCKER_CURL
      )} already exists`
    );
  } catch (err) {
    const spinner1 = print.spin(
      `Fetching ${print.colors.warning(DOCKER_CURL)} image`
    );
    await system.run(`docker pull ${DOCKER_CURL}`);
    spinner1.succeed();
  }

  const port = await getPort();
  const spinner2 = print.spin(
    `Starting dummy HTTP server on port ${print.colors.warning(
      port
    )} and fetch IP`
  );
  const server = await startServer(port);

  // check the list, and ping inside of docker to see if it's reachable
  const ips = await Promise.map(listDeviceIps(), async ip => {
github SplitmediaLabsLimited / devctl / src / utils / dockerCompose.js View on Github external
return async ({ cmd, msg, options }) => {
    const command = `docker-compose -f "${compose}" ${cmd}`;

    if (async) {
      const spinner = msg && print.spin(msg);
      try {
        const output = await system.run(command);
        msg && spinner.succeed();
        return output;
      } catch (err) {
        msg && spinner.fail(err.stderr);
        throw err;
      }
    }

    return execSync(command, options);
  };
}