Skip to content

Commit

Permalink
Fix Misc Task Typos
Browse files Browse the repository at this point in the history
**Description**

- fixes miscellaneous typos present in the `@theia/task` extension.

**Breaking Changes**

- the method `reorgnizeTasks()` has been renamed to `reorganizeTasks()`.
- the method `getStrigifiedTaskSchema()` has been renamed to `getStringifiedTaskSchema()`.

Signed-off-by: vince-fugnitto <[email protected]>
  • Loading branch information
vince-fugnitto committed Dec 23, 2019
1 parent 2b13d55 commit d95e075
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 45 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## v0.15.0

Breaking changes:

- [task] renamed method `getStrigifiedTaskSchema()` has been renamed to `getStringifiedTaskSchema()` [#6780](https://github.com/eclipse-theia/theia/pull/6780)
- [task] renamed method `reorgnizeTasks()` has been renamed to `reorganizeTasks()` [#6780](https://github.com/eclipse-theia/theia/pull/6780)

## v0.14.0

- [application-manager] removed unnecessary `bunyan` dependency [#6651](https://github.com/eclipse-theia/theia/pull/6651)
Expand Down
10 changes: 5 additions & 5 deletions packages/task/src/browser/task-configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ export class TaskConfigurations implements Disposable {
}
})
);
this.reorgnizeTasks();
this.toDispose.push(this.taskSchemaUpdater.onDidChangeTaskSchema(() => this.reorgnizeTasks()));
this.reorganizeTasks();
this.toDispose.push(this.taskSchemaUpdater.onDidChangeTaskSchema(() => this.reorganizeTasks()));
}

setClient(client: TaskConfigurationClient): void {
Expand Down Expand Up @@ -261,7 +261,7 @@ export class TaskConfigurations implements Disposable {
this.removeTasks(rootFolderUri);
this.removeTaskCustomizations(rootFolderUri);

this.reorgnizeTasks();
this.reorganizeTasks();
}

/** parses a config file and extracts the tasks launch configurations */
Expand Down Expand Up @@ -360,7 +360,7 @@ export class TaskConfigurations implements Disposable {
* This function is called after a change in TaskDefinitionRegistry happens.
* It checks all tasks that have been loaded, and re-organized them in `tasksMap` and `taskCustomizationMap`.
*/
protected reorgnizeTasks(): void {
protected reorganizeTasks(): void {
const newTaskMap = new Map<string, Map<string, TaskConfiguration>>();
const newTaskCustomizationMap = new Map<string, TaskCustomization[]>();
const addCustomization = (rootFolder: string, customization: TaskCustomization) => {
Expand Down Expand Up @@ -414,7 +414,7 @@ export class TaskConfigurations implements Disposable {
* The task config, together with updates, will be written into the `tasks.json` if it is not found in the file.
*
* @param task task that the updates will be applied to
* @param update the updates to be appplied
* @param update the updates to be applied
*/
// tslint:disable-next-line:no-any
async updateTaskConfig(task: TaskConfiguration, update: { [name: string]: any }): Promise<void> {
Expand Down
36 changes: 18 additions & 18 deletions packages/task/src/browser/task-definition-registry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { TaskDefinitionRegistry } from './task-definition-registry';
// tslint:disable:no-unused-expression
describe('TaskDefinitionRegistry', () => {
let registry: TaskDefinitionRegistry;
const definitonContributionA = {
const definitionContributionA = {
taskType: 'extA',
source: 'extA',
required: ['extensionType'],
Expand All @@ -37,7 +37,7 @@ describe('TaskDefinitionRegistry', () => {
}
}
};
const definitonContributionB = {
const definitionContributionB = {
taskType: 'extA',
source: 'extA',
properties: {
Expand All @@ -61,48 +61,48 @@ describe('TaskDefinitionRegistry', () => {

describe('register function', () => {
it('should transform the task definition contribution and store it in memory', () => {
registry.register(definitonContributionA);
expect(registry['definitions'].get(definitonContributionA.taskType)).to.be.ok;
expect(registry['definitions'].get(definitonContributionA.taskType)![0]).to.deep.equal(definitonContributionA);
registry.register(definitionContributionA);
expect(registry['definitions'].get(definitionContributionA.taskType)).to.be.ok;
expect(registry['definitions'].get(definitionContributionA.taskType)![0]).to.deep.equal(definitionContributionA);
});
});

describe('getDefinitions function', () => {
it('should return all definitions associated with the given type', () => {
registry.register(definitonContributionA);
const defs1 = registry.getDefinitions(definitonContributionA.taskType);
registry.register(definitionContributionA);
const defs1 = registry.getDefinitions(definitionContributionA.taskType);
expect(defs1.length).to.eq(1);

registry.register(definitonContributionB);
const defs2 = registry.getDefinitions(definitonContributionA.taskType);
registry.register(definitionContributionB);
const defs2 = registry.getDefinitions(definitionContributionA.taskType);
expect(defs2.length).to.eq(2);
});
});

describe('getDefinition function', () => {
it('should return undefined if the given task configuration does not match any registered definitions', () => {
registry.register(definitonContributionA);
registry.register(definitonContributionB);
registry.register(definitionContributionA);
registry.register(definitionContributionB);
const defs = registry.getDefinition({
type: definitonContributionA.taskType, label: 'grunt task', task: 'build'
type: definitionContributionA.taskType, label: 'grunt task', task: 'build'
});
expect(defs).to.be.not.ok;
});

it('should return the best match if there is one or more registered definitions match the given task configuration', () => {
registry.register(definitonContributionA);
registry.register(definitonContributionB);
registry.register(definitionContributionA);
registry.register(definitionContributionB);
const defs = registry.getDefinition({
type: definitonContributionA.taskType, label: 'extention task', extensionType: 'extensionType', taskLabel: 'taskLabel'
type: definitionContributionA.taskType, label: 'extension task', extensionType: 'extensionType', taskLabel: 'taskLabel'
});
expect(defs).to.be.ok;
expect(defs!.taskType).to.be.eq(definitonContributionA.taskType);
expect(defs!.taskType).to.be.eq(definitionContributionA.taskType);

const defs2 = registry.getDefinition({
type: definitonContributionA.taskType, label: 'extention task', extensionType: 'extensionType', taskLabel: 'taskLabel', taskDetailedLabel: 'taskDetailedLabel'
type: definitionContributionA.taskType, label: 'extension task', extensionType: 'extensionType', taskLabel: 'taskLabel', taskDetailedLabel: 'taskDetailedLabel'
});
expect(defs2).to.be.ok;
expect(defs2!.taskType).to.be.eq(definitonContributionB.taskType);
expect(defs2!.taskType).to.be.eq(definitionContributionB.taskType);
});
});
});
6 changes: 3 additions & 3 deletions packages/task/src/browser/task-schema-updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class TaskSchemaUpdater {

taskConfigurationSchema.anyOf = [processTaskConfigurationSchema, ...customizedDetectedTasks, ...customSchemas];

const schemaContent = this.getStrigifiedTaskSchema();
const schemaContent = this.getStringifiedTaskSchema();
try {
this.inmemoryResources.update(taskSchemaUri, schemaContent);
} catch (e) {
Expand All @@ -89,7 +89,7 @@ export class TaskSchemaUpdater {

/**
* Adds given task schema to `taskConfigurationSchema` as `oneOf` subschema.
* Replaces existed subschema by given schema if the corrresponding `$id` properties are equal.
* Replaces existed subschema by given schema if the corresponding `$id` properties are equal.
*
* Note: please provide `$id` property for subschema to have ability remove/replace it.
* @param schema subschema for adding to `taskConfigurationSchema`
Expand Down Expand Up @@ -190,7 +190,7 @@ export class TaskSchemaUpdater {
}

/** Returns the task's JSON schema as a string */
private getStrigifiedTaskSchema(): string {
private getStringifiedTaskSchema(): string {
return JSON.stringify(this.getTaskSchema());
}

Expand Down
2 changes: 1 addition & 1 deletion packages/task/src/browser/task-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ export class TaskService implements TaskConfigurationClient {
* The task config, together with updates, will be written into the `tasks.json` if it is not found in the file.
*
* @param task task that the updates will be applied to
* @param update the updates to be appplied
* @param update the updates to be applied
*/
// tslint:disable-next-line:no-any
async updateTaskConfiguration(task: TaskConfiguration, update: { [name: string]: any }): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion packages/task/src/node/process/process-task-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class ProcessTaskRunner implements TaskRunner {
args: Array<string | QuotedString> | undefined,
options: CommandOptions
} {
// initialise with default values from the `taskConfig`
// initialize with default values from the `taskConfig`
let command: string | undefined = taskConfig.command;
let args: Array<string | QuotedString> | undefined = taskConfig.args;
let options: CommandOptions = taskConfig.options || {};
Expand Down
10 changes: 5 additions & 5 deletions packages/task/src/node/process/process-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,20 @@ export class ProcessTask extends Task {
});

// Buffer to accumulate incoming output.
let databuf: string = '';
let dataBuffer: string = '';
this.process.outputStream.on('data', (chunk: string) => {
databuf += chunk;
dataBuffer += chunk;

while (1) {
// Check if we have a complete line.
const eolIdx = databuf.indexOf('\n');
const eolIdx = dataBuffer.indexOf('\n');
if (eolIdx < 0) {
break;
}

// Get and remove the line from the data buffer.
const lineBuf = databuf.slice(0, eolIdx);
databuf = databuf.slice(eolIdx + 1);
const lineBuf = dataBuffer.slice(0, eolIdx);
dataBuffer = dataBuffer.slice(eolIdx + 1);
const processedLine = removeAnsiEscapeCodes(lineBuf);
this.fireOutputLine({
taskId: this.taskId,
Expand Down
24 changes: 12 additions & 12 deletions packages/task/src/node/task-server.slow-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('Task server / back-end', function (): void {
const config = createProcessTaskConfig('shell', command, [], FileUri.create(wsRoot).toString());
const taskInfo: TaskInfo = await taskServer.run(config, wsRoot);

const p = checkSuccessfullProcessExit(taskInfo, taskWatcher);
const p = checkSuccessfulProcessExit(taskInfo, taskWatcher);

await p;
});
Expand All @@ -144,7 +144,7 @@ describe('Task server / back-end', function (): void {
const command = isWindows ? commandShortRunningWindows : (isOSX ? commandShortRunningOsx : commandShortRunning);
const taskInfo: TaskInfo = await taskServer.run(createProcessTaskConfig('shell', command, []), wsRoot);

const p = checkSuccessfullProcessExit(taskInfo, taskWatcher);
const p = checkSuccessfulProcessExit(taskInfo, taskWatcher);

await p;
});
Expand All @@ -154,7 +154,7 @@ describe('Task server / back-end', function (): void {
const executable = FileUri.fsPath(wsRootUri.resolve(command));
const taskInfo: TaskInfo = await taskServer.run(createProcessTaskConfig('process', executable, []));

const p = checkSuccessfullProcessExit(taskInfo, taskWatcher);
const p = checkSuccessfulProcessExit(taskInfo, taskWatcher);

await p;
});
Expand All @@ -166,7 +166,7 @@ describe('Task server / back-end', function (): void {
const taskConfig: TaskConfiguration = createTaskConfig('npm', command, []);
const taskInfo: TaskInfo = await taskServer.run(taskConfig, wsRoot);

const p = checkSuccessfullProcessExit(taskInfo, taskWatcher);
const p = checkSuccessfulProcessExit(taskInfo, taskWatcher);

await p;
});
Expand All @@ -177,7 +177,7 @@ describe('Task server / back-end', function (): void {
const opts: TaskConfiguration = createProcessTaskConfig('shell', command, []);
const taskInfo: TaskInfo = await taskServer.run(opts, wsRoot);

const p = checkSuccessfullProcessExit(taskInfo, taskWatcher);
const p = checkSuccessfulProcessExit(taskInfo, taskWatcher);

await p;
});
Expand All @@ -186,7 +186,7 @@ describe('Task server / back-end', function (): void {
const command = isWindows ? commandWindowsNoop : commandUnixNoop;
const taskInfo: TaskInfo = await taskServer.run(createProcessTaskConfig('process', command, []), wsRoot);

const p = checkSuccessfullProcessExit(taskInfo, taskWatcher);
const p = checkSuccessfulProcessExit(taskInfo, taskWatcher);

await p;
});
Expand Down Expand Up @@ -329,21 +329,21 @@ describe('Task server / back-end', function (): void {
it('creating and killing a bunch of tasks works as expected', async function (): Promise<void> {
// const command = isWindows ? command_absolute_path_long_running_windows : command_absolute_path_long_running;
const numTasks = 20;
const taskinfo: TaskInfo[] = [];
const taskInfo: TaskInfo[] = [];

// create a mix of terminal and raw processes
for (let i = 0; i < numTasks; i++) {
if (i % 2 === 0) {
taskinfo.push(await taskServer.run(createTaskConfigTaskLongRunning('shell')));
taskInfo.push(await taskServer.run(createTaskConfigTaskLongRunning('shell')));
} else {
taskinfo.push(await taskServer.run(createTaskConfigTaskLongRunning('process')));
taskInfo.push(await taskServer.run(createTaskConfigTaskLongRunning('process')));
}
}

const numRunningTasksAfterCreated = await taskServer.getTasks();

for (let i = 0; i < taskinfo.length; i++) {
await taskServer.kill(taskinfo[i].taskId);
for (let i = 0; i < taskInfo.length; i++) {
await taskServer.kill(taskInfo[i].taskId);
}
const numRunningTasksAfterKilled = await taskServer.getTasks();

Expand Down Expand Up @@ -412,7 +412,7 @@ function createTaskConfigTaskLongRunning(processType: ProcessType): TaskConfigur
};
}

function checkSuccessfullProcessExit(taskInfo: TaskInfo, taskWatcher: TaskWatcher): Promise<object> {
function checkSuccessfulProcessExit(taskInfo: TaskInfo, taskWatcher: TaskWatcher): Promise<object> {
const p = new Promise<object>((resolve, reject) => {
const toDispose = taskWatcher.onTaskExit((event: TaskExitedEvent) => {
if (event.taskId === taskInfo.taskId && event.code === 0) {
Expand Down

0 comments on commit d95e075

Please sign in to comment.