Example #1
0
  init() {
    // create a new CLI instance
    this.cli = new this.classes.CLI(this);

    // get an array of commands and options that should be processed
    this.processedInput = this.cli.processInput();

    // set the options and commands which were processed by the CLI
    this.pluginManager.setCliOptions(this.processedInput.options);
    this.pluginManager.setCliCommands(this.processedInput.commands);

    // Check if update is available
    updateNotifier({ pkg }).notify();

    return this.service.load(this.processedInput.options)
      .then(() => {
        // load all plugins
        this.pluginManager.loadAllPlugins(this.service.plugins);

        // give the CLI the plugins and commands so that it can print out
        // information such as options when the user enters --help
        this.cli.setLoadedPlugins(this.pluginManager.getPlugins());
        this.cli.setLoadedCommands(this.pluginManager.getCommands());
        return this.pluginManager.updateAutocompleteCacheFile();
      });
  }
Example #2
0
File: index.js Project: nc2/YoDawg
Generator.prototype.checkForUpdates = function checkForUpdates () {
  var notifier = updateNotifier({
    packageName: this.pkg.name,
    packageVersion: this.pkg.version
  });
  notifier.notify();
};
Example #3
0
  initializing: function () {
    this.pkg = require('../../package.json');

    var updateNotifier = require('update-notifier');

    updateNotifier({ pkg: this.pkg }).notify();
  },
Example #4
0
exports.notifyVersion = function(pkg) {
    var notifier = updateNotifier({ pkg: pkg })

    if (notifier.update) {
        notifier.notify()
    }
}
Example #5
0
export default function checkForUpdates(nvim) {
  const notifier = updateNotifier({
    pkg,
    updateCheckInterval: UPDATE_INTERVAL,
  });

  if (notifier && notifier.update) {
    if (nvim) {
      const updateMsg = `[tigris] Update available ${notifier.update.current} →
        ${notifier.update.latest}`;

      debug(updateMsg);
      nvim.command(`echomsg '${updateMsg}'`);
      nvim.command(`
        echo '[tigris]' |
        echon ' Update available ' |
        echohl Comment |
        echon '${notifier.update.current}' |
        echohl None |
        echon ' → ' |
        echohl Keyword |
        echon '${notifier.update.latest}' |
        echohl None
      `);
    }

    return notifier.update;
  }

  return null;
}
Example #6
0
File: yoyo.js Project: Digikid13/yo
  var resolveGenerators = function (generator) {
    if (!/(app|all)$/.test(generator.namespace)) {
      return;
    }

    var dir = findup.sync(generator.resolved, 'package.json');
    if (!dir) {
      return;
    }

    var pkg = gen.file.readJSON(path.join(dir, 'package.json'));
    pkg.namespace = generator.namespace;
    pkg.appGenerator = true;
    pkg.prettyName = _s.titleize(_s.humanize(namespaceToName(generator.namespace)));

    pkg.update = updateNotifier({
      packageName: pkg.name,
      packageVersion: pkg.version
    }).update;

    if (pkg.update && pkg.version !== pkg.update.latest) {
      pkg.updateAvailable = true;
    }

    this.pkgs[pkg.name] = pkg;
  };
Example #7
0
module.exports = function() {

    updateNotifier({pkg: pkg}).notify();

    var argv = yargs
        .usage('$0 [options] <source>')
        .command('create', 'Create new JSON database.')
        .command('collection', 'Add new collection to existent database file.')
        .options({
            name: {
                alias: 'n',
                description: 'Name of the database JSON file to create/use.',
                default: 'db.json'
            }
        })
        .version(pkg.version, 'v', 'Show version number.').alias('version', 'v')
        .help('help').alias('help', 'h').describe('h', 'Show help.')
        .example('$0 create', 'Generate db.json file.')
        .example('$0 create -n dev.json', 'Generate dev.json file.')
        .epilog('Home page and docs: https://github.com/dfsq/json-server-init')
        .demand(1)
        .argv;

    process(argv._[0], argv);
};
Example #8
0
module.exports = function (cb) {
  updateNotifier({ pkg: pkg }).notify();

  paratrooper.launch({}, function (env) {
    var plugin;

    if (env.configPath) {
      fs.readFile(env.configPath, function (err, data) {
        if (err) {
          return console.error(err);
        }

        var config = {};

        try {
          config = JSON.parse(data);
        } catch(e) {
          console.error(e);
        }

        if (config.plugin) {
          plugin = require(resolve.sync(config.plugin, { basedir: env.cwd }));
        } else {
          plugin = require('paratrooper-basic');
        }

        cb(initProgram(config, plugin));
      });
    }
    else {
      plugin = require('paratrooper-basic');
      cb(initProgram({}, plugin));
    }
  });
};
Example #9
0
  var resolveGenerators = function (generator) {
    if (!/(app|all)$/.test(generator.namespace)) {
      return;
    }

    var dir = findup.sync(generator.resolved, 'package.json');
    if (!dir) {
      return;
    }

    var pkg = yo.file.readJSON(path.join(dir, 'package.json'));
    pkg.namespace = generator.namespace;
    pkg.appGenerator = true;
    pkg.prettyName = generator.namespace.replace(/(\w+):\w+/, '$1');
    pkg.prettyName = pkg.prettyName.charAt(0).toUpperCase() + pkg.prettyName.slice(1);

    pkg.update = updateNotifier({
      packageName: pkg.name,
      packageVersion: pkg.version
    }).update;

    if (pkg.update && pkg.version !== pkg.update.latest) {
      pkg.updateAvailable = true;
    }

    this.pkgs[pkg.name] = pkg;
  };
Example #10
0
File: yoyo.js Project: gdi2290/yo
    return function (next) {
      var alreadyResolved = generatorPath in resolvedGenerators;
      var isPackageJSON = path.basename(generatorPath) === 'package.json';

      if (alreadyResolved || !isPackageJSON || !fs.existsSync(generatorPath)) {
        return next();
      }

      var pkg = JSON.parse(self.readFileAsString(generatorPath));
      pkg.namespace = generator.namespace;

      if (/[app|all]/.test(generator.namespace)) {
        pkg.appGenerator = true;
        pkg.prettyName = generator.namespace.replace(/(\w+):\w+/, '$1');
        pkg.prettyName = pkg.prettyName.charAt(0).toUpperCase() + pkg.prettyName.slice(1);

        pkg.update = updateNotifier({
          packageName: pkg.name,
          packageVersion: pkg.version
        }).update;

        if (pkg.update && pkg.version !== pkg.update.latest) {
          pkg.updateAvailable = true;
        }
      }

      self.pkgs[pkg.name] = pkg;

      resolvedGenerators[generatorPath] = true;

      next();
    };
	_updateCheck: function(){
		var notifier = updateNotifier({
			pkg: pkg,
			updateCheckInterval: 0 // 1000 * 60 * 60 * 24 // one day
		});

		notifier.notify({defer: false});
	},
Example #12
0
(function checkForUpdates() {
  var updateNotifier = require('update-notifier');
  updateNotifier({
    pkg: pkg,
    name: pkg.name,
    version: pkg.version
  }).notify();
}());
Example #13
0
exports.checkVersion = function () {
  var notifier = updateNotifier({pkg: pkg})

  notifier.notify()
  if (notifier.update) {
    console.log(notifier.update)
  }
}
/**
 *  Check if there is new package version
 */
function _checkUpdate(){
  var notifier = updateNotifier({
    pkg: pkg,
    updateCheckInterval: 1000 * 60 * 60 * 24 * 7
  })
  if (notifier.update)
    notifier.notify()
}
	constructor: function () {
		// Calling the super constructor is important so our generator is correctly set up
		yeoman.generators.Base.apply(this, arguments);

		updateNotifier({
			pkg: require('./package.json')
		}).notify({defer: false});
	},
Example #16
0
app.get('/update', function (req, res) {
  updateNotifier({
    pkg: pkg,
    callback: function (err, update) {
      if (err) return res.json({})
      res.json(update)
    }
  })
})
Example #17
0
module.exports = function () {

  updateNotifier({ pkg: pkg }).notify()

  var argv = yargs
    .usage('$0 [options] <source>')
    .options({
      port: {
        alias: 'p',
        description: 'Set port',
        default: 3000
      },
      host: {
        alias: 'H',
        description: 'Set host',
        default: '0.0.0.0'
      },
      watch: {
        alias: 'w',
        description: 'Watch file(s)'
      },
      routes: {
        alias: 'r',
        description: 'Load routes file'
      },
      static: {
        alias: 's',
        description: 'Set static files directory'
      },
      snapshots: {
        alias: 'S',
        description: 'Set snapshots directory',
        default: '.'
      },
      delay: {
        alias: 'd',
        description: 'Add delay to responses (ms)'
      },
      id: {
        alias: 'i',
        description: 'Set database id property (e.g. _id)',
        default: 'id'
      }
    })
    .boolean('watch')
    .help('help').alias('help', 'h')
    .version(pkg.version).alias('version', 'v')
    .example('$0 db.json', '')
    .example('$0 file.js', '')
    .example('$0 http://example.com/db.json', '')
    .epilog('https://github.com/typicode/json-server')
    .require(1, 'Missing <source> argument')
    .argv

  run(argv)

}
 checkUpdates: function () {
   if (!this.options['skip-update']) {
     this.log(chalk.yellow('Checking for updates...'))
     updateNotifier({
       pkg: this.pkg,
       callback: _onUpdateNotifier.bind(this, this.async())
     })
   }
 }
Example #19
0
  checkForUpdate: function() {
    var notifier = updateNotifier({
      packagePath: "../package.json"
    });

    if(notifier.update) {
      notifier.notify();
    };
  }
Example #20
0
export default (pkg) => {
  const notifier = updateNotifier({
     pkg,
     updateCheckInterval: 1000 * 60 * 60 * 1
  });

  if (notifier.update) {
    notifier.notify();
  }
}
Example #21
0
Raddish.prototype.checkUpdate = function() {
    if(!config.threads || cluster.isMaster) {
        var pkg = require('../../package.json'),
            notifier = Notifier({pkg: pkg});

        if (notifier.update) {
            notifier.notify();
        }
    }
}
Example #22
0
module.exports.notify = function(name, version, time) {
  var notifier = updateNotifier({
    packageName: name,
    packageVersion: version,
    updateCheckInterval: time || (1000 * 60 * 60 * 24) // 1day
  });
  if (notifier.update) {
    showNotifier(name, notifier.update)
  };
};
Example #23
0
File: base.js Project: Couto/gh
    packagesPath.forEach(function(path) {
        notifier = updateNotifier({
            packagePath: path,
            updateCheckInterval: exports.TIME_DAY
        });

        if (notifier.update) {
            notifier.notify();
        }
    });
Example #24
0
File: cli.js Project: mklabs/yo
function updateCheck() {
  const notifier = updateNotifier({pkg});
  const message = [];

  if (notifier.update) {
    message.push('Update available: ' + chalk.green.bold(notifier.update.latest) + chalk.gray(' (current: ' + notifier.update.current + ')'));
    message.push('Run ' + chalk.magenta('npm install -g ' + pkg.name) + ' to update.');
    console.log(yosay(message.join(' '), {maxLength: stringLength(message[0])}));
  }
}
Example #25
0
module.exports = function() {

  var notifier = updateNotifier({
    packagePath: '../../package',
    updateCheckInterval: 1000 * 60 * 60 * 1 // 1 hr
  });

  if (notifier.update) {
    notifier.notify(true);
  }
};
Example #26
0
export default (pkg) => {
  const notifier = updateNotifier({
     packageName: pkg.name,
     packageVersion: pkg.version,
     updateCheckInterval: 1000 * 60 * 60 * 1
  });

  if (notifier.update) {
    notifier.notify();
  }
}
    initializing: function() {
        var notifier = updateNotifier({pkg});
        notifier.notify({defer: false});

        this.log(yosay('Welcome to the\n' +
            chalk.yellow('Display Templates') +
        ' generator version: ' + pkg.version + '.' +
        ' Let\'s create a new project.'));

        // generator configuration
        this.genConfig = {};
    },
Example #28
0
Raddish.prototype.checkUpdate = function() {
    if(!config.threads || cluster.isMaster) {
        var notifier = Notifier({
            packageName: 'raddish',
            packageVersion: '2.1.3'
        });

        if (notifier.update) {
            notifier.notify();
        }
    }
}
Example #29
0
exports.checkVersion = function(opt_callback) {
    var notifier = updateNotifier({
        packagePath: '../package',
        updateCheckInterval: 1000 * 60 * 60 * 24 // 1 day
    });

    if (notifier.update) {
        notifier.notify();
    }

    opt_callback && opt_callback();
};
Example #30
0
File: base.js Project: bossjones/gh
    packagesPath.forEach(function(path) {
        var pkg = require(path);

        notifier = updateNotifier({
            packageName: pkg.name,
            packageVersion: pkg.version
        });

        if (notifier.update) {
            notifier.notify();
        }
    });