Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var promise = new Promise(function (resolve, reject) {
if (require('shelljs').which(browser)) {
return resolve();
} else {
var regQPre = 'reg QUERY "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\';
var regQPost = '.EXE" /v ""';
var regQuery = regQPre + browser.split(' ')[0] + regQPost;
child_process.exec(regQuery, function (err, stdout, stderr) {
if (err) {
// The registry key does not exist, which just means the app is not installed.
reject(err);
} else {
var result = regItemPattern.exec(stdout);
if (fs.existsSync(trimRegPath(result[2]))) {
resolve();
} else {
// The default value is not a file that exists, which means the app is not installed.
// after this check the path with the non standard commands
let cPath = null;
_.forEach(definition.otherCmds, (entry) => {
const tryPath = path.resolve(cmdPath, entry);
if (shelljs.which(tryPath)) {
cPath = tryPath;
}
});
if (cPath) {
return cPath;
}
}
// after this check just the standard command
if (shelljs.which(definition.standardCmd)) {
return definition.standardCmd;
}
// after this check the non standard commands
let otherCmd = null;
_.forEach(definition.otherCmds, (entry) => {
if (shelljs.which(entry)) {
otherCmd = entry;
}
});
if (otherCmd) {
return otherCmd;
}
// if none of the commands work return false
return false;
}
/**
// Install packages
if (ctx.answers.pm === 'yarn') {
ctx.yarnInstall();
} else {
ctx.npmInstall();
}
// Format code with xo
await execa(`./node_modules/.bin/xo`, ['--fix'], {
cwd: ctx.folderPath,
stdio: 'inherit'
});
// Run tests
await execa(which(ctx.answers.pm).stdout, ['test'], {
cwd: ctx.folderPath,
stdio: 'inherit'
});
ctx.showTip();
}
};
deps.ruby.versionCheck = deps.ruby.exe + ' -v' + deps.ruby.exeSuffix;
deps.gem.exe = fs.readFileSync(runtime.binDir + '/gem', 'utf-8').trim().replace(' $*', '');
deps.gem.writeShim = false;
deps.bundler.exe = runtime.binDir + '/bundler'; // <-- not a lanyon shim, it's a real gem bin
deps.bundler.writeShim = false;
_context.next = 62;
break;
case 23:
if (!utils.satisfied(runtime, 'ruby', undefined, 'system')) {
_context.next = 29;
break;
}
rubyProvider = 'system';
deps.gem.exe = shell.which('gem').stdout;
deps.bundler.exe = shell.which('bundler').stdout;
_context.next = 62;
break;
case 29:
if (!utils.satisfied(runtime, 'docker')) {
_context.next = 42;
break;
}
rubyProvider = 'docker';
if (!(process.env.DOCKER_BUILD === '1')) {
_context.next = 37;
break;
}
gulp.task('git-check', function(done) {
if (!sh.which('git')) {
console.log(
' ' + gutil.colors.red('Git is not installed.'),
'\n Git, the version control system, is required to download Ionic.',
'\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
'\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
);
process.exit(1);
}
done();
});
export function isCLIInstalled(): boolean {
let isInstalled = false;
try {
if (which('sfdx')) {
isInstalled = true;
}
} catch (e) {
console.error('An error happened while looking for sfdx cli', e);
}
return isInstalled;
}
compile_vyper(contractFiles, _options, cb) {
const self = this;
if (!contractFiles || !contractFiles.length) {
return cb();
}
const vyper = shelljs.which('vyper');
if (!vyper) {
self.logger.warn(__('%s is not installed on your machine', 'Vyper'));
self.logger.info(__('You can install it by visiting: %s', 'https://vyper.readthedocs.io/en/latest/installing-vyper.html'));
return cb();
}
self.logger.info(__("compiling Vyper contracts") + "...");
const compiled_object = {};
async.each(contractFiles,
function (file, fileCb) {
const className = path.basename(file.path).split('.')[0];
compiled_object[className] = {};
async.parallel([
function getByteCode(paraCb) {
self.compileVyperContract(file.path, false, (err, byteCode) => {
if (err) {
const checkYo = () => {
if (!Shell.which('yo')) {
console.log(colors.red('This command requires yo to be installed.'))
console.log(colors.green('Installing yo...'))
Shell.exec('CI=true npm i -g yo')
}
}
function forgivingWhichSync(cmd) {
try {
return fs.realpathSync(shelljs.which(cmd));
} catch (e) {
return '';
}
}
function forgivingWhichSync (cmd) {
try {
return fs.realpathSync(shelljs.which(cmd));
} catch (e) {
return '';
}
}