How to use the shelljs.chmod function in shelljs

To help you get started, we’ve selected a few shelljs 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 flow-typed / flow-typed / definitions / npm / shelljs_v0.7.x / test_shelljs_v0.7.x.js View on Github external
// $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
github kickstarts / kickstarts / init / bp-wordpress.js View on Github external
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'));
github DmitrySoshnikov / regexp-tree / scripts / build.js View on Github external
// ----------------------------------------------------------
// 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'));
github katzer / cordova-plugin-badge / node_modules / cordova-android / bin / templates / cordova / lib / builders / StudioBuilder.js View on Github external
}).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);
            }
        });
};
github dthree / cash / test / source.js View on Github external
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');
  });
github rossmartin / cordova-uglify / scripts / install.js View on Github external
}

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'));
github apache / cordova-lib / cordova-lib / src / cordova / metadata / android_parser.js View on Github external
android_parser.prototype.deleteDefaultResource = function(name) {
    var res = path.join(this.path, 'res');
    var dirs = fs.readdirSync(res);

    for (var i=0; i
github apache / cordova-amazon-fireos / bin / lib / create.js View on Github external
].forEach(function(f) { 
           shell.chmod(755, path.join(destScriptsDir, f));
    });
    shell.cp('-r', path.join(ROOT, 'bin', 'node_modules'), destScriptsDir);
github bmfe / eros-cli / lib / commands / update.js View on Github external
function coverHandler() {
            rm(target)
            shell.chmod('-R', '777', tmp)
            shell.cp('-R', source, target)
            shell.chmod('-R', '777', target)
            rm(tmp)
        }
github quicktype / quicktype / script / build.ts View on Github external
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);
}