当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript shelljs.test函数代码示例

本文整理汇总了TypeScript中shelljs.test函数的典型用法代码示例。如果您正苦于以下问题:TypeScript test函数的具体用法?TypeScript test怎么用?TypeScript test使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了test函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

	constructor($errors: IErrors,
		$staticConfig: IStaticConfig,
		$hostInfo: IHostInfo) {
		super({
			ipa: { type: OptionType.String },
			frameworkPath: { type: OptionType.String },
			frameworkName: { type: OptionType.String },
			framework: { type: OptionType.String },
			frameworkVersion: { type: OptionType.String },
			copyFrom: { type: OptionType.String },
			linkTo: { type: OptionType.String  },
			symlink: { type: OptionType.Boolean },
			forDevice: { type: OptionType.Boolean },
			client: { type: OptionType.Boolean, default: true},
			production: { type: OptionType.Boolean },
			debugTransport: {type: OptionType.Boolean},
			keyStorePath: { type: OptionType.String },
			keyStorePassword: { type: OptionType.String,},
			keyStoreAlias: { type: OptionType.String },
			keyStoreAliasPassword: { type: OptionType.String },
			ignoreScripts: {type: OptionType.Boolean },
			tnsModulesVersion: { type: OptionType.String },
			compileSdk: {type: OptionType.Number },
			port: { type: OptionType.Number },
			copyTo: { type: OptionType.String },
			baseConfig: { type: OptionType.String },
			platformTemplate: { type: OptionType.String },
			ng: {type: OptionType.Boolean },
			tsc: {type: OptionType.Boolean },
			bundle: {type: OptionType.Boolean },
			all: {type: OptionType.Boolean },
			teamId: { type: OptionType.String }
		},
		path.join($hostInfo.isWindows ? process.env.AppData : path.join(osenv.home(), ".local/share"), ".nativescript-cli"),
			$errors, $staticConfig);

		// On Windows we moved settings from LocalAppData to AppData. Move the existing file to keep the existing settings
		// I guess we can remove this code after some grace period, say after 1.7 is out
		if ($hostInfo.isWindows) {
			try {
				let shelljs = require("shelljs"),
					oldSettings = path.join(process.env.LocalAppData, ".nativescript-cli", "user-settings.json"),
					newSettings = path.join(process.env.AppData, ".nativescript-cli", "user-settings.json");
				if (shelljs.test("-e", oldSettings) && !shelljs.test("-e", newSettings)) {
					shelljs.mkdir(path.join(process.env.AppData, ".nativescript-cli"));
					shelljs.mv(oldSettings, newSettings);
				}
			} catch (err) {
				// ignore the error - it is too early to use $logger here
			}
		}
	}
开发者ID:JELaVallee,项目名称:nativescript-cli,代码行数:52,代码来源:options.ts

示例2: function

var getSvcCfg = function () {
    if (!shelljs.test('-f', _cfgPath)) {
        console.error('Error: not configured as a service.  use install action.');
        return null;
    }
    var svcCfg = JSON.parse(fs.readFileSync(_cfgPath).toString());
    return svcCfg;
};
开发者ID:itsananderson,项目名称:vso-agent,代码行数:8,代码来源:service.ts

示例3: function

var overwriteFile = function(src, dest) {
	console.log('writing: ' + dest);
	if (shell.test('-f', dest)) {
		shell.rm('-f', dest);
	}

	shell.cp(src, dest);
}
开发者ID:ElleCox,项目名称:vso-agent,代码行数:8,代码来源:installer.ts

示例4: removeDir

 protected removeDir(dir: string) {
   try {
     if (shell.test('-d', dir)) {
       shell.chmod('-R', 'a+w', dir);
       shell.rm('-rf', dir);
     }
   } catch (err) {
     console.error(`ERROR: Unable to remove '${dir}' due to:`, err);
   }
 }
开发者ID:Polatouche,项目名称:angular,代码行数:10,代码来源:build-cleaner.ts

示例5: removeDir

 protected removeDir(dir: string) {
   try {
     if (shell.test('-d', dir)) {
       // Undocumented signature (see https://github.com/shelljs/shelljs/pull/663).
       (shell as any).chmod('-R', 'a+w', dir);
       shell.rm('-rf', dir);
     }
   } catch (err) {
     console.error(`ERROR: Unable to remove '${dir}' due to:`, err);
   }
 }
开发者ID:AnthonyPAlicea,项目名称:angular,代码行数:11,代码来源:build-cleaner.ts

示例6: _cleanFiles

    private _cleanFiles(callback: (err: any) => void): void {
        this.emitter.emit('info', 'Cleaning Files: ' + this.path);
        if (!shell.test('-d', this.path)) {
            callback(null);
            return;
        }

        var candidates = shell.find(this.path).filter((file) => { return this.ext === '*' || file.endsWith('.' + this.ext); });

        var _that = this;
        var delCount = 0;
        async.forEachSeries(candidates,
            function (candidate, done: (err: any) => void) {
                fs.stat(candidate, (err, stats) => {
                    if (err) {
                        done(null);
                        return;
                    }

                    if (stats.isDirectory()) {
                        done(null);
                        return;
                    }

                    var fileAgeSeconds = (new Date().getTime() - stats.mtime.getTime()) / 1000;
                    if (fileAgeSeconds > _that.ageSeconds) {
                        ++delCount;
                        _that.emitter.emit('deleted', candidate);
                        shell.rm(candidate);
                    }                    

                    // ignoring errors - log and keep going
                    done(null);
                })
            }, function (err) {
                _that.emitter.emit('info', 'deleted file count: ' + delCount);
                // ignoring errors. log and go
                callback(null);
            });        
    }
开发者ID:itsananderson,项目名称:vso-agent,代码行数:40,代码来源:diagnostics.ts

示例7: stop

export function stop() {
	if (shell.test('-f', _pidPath)) {
		shell.rm(_pidPath);
	}
}
开发者ID:ElleCox,项目名称:vso-agent,代码行数:5,代码来源:heartbeat.ts

示例8: usage

const defaultFolder = "docs";
const folder = docsFolder || defaultFolder;
const output = `_${folder}`;
const templateFilename = "template.html";
const contentsFilename = "contents.json";
const preferences = ["index.md", "README.md"];

// Guards
// Bail out if more than 1 args
if (argsRest && argsRest.length > 0) {
  console.error("Too may arguments");
  usage(true);
}

// Bail out if the folder doesn't exist
if (!sh.test("-e", folder)) {
  console.error(
    `Folder ${folder} not found at ${path.join(process.cwd(), folder)}`
  );
  usage(true);
}

// Define template html, user's first, otherwise default
let template = path.join(folder, templateFilename);
if (!sh.test("-e", template)) {
  template = path.join(__dirname, defaultFolder, templateFilename);
}
const tpl = sh.cat(template);

// Prepare output folder (create, clean, copy sources)
sh.mkdir("-p", output);
开发者ID:joakin,项目名称:markdown-folder-to-html,代码行数:31,代码来源:cli.ts

示例9: require

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

var sh = require('svchost')
  , shell = require('shelljs')
  , path = require('path')
  , heartbeat = require('./heartbeat');

import env = require('./environment');

// agent must be configured before run as a service
if (!shell.test('-f', path.join(__dirname, '..', '.agent'))) {
    console.error('Agent must be configured.  Run vsoagent configure');
    process.exit(1);
}

heartbeat.exitIfAlive();

var banner = function(str) {
    console.log('--------------------------------------------');
    console.log(str);
    console.log('--------------------------------------------');
}

var formatOutput = function(level, output) {
    return '[' + level + ']' + (new Date()).toTimeString() + ': ' + output;
}

var host = new sh.SvcHost();
host.on('start', function(pid, starts){
    banner('started (' + pid + ') - ' + starts + ' starts');
开发者ID:itsananderson,项目名称:vso-agent,代码行数:31,代码来源:host.ts

示例10: function

var pushConfigUp = function(file) {
	var srcPath = path.join(agentTarget, file);
	if (shell.test('-f', srcPath)) {
		shell.cp(srcPath, path.join(targetDir, file));
	}	
}
开发者ID:itsananderson,项目名称:vso-agent,代码行数:6,代码来源:installer.ts


注:本文中的shelljs.test函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。