How to use the gluegun.print.colors 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 / resolveService.js View on Github external
service.path = resolve(project.cwd, service.path);

      const search = await cosmiconfig('devconfig', {
        searchPlaces: [
          '.devconfig.yaml',
          '.devconfig.yml',
          '.devconfig.js',
          '.devconfig.json',
        ],
      }).search(service.path);

      if (search === null) {
        print.info(
          `${print.colors.info(
            `info`
          )} cannot find devconfig file for service ${print.colors.warning(
            svcName
          )}, using empty default`
        );

        return service;

        // process.exit(1);
      }

      // resolve each service
      await Promise.map(Object.keys(search.config), async keyName => {
        const config = search.config[keyName];

        // if it's a function, pass the whole project config a
        if (typeof config === 'function') {
          service[keyName] = await config(project.current, project);
github SplitmediaLabsLimited / devctl / src / utils / resolveService.js View on Github external
}

      service.path = resolve(project.cwd, service.path);

      const search = await cosmiconfig('devconfig', {
        searchPlaces: [
          '.devconfig.yaml',
          '.devconfig.yml',
          '.devconfig.js',
          '.devconfig.json',
        ],
      }).search(service.path);

      if (search === null) {
        print.info(
          `${print.colors.info(
            `info`
          )} cannot find devconfig file for service ${print.colors.warning(
            svcName
          )}, using empty default`
        );

        return service;

        // process.exit(1);
      }

      // resolve each service
      await Promise.map(Object.keys(search.config), async keyName => {
        const config = search.config[keyName];

        // if it's a function, pass the whole project config a
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 => {
    const reachable = await isIpReachableInsideDocker(ip.address, port);
github SplitmediaLabsLimited / devctl / src / commands / up.js View on Github external
const allScripts = await readScripts(get(config, 'paths.scripts'));
    await runScripts(allScripts, 'afterSwitch', false);

    // shut down first!
    await require('../cli').run('down');

    // write it in the home folder of the users so that we can detect it if we switch project
    // and remove it
    await writeComposeFileToHomeDir(compose);

    const exec = createDockerComposeCommand(compose);

    // put it up!
    await exec({
      msg: `Starting docker containers ${print.colors.muted(
        `(This might take a while the first time)`
      )}`,
      cmd: 'up -d',
    });

    // show the status, but we're not done!
    require('../cli').run('status');

    await runScripts(allScripts, 'start', true);
  },
};
github SplitmediaLabsLimited / devctl / src / commands / init.js View on Github external
});

    print.info(`${print.colors.highlight('.devctl.yaml')} written.`);

    print.success(``);
    print.success(`Your project has been successfully bootstrapped!`);
    print.info(
      `Please add these files in ${print.colors.highlight('.gitignore')}`
    );
    print.info(
      ` - .devctl-current.yaml ${print.colors.muted(
        `(This is your current state)`
      )}`
    );
    print.info(
      ` - .devctl-docker-compose.yaml ${print.colors.muted(
        `(This is your generated docker-compose file)`
      )}`
    );
    print.info(
      ` - .devctl/data ${print.colors.muted(
        `(This is where your databases will save state)`
      )}`
    );

    print.info('');
    print.success(
      `You can now run ${print.colors.highlight(
        'devctl switch'
      )} in this folder.`
    );
  },
github SplitmediaLabsLimited / devctl / src / extensions / getProjectConfig.js View on Github external
toolbox.getProjectConfig = async () => {
    const search = await cosmiconfig('devctl', {
      searchPlaces: [
        '.devctl.json',
        '.devctl.yaml',
        '.devctl.yml',
        '.devctlrc.json',
        '.devctlrc.yaml',
        '.devctlrc.yml',
        'package.json',
      ],
    }).search();

    if (!search) {
      print.info(
        `${print.colors.error(`error`)} devctl configuration not found`
      );

      return {};
    }

    const cwd = dirname(search.filepath);
    const paths = {
      project: search.filepath,
      compose: resolve(cwd, '.devctl-docker-compose.yaml'),
      current: resolve(cwd, '.devctl-current.yaml'),
      scripts: resolve(cwd, '.devctl-scripts.yaml'),
    };

    const project = search.config;
    project.cwd = cwd;
    project.paths = paths;
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`
github SplitmediaLabsLimited / devctl / src / commands / init.js View on Github external
async database => {
        const { version } = await prompt.ask([
          {
            type: 'select',
            name: 'version',
            message: `Choose a version for ${print.colors.warning(database)}`,
            choices: databases[database].versions,
          },
        ]);

        const env = await askEnv(database);

        const target = `.devctl/${database}/.devconfig.yaml`;

        const generate = {
          template: 'database.devconfig.yaml.ejs',
          target,
          props: {
            ...databases[database].default,
            targetDir: dirname(target),
            database,
            version,