Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// $ExpectError
sh.cat();
// $ExpectError
sh.cat(0);
// Success
(sh.cat('/dev/null'): ShellString);
// $ExpectError
sh.cd(0);
// Success
(sh.cd(): ShellString);
// Success
(sh.cd('/tmp'): ShellString);
// $ExpectError
sh.chmod();
// $ExpectError
sh.chmod(755);
// $ExpectError
sh.chmod('nope', 755, '~');
// $ExpectError
sh.chmod({ '-x': true }, 755, '~');
// Success
(sh.chmod({ '-R': true }, 755, '~'): ShellString);
// Success
(sh.chmod(755, '~'): ShellString);
// Success
(sh.chmod('755', '~'): ShellString);
// Success
(sh.chmod('u+x', '~'): ShellString);
// $ExpectError
clonePlugin('/wp-plugins/updraftplus.git', './updraftplus', 'UpdraftPlus Backup and Restoration', 'git');
clonePlugin('/wp-plugins/wordfence.git', './wordfence', 'Wordfence Security', 'git');
clonePlugin('/login-lockdown/trunk login-lockdown', './login-lockdown', 'Login LockDown', 'svn');
sh.echo(done('✔ Plugins successfully installed!'));
}
// Setup
// ----------------------------------
sh.echo(info('→ Setting up project...'));
// Grant Permission
sh.echo(info('→ Setting permission to folders and files...'));
sh.chmod('755', './');
sh.echo(done('✔ Done!'));
// Check if NodeJS exists and install dependencies
sh.echo(info('→ Installing dependencies....'));
if (!nodeCheck) {
sh.echo(error('✖ This task requires NodeJS to run.'));
process.exit(1);
}
sh.exec('npm install');
sh.echo(done('✔ Node Modules successfully installed!'));
// Final Message
sh.echo(done('✔ All Done!'));
sh.echo(info('\n!!! Remember to setup your "wp_config.php" file'));
// ----------------------------------------------------------
// Git hooks.
console.info(colors.bold('[2/3] Installing Git hooks...\n'));
// Setup pre-commit hook.
console.info(' - pre-commit: .git/hooks/pre-commit');
shell.exec('unlink .git/hooks/pre-commit');
shell.chmod('+x', './scripts/git-pre-commit');
shell.ln('-s', '../../scripts/git-pre-commit', '.git/hooks/pre-commit');
// Setup pre-push hook.
console.info(' - pre-push: .git/hooks/pre-push\n');
shell.exec('unlink .git/hooks/pre-push');
shell.chmod('+x', './scripts/git-pre-push');
shell.ln('-s', '../../scripts/git-pre-push', '.git/hooks/pre-push');
// ----------------------------------------------------------
// Transform code for older Node versions.
console.info(colors.bold('[3/3] Transpiling JS code...\n'));
shell.exec(
`NODE_ENV=production "node_modules/.bin/babel" ${process.argv[2] ||
''} src/ --out-dir dist/ --ignore __tests__`
);
console.info(colors.bold('\nAll done.\n'));
}).then(function () {
// If the gradle distribution URL is set, make sure it points to version we want.
// If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
// For some reason, using ^ and $ don't work. This does the job, though.
var distributionUrlRegex = /distributionUrl.*zip/;
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-4.1-all.zip';
var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
shell.chmod('u+w', gradleWrapperPropertiesPath);
shell.sed('-i', distributionUrlRegex, 'distributionUrl=' + distributionUrl, gradleWrapperPropertiesPath);
var propertiesFile = opts.buildType + SIGNING_PROPERTIES;
var propertiesFilePath = path.join(self.root, propertiesFile);
if (opts.packageInfo) {
fs.writeFileSync(propertiesFilePath, TEMPLATE + opts.packageInfo.toProperties());
} else if (isAutoGenerated(propertiesFilePath)) {
shell.rm('-f', propertiesFilePath);
}
});
};
before(function () {
oldCwd = process.cwd();
oldProcessEnv = process.env;
'echo " hello world"\nalias foo bar\n'.to('a.sh');
`export FOO=hello
export BAR=$FOO$FOO
cd ..`.to('b.sh');
$.touch('nonreadable.txt');
$.chmod('000', 'nonreadable.txt');
});
}
var uglifyScriptPath = path.join(cwd, 'after_prepare', 'uglify.js');
var uglifyFile = fs.readFileSync(uglifyScriptPath);
//console.log('uglifyFile: ', uglifyFile);
var uglifyAfterPreparePath = path.join(paths[1], 'uglify.js');
//console.log('Creating uglify hook: ', uglifyAfterPreparePath);
fs.writeFileSync(uglifyAfterPreparePath, uglifyFile);
var uglifyConfigFile = fs.readFileSync(path.join(__dirname, '../uglify-config.json'));
fs.writeFileSync(path.join(paths[0], 'uglify-config.json'), uglifyConfigFile);
console.log('Updating hooks directory to have execution permissions...');
shell.chmod('a+x', path.join(paths[1], 'uglify.js'));
android_parser.prototype.deleteDefaultResource = function(name) {
var res = path.join(this.path, 'res');
var dirs = fs.readdirSync(res);
for (var i=0; i
].forEach(function(f) {
shell.chmod(755, path.join(destScriptsDir, f));
});
shell.cp('-r', path.join(ROOT, 'bin', 'node_modules'), destScriptsDir);
function coverHandler() {
rm(target)
shell.chmod('-R', '777', tmp)
shell.cp('-R', source, target)
shell.chmod('-R', '777', target)
rm(tmp)
}
function makeDistributedCLIExecutable() {
const cli = path.join(OUTDIR, "cli", "index.js");
mapFile(cli, cli, content => {
if (_.startsWith(content, scriptPrefix)) return content;
return scriptPrefix + content;
});
shell.chmod("+x", cli);
}