Skip to content
This repository has been archived by the owner on Jun 17, 2019. It is now read-only.

Changed Task Generation to be Cross Platform #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions generators/taskitem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,17 @@ function writeFiles() {

if (this.taskScripting == "PowerShell") {
this.fs.copyTpl(
this.templatePath('Task/task.ps1'),
this.templatePath('task/task.ps1'),
this.destinationPath(taskFolder + '/' + this.taskName + '.ps1'), tokens
);
} else if (this.taskScripting == "TypeScript") {
this.fs.copyTpl(
this.templatePath('Task/task.ts'),
this.templatePath('task/task.ts'),
this.destinationPath(taskFolder + '/' + this.taskName + '.ts'), tokens
);

this.fs.copyTpl(
this.templatePath('Task/package.json'),
this.templatePath('task/package.json'),
this.destinationPath(taskFolder + '/' + 'package.json'), tokens
);

Expand All @@ -204,12 +204,12 @@ function writeFiles() {


this.fs.copyTpl(
this.templatePath('Task/task.json'),
this.templatePath('task/task.json'),
this.destinationPath(taskFolder + '/task.json'), tokens

);
this.fs.copy(
this.templatePath('Task/icon.png'),
this.templatePath('task/icon.png'),
this.destinationPath(taskFolder + '/icon.png')
);

Expand Down Expand Up @@ -249,13 +249,13 @@ function writeFiles() {

if (this.useVS) {
this.fs.copyTpl(
this.templatePath('extId.csproj'),
this.templatePath('ExtId.csproj'),
this.destinationPath(extensionFolder + '/' + this.extId + '.csproj'), tokens
);


this.fs.copyTpl(
this.templatePath('extId.sln'),
this.templatePath('ExtId.sln'),
this.destinationPath(this.extId + '/' + this.extId + '.sln'), tokens
);

Expand Down Expand Up @@ -286,7 +286,7 @@ function install() {
this.spawnCommandSync('npm', ['install'], { stdio: ['pipe', 'pipe', process.stderr] });

this.log(`+ Running npm run package for vsix generating`);

if (this.taskScripting == "TypeScript") {
this.spawnCommandSync('npm', ['run', 'install-task-lib'], { stdio: ['pipe', 'pipe', process.stderr] });
}
Expand Down
4 changes: 2 additions & 2 deletions generators/taskitem/templates/vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"screenshots": [
{
"path": "static/images/screen1.png"
"path": "static/images/Screen1.png"
}
],
"content": {
Expand Down Expand Up @@ -75,4 +75,4 @@
}
}
]
}
}
40 changes: 19 additions & 21 deletions test/taskTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,24 @@ describe('generator-team-services-extension-task-Powershell', function () {


it('generator-team-services-extension-task-Powershell:creates files', () => {
var root = testPath + '\\TestextTaskId1\\TestextTaskId1\\';
var taskPath = root + "taskName1\\"
var root = testPath + '/TestextTaskId1/TestextTaskId1/';
var taskPath = root + 'taskName1/';
assert.file([
root + 'TestextTaskId1.csproj',
root + 'package.json',
root + 'vss-extension.json',
root + 'static/images/logo.png',
root + 'static/images/screen1.png',
root + 'static/images/Screen1.png',
root + 'license.md',
root + 'overview.md',
root + 'ThirdPartyNotices.txt',
taskPath + "taskName1.ps1",
taskPath + "task.json",
taskPath + "icon.png"
taskPath + 'taskName1.ps1',
taskPath + 'task.json',
taskPath + 'icon.png'
]);
assert.fileContent(root + 'vss-extension.json', /"id": "TestextTaskId1"/);
assert.fileContent(root + 'vss-extension.json', /"name": "TestextTask1"/)

})
assert.fileContent(root + 'vss-extension.json', /"name": "TestextTask1"/);
});

it(`generator-team-services-extension-task-Powershell:npm install should be called`, () => {
assert.equal(1, spawnStub.withArgs(`npm`, [`install`], { stdio: ['pipe', 'pipe', process.stderr] }).callCount, `npm install was not be called`);
Expand Down Expand Up @@ -115,28 +114,27 @@ describe('generator-team-services-extension-task-TypeScript', function () {


it('generator-team-services-extension-task-TypeScript:creates files', () => {
var root = testPath + '\\TestextTaskId1\\TestextTaskId1\\';
var taskPath = root + "taskName1\\"
var root = testPath + '/TestextTaskId1/TestextTaskId1/';
var taskPath = root + 'taskName1/';
assert.file([
root + 'TestextTaskId1.csproj',
root + 'package.json',
root + 'vss-extension.json',
root + 'static/images/logo.png',
root + 'static/images/screen1.png',
root + 'static/images/Screen1.png',
root + 'license.md',
root + 'overview.md',
root + 'ThirdPartyNotices.txt',
root + 'tsconfig.json',
taskPath + "taskName1.ts",
taskPath + "package.json",
taskPath + "task.json",
taskPath + "icon.png"
taskPath + 'taskName1.ts',
taskPath + 'package.json',
taskPath + 'task.json',
taskPath + 'icon.png'
]);

assert.fileContent(root + 'vss-extension.json', /"id": "TestextTaskId1"/);
assert.fileContent(root + 'vss-extension.json', /"name": "TestextTask1"/)

})
assert.fileContent(root + 'vss-extension.json', /"id": "TestextTaskId1"/);
assert.fileContent(root + 'vss-extension.json', /"name": "TestextTask1"/);
});

it(`generator-team-services-extension-task-TypeScript:npm install should be called`, () => {
assert.equal(1, spawnStub.withArgs(`npm`, [`install`], { stdio: ['pipe', 'pipe', process.stderr] }).callCount, `npm install was not be called`);
Expand All @@ -150,4 +148,4 @@ describe('generator-team-services-extension-task-TypeScript', function () {
assert.equal(1, spawnStub.withArgs(`npm`, ['run', 'package'], { stdio: ['pipe', 'pipe', process.stderr] }).callCount, `npm run package was not be called`);
});

});
});