Merge pull request #13 from balajikris/FixMacIssues
Fix some cross-plat bugs and misc issues.
This commit is contained in:
Коммит
5fbbf68928
|
@ -79,10 +79,14 @@ exports.getNameAssignmentForModule = function getNameAssignmentForModule(module)
|
|||
case 'ms-rest-azure':
|
||||
return 'msRestAzure';
|
||||
default:
|
||||
return;
|
||||
return getDefaultName(module);
|
||||
}
|
||||
};
|
||||
|
||||
function getDefaultName(module){
|
||||
return module.split('-').map(v => v.charAt(0).toUpperCase() + v.slice(1)).join('');
|
||||
}
|
||||
|
||||
exports.generateNewLine = function generateNewLine() {
|
||||
return this.generateCode('\r\n');
|
||||
};
|
||||
|
|
|
@ -12,11 +12,6 @@ exports.deployTemplate = function deployTemplate() {
|
|||
var templateParametersFilePath;\
|
||||
var template;\
|
||||
var templateParameters;\
|
||||
var parameters = {\
|
||||
template: template,\
|
||||
parameters: templateParameters,\
|
||||
mode: \'Complete\'\
|
||||
};\
|
||||
\r\n
|
||||
try {\
|
||||
template = JSON.parse(fs.readFileSync(templateFilePath));\
|
||||
|
@ -25,6 +20,17 @@ exports.deployTemplate = function deployTemplate() {
|
|||
callback(error);\
|
||||
}\
|
||||
\r\n
|
||||
if (templateParameters.parameters)\
|
||||
templateParameters = templateParameters.parameters;\
|
||||
\r\n
|
||||
var parameters = {\
|
||||
properties: {\
|
||||
template: template,\
|
||||
parameters: templateParameters,\
|
||||
mode: \'Complete\'\
|
||||
}\
|
||||
};\
|
||||
\r\n
|
||||
var resourceClient = new ResourceManagement.ResourceManagementClient(credentials, subscriptionId);\
|
||||
resourceClient.deployments.createOrUpdate(resourceGroupName, deploymentName, parameters, callback);\
|
||||
}`;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var os = require('os');
|
||||
var vscode = require('vscode');
|
||||
var codegen = require('../codegen/codgen.template-deploy');
|
||||
var jsonEditor = require('../codegen/jsoneditor');
|
||||
|
@ -66,7 +67,7 @@ function generateCodeInEditor() {
|
|||
|
||||
// insert code for template deployment.
|
||||
const range = new vscode.Range(new vscode.Position(lineCount, 0), new vscode.Position(lineCount + 1, 0));
|
||||
builder.replace(range, methodBody);
|
||||
builder.replace(range, os.EOL + methodBody);
|
||||
|
||||
// fix callsite to invoke the function that was newly generated.
|
||||
const currentPos = new vscode.Position(vscode.window.activeTextEditor.selection.active.line, 0);
|
||||
|
|
|
@ -111,7 +111,7 @@ function getSourceLocation() {
|
|||
var files = vscode.workspace.textDocuments.filter(item => item.isUntitled === false);
|
||||
if (files) {
|
||||
var sourceFile = files[0].fileName;
|
||||
return sourceFile.slice(0, sourceFile.lastIndexOf('\\') + 1);
|
||||
return sourceFile.slice(0, sourceFile.lastIndexOf(path.sep) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче