示例#1
0
function run(cmds: string) {
    console.log("running [" + cmds + "]");

    try {
        execSync(cmds);
    } catch (e) {
        console.error(e);
        throw(e);
    }
}
示例#2
0
    constructor(conf?: IDockerConf) {
        this.apiVersion = require("./package.json").version;
        this.dockerVersion = execSync("docker -v | grep version | awk '{print$3}' | sed 's/,//g'").toString("utf-8").replace('\n', '')

        this.composeVersion = execSync("docker-compose -v | grep compose | awk '{print$3}' | sed 's/,//g'").toString("utf-8").replace('\n', '')


        const configuration: IDockerConf = {
        }

        if (conf) {

            Object['assign'](configuration, conf)

        }

        this.options = configuration

    }
示例#3
0
export default async function (options: { verbose: boolean }, logger: logging.Logger) {
  let error = false;

  logger.info('Running templates validation...');
  const templateLogger = logger.createChild('templates');
  if (execSync(`git status --porcelain`).toString()) {
    logger.error('There are local changes.');
    if (!options.verbose) {
      return 101;
    }
    error = true;
  }
  templates({}, templateLogger);
  if (execSync(`git status --porcelain`).toString()) {
    logger.error(tags.oneLine`
      Running templates updated files... Please run "devkit-admin templates" before submitting
      a PR.
    `);
    if (!options.verbose) {
      process.exit(2);
    }
    error = true;
  }

  logger.info('');
  logger.info('Running commit validation...');
  validateCommits({}, logger.createChild('validate-commits'));


  logger.info('');
  logger.info('Running license validation...');
  error = await validateLicenses({}, logger.createChild('validate-commits')) != 0;

  logger.info('');
  logger.info('Running BUILD files validation...');
  validateBuildFiles({}, logger.createChild('validate-build-files'));

  if (error) {
    return 101;
  }

  return 0;
}
示例#4
0
    public static copy(str: string) {
        if (os.platform() !== 'darwin') {
            console.log('Warning: clipboard copy only works on Mac for now');
            return;
        }

        child_process.execSync('pbcopy', {
            input: str,
        });
    }
示例#5
0
task('less', function () {
    // Promise.all([
    execSync('sh scripts/less.sh');
    // ]).then(() => {
    // getFilesFrom('./src', '.less').forEach((path) => {
    //     console.log(`Compile less file ${path}`);
    //     execSync(`node_modules/.bin/lessc ${path} ${path.replace('.less', '.css')}`);
    // });
    // });
});
示例#6
0
function isDotnetOnPath() : boolean {
    try {
        child_process.execSync('dotnet --info');
        return true;
    }
    catch (err)
    {
        return false;
    }
}
示例#7
0
 this.findConnectionFile = function(ssid: string) {
   let files = [];
   try {
     files = execSync("sudo grep -rnwl /etc/NetworkManager/system-connections/ -e 'ssid=" + ssid + "' || true").toString().trim().split('\n');
   }
   catch(err) {
     console.log("sudo grep -rnwl /etc/NetworkManager/system-connections/ failed with: " + err.message);
   }
   return files;
 };
示例#8
0
文件: App.ts 项目: Cyruz143/shipyard
// Horrible way to do this. We only allow alphanum and underscroe, so no remote code execution shouldn't happen?.
// Sadly I haven't found a JS module that can zip a folder the way I want ...
function zipMission(missionDir: string, missionDirName: string): string {
    var missionZipName = `${missionDirName}.zip`,
        missionZip = `${missionDir}.zip`;
    var zipCommand = `7z a ${missionZip} ./${missionDir}/*`;
    if (process.platform === 'linux') {
        zipCommand = `(cd ${missionDir} ; zip -r ${missionZipName} . ; mv ${missionZipName} .. ; cd -)`;
    }
    cp.execSync(zipCommand);
    return missionZipName;
}
示例#9
0
 test('uses the --root value option as loader root', async () => {
   const stdout =
       execSync([
         `node ${
             cliPath} --root test/html --inline-scripts --inline-css absolute-paths.html`,
       ].join(' && '))
           .toString();
   assert.include(stdout, '.absolute-paths-style');
   assert.include(stdout, 'hello from /absolute-paths/script.js');
 });
示例#10
0
  /**
   * Retrieves the latest AngularJS Material version remotely.
   */
  private static _retrieveLatestVersion(): string {
    try {
      return execSync('npm view angular-material version --silent').toString().trim();
    } catch (e) {
      Logger.error('Failed to retrieve latest version.');
      Logger.info(e.stack);
    }

    return '';
  }