Fixing more v0.8 issues.
This commit is contained in:
Родитель
a8fc09b31f
Коммит
8566d5470c
|
@ -157,7 +157,7 @@ function readCommitId(context, cb) {
|
|||
|
||||
function clear() {
|
||||
var isDeleted = false;
|
||||
if (fs.existsSync(utils.azureDir())) {
|
||||
if (utils.pathExistsSync(utils.azureDir())) {
|
||||
var cacheFiles = fs.readdirSync(utils.azureDir());
|
||||
for (var i = 0; i < cacheFiles.length; ++i) {
|
||||
if (/sites[.].+[.]json/.test(cacheFiles[i])
|
||||
|
|
|
@ -24,16 +24,12 @@ var colors = require('colors');
|
|||
var eyes = require('eyes');
|
||||
var Table = require('easy-table');
|
||||
|
||||
var utils = require('./utils');
|
||||
|
||||
require('./patch-winston');
|
||||
|
||||
var istty1 = tty.isatty(1);
|
||||
|
||||
// Temporary fix for node version < 0.8, starting from v0.8
|
||||
// path.existsSync has been deprecated
|
||||
if (!fs.existsSync) {
|
||||
fs.existsSync = path.existsSync;
|
||||
}
|
||||
|
||||
function recordError(err) {
|
||||
if (err && err.stack) {
|
||||
try {
|
||||
|
@ -832,7 +828,7 @@ function harvestModules() {
|
|||
|
||||
results = results.filter(function (item) {
|
||||
item.packagePath = path.join(item.modulePath, 'package.json');
|
||||
item.packageStat = fs.existsSync(item.packagePath) ? fs.statSync(item.packagePath) : undefined;
|
||||
item.packageStat = utils.pathExistsSync(item.packagePath) ? fs.statSync(item.packagePath) : undefined;
|
||||
return item.packageStat && item.packageStat.isFile();
|
||||
});
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ exports.init = function (cli) {
|
|||
var cfg = {};
|
||||
log.silly('Reading config', azureConfigPath);
|
||||
|
||||
if (fs.existsSync(azureConfigPath)) {
|
||||
if (utils.pathExistsSync(azureConfigPath)) {
|
||||
try {
|
||||
cfg = JSON.parse(fs.readFileSync(azureConfigPath));
|
||||
} catch (err) {
|
||||
|
|
|
@ -55,7 +55,7 @@ exports.init = function (cli) {
|
|||
context.path = path.join(context.path, 'diagnostics.zip');
|
||||
}
|
||||
|
||||
if (path.existsSync(context.path)) {
|
||||
if (utils.pathExistsSync(context.path)) {
|
||||
if (!site.confirm('Replace existing ' + context.path + '? (y/n) ', _)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ exports.init = function (cli) {
|
|||
log.info('Executing `git init`');
|
||||
exec('git init', _);
|
||||
|
||||
if (!path.existsSync('.gitignore')) {
|
||||
if (!utils.pathExistsSync('.gitignore')) {
|
||||
log.info('Creating default .gitignore file');
|
||||
fs.writeFile('.gitignore', 'node_modules\nazure_error', _);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ exports.init = function (cli) {
|
|||
|
||||
function copyIisNodeWhenServerJsPresent(_) {
|
||||
log.silly('copyWebConfigWhenServerJsPresent');
|
||||
if (!path.existsSync('iisnode.yml') && (path.existsSync('server.js') || path.existsSync('app.js'))) {
|
||||
if (!utils.pathExistsSync('iisnode.yml') && (utils.pathExistsSync('server.js') || utils.pathExistsSync('app.js'))) {
|
||||
log.info('Creating default iisnode.yml file');
|
||||
var sourcePath = path.join(__dirname, '../templates/node/iisnode.yml');
|
||||
fs.writeFile('iisnode.yml', fs.readFile(sourcePath, _), _);
|
||||
|
|
|
@ -428,7 +428,7 @@ exports.azureDir = function () {
|
|||
var dir = process.env.AZURE_CONFIG_DIR
|
||||
|| path.join(homeFolder(), '.azure');
|
||||
|
||||
if (!fs.existsSync(dir)) {
|
||||
if (!exports.pathExistsSync(dir)) {
|
||||
fs.mkdirSync(dir, 502); // 0766
|
||||
}
|
||||
|
||||
|
@ -455,3 +455,8 @@ exports.getHostNameSuffix = function () {
|
|||
return process.env.AZURE_HOSTNAME_SUFFIX
|
||||
|| constants.DEFAULT_HOSTNAME_SUFFIX;
|
||||
};
|
||||
|
||||
exports.pathExistsSync = function (path) {
|
||||
var obj = fs.existsSync ? fs : path;
|
||||
return obj.existsSync.apply(obj, arguments);
|
||||
};
|
|
@ -1260,7 +1260,7 @@ BlobService.prototype.getBlobToFile = function (container, blob, localFilename,
|
|||
|
||||
this.getBlobToStream(container, blob, writeStream, options, function (error, responseBlob, response) {
|
||||
if (error) {
|
||||
if (path.existsSync(localFilename)) {
|
||||
if (azureutil.pathExistsSync(localFilename)) {
|
||||
// make sure writeStream is closed / destroyed to avoid locking issues
|
||||
if (writeStream.close) {
|
||||
writeStream.close();
|
||||
|
|
|
@ -213,4 +213,9 @@ exports.stringIsDate = function(date) {
|
|||
*/
|
||||
exports.merge = function () {
|
||||
return _.extend.apply(this, arguments);
|
||||
};
|
||||
|
||||
exports.pathExistsSync = function (path) {
|
||||
var obj = fs.existsSync ? fs : path;
|
||||
return obj.existsSync.apply(obj, arguments);
|
||||
};
|
|
@ -82,12 +82,6 @@ function setupGoalStateEndpoint () {
|
|||
|
||||
suite('roleenvironment-tests', function () {
|
||||
setup(function (done) {
|
||||
// Temporary fix for node version < 0.8, starting from v0.8
|
||||
// path.existsSync has been deprecated.
|
||||
if (!fs.existsSync) {
|
||||
fs.existsSync = path.existsSync;
|
||||
}
|
||||
|
||||
// Set windows azure runtime endpoint
|
||||
originalWaRuntimeEndpoint = process.env['WaRuntimeEndpoint'];
|
||||
process.env['WaRuntimeEndpoint'] = versionsEndpointPath;
|
||||
|
@ -111,19 +105,19 @@ suite('roleenvironment-tests', function () {
|
|||
runtimeKernel.protocol1RuntimeGoalStateClient.currentEnvironmentData = null;
|
||||
runtimeKernel.protocol1RuntimeGoalStateClient.currentGoalState = null;
|
||||
|
||||
if (fs.existsSync(versionsEndpointPath)) {
|
||||
if (azureutil.pathExistsSync(versionsEndpointPath)) {
|
||||
fs.unlinkSync(versionsEndpointPath);
|
||||
}
|
||||
|
||||
if (fs.existsSync(goalStatePath)) {
|
||||
if (azureutil.pathExistsSync(goalStatePath)) {
|
||||
fs.unlinkSync(goalStatePath);
|
||||
}
|
||||
|
||||
if (fs.existsSync(currentStatePath)) {
|
||||
if (azureutil.pathExistsSync(currentStatePath)) {
|
||||
fs.unlinkSync(currentStatePath);
|
||||
}
|
||||
|
||||
if (fs.existsSync(roleEnvironmentPath)) {
|
||||
if (azureutil.pathExistsSync(roleEnvironmentPath)) {
|
||||
fs.unlinkSync(roleEnvironmentPath);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче