Skip to content

Commit c1b9c2d

Browse files
committed
Rename to zip
1 parent 20b8879 commit c1b9c2d

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

src/observers/WarningMessageObserver.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { MessageItem, vscode } from '../vscodeAdapter';
7-
import { BaseEvent, OmnisharpServerOnError, OmnisharpServerMsBuildProjectDiagnostics, ArchiveError } from "../omnisharp/loggingEvents";
7+
import { BaseEvent, OmnisharpServerOnError, OmnisharpServerMsBuildProjectDiagnostics, ZipError } from "../omnisharp/loggingEvents";
88
import { Scheduler } from 'rxjs/Scheduler';
99
import { Subject } from 'rxjs/Subject';
1010
import 'rxjs/add/operator/debounceTime';
@@ -32,8 +32,8 @@ export class WarningMessageObserver {
3232
case OmnisharpServerMsBuildProjectDiagnostics.name:
3333
this.handleOmnisharpServerMsBuildProjectDiagnostics(<OmnisharpServerMsBuildProjectDiagnostics>event);
3434
break;
35-
case ArchiveError.name:
36-
this.handleArchiveError(<ArchiveError>event);
35+
case ZipError.name:
36+
this.handleArchiveError(<ZipError>event);
3737
break;
3838
}
3939
}
@@ -44,7 +44,7 @@ export class WarningMessageObserver {
4444
}
4545
}
4646

47-
private async handleArchiveError(event: ArchiveError) {
47+
private async handleArchiveError(event: ZipError) {
4848
await showWarningMessage(this.vscode, event.message);
4949
}
5050
}

src/omnisharp/loggingEvents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export class DownloadSizeObtained implements BaseEvent {
118118
constructor(public packageSize: number) { }
119119
}
120120

121-
export class ArchiveError implements BaseEvent {
121+
export class ZipError implements BaseEvent {
122122
constructor(public message: string) { }
123123
}
124124

src/packageManager/PackageManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Package } from './Package';
88
import { PackageError } from './PackageError';
99
import { NestedError } from "../NestedError";
1010
import { DownloadFile } from './FileDownloader';
11-
import { InstallArchive } from './ArchiveInstaller';
11+
import { InstallZip } from './ZipInstaller';
1212
import { EventStream } from '../EventStream';
1313
import { NetworkSettingsProvider } from "../NetworkSettings";
1414
import { filterPackages } from "./PackageFilterer";
@@ -21,7 +21,7 @@ export async function DownloadAndInstallPackages(packages: Package[], provider:
2121
for (let pkg of filteredPackages) {
2222
try {
2323
let buffer = await DownloadFile(pkg.description, eventStream, provider, pkg.url, pkg.fallbackUrl);
24-
await InstallArchive(buffer, pkg.description, pkg.installPath, pkg.binaries, eventStream);
24+
await InstallZip(buffer, pkg.description, pkg.installPath, pkg.binaries, eventStream);
2525
}
2626
catch (error) {
2727
if (error instanceof NestedError) {

src/packageManager/ArchiveInstaller.ts renamed to src/packageManager/ZipInstaller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ import * as mkdirp from 'mkdirp';
88
import * as path from 'path';
99
import * as yauzl from 'yauzl';
1010
import { EventStream } from "../EventStream";
11-
import { InstallationStart, ArchiveError } from "../omnisharp/loggingEvents";
11+
import { InstallationStart, ZipError } from "../omnisharp/loggingEvents";
1212
import { NestedError } from '../NestedError';
1313

14-
export async function InstallArchive(buffer: Buffer, description: string, destinationInstallPath: string, binaries: string[], eventStream: EventStream): Promise<void> {
14+
export async function InstallZip(buffer: Buffer, description: string, destinationInstallPath: string, binaries: string[], eventStream: EventStream): Promise<void> {
1515
eventStream.post(new InstallationStart(description));
1616

1717
return new Promise<void>((resolve, reject) => {
1818
yauzl.fromBuffer(buffer, { lazyEntries: true }, (err, zipFile) => {
1919
if (err) {
20-
eventStream.post(new ArchiveError("C# Extension was unable to download its dependencies. Please check your internet connection. If you use a proxy server, please visit https://aka.ms/VsCodeCsharpNetworking"));
21-
return reject(new NestedError('Corrupted archive error'));
20+
eventStream.post(new ZipError("C# Extension was unable to download its dependencies. Please check your internet connection. If you use a proxy server, please visit https://aka.ms/VsCodeCsharpNetworking"));
21+
return reject(new NestedError('Corrupted zip error'));
2222
}
2323

2424
zipFile.readEntry();

test/unitTests/Packages/ArchiveInstaller.test.ts renamed to test/unitTests/Packages/ZipInstaller.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import * as path from 'path';
88
import * as chai from 'chai';
99
import * as util from '../../../src/common';
1010
import { CreateTmpDir, TmpAsset } from '../../../src/CreateTmpAsset';
11-
import { InstallArchive } from '../../../src/packageManager/ArchiveInstaller';
11+
import { InstallZip } from '../../../src/packageManager/ZipInstaller';
1212
import { EventStream } from '../../../src/EventStream';
1313
import { PlatformInformation } from '../../../src/platform';
14-
import { BaseEvent, InstallationStart, ArchiveError } from '../../../src/omnisharp/loggingEvents';
14+
import { BaseEvent, InstallationStart, ZipError } from '../../../src/omnisharp/loggingEvents';
1515
import { Files, Binaries, createTestZipAsync } from '../testAssets/CreateTestZip';
1616

1717
chai.use(require("chai-as-promised"));
@@ -38,15 +38,15 @@ suite('ArchiveInstaller', () => {
3838
});
3939

4040
test('The folder is unzipped and all the files are present at the expected paths', async () => {
41-
await InstallArchive(testBuffer, fileDescription, installationPath, [], eventStream);
41+
await InstallZip(testBuffer, fileDescription, installationPath, [], eventStream);
4242
for (let elem of allFiles) {
4343
let filePath = path.join(installationPath, elem.path);
4444
expect(await util.fileExists(filePath)).to.be.true;
4545
}
4646
});
4747

4848
test('The folder is unzipped and all the expected events are created', async () => {
49-
await InstallArchive(testBuffer, fileDescription, installationPath, [], eventStream);
49+
await InstallZip(testBuffer, fileDescription, installationPath, [], eventStream);
5050
let eventSequence: BaseEvent[] = [
5151
new InstallationStart(fileDescription)
5252
];
@@ -56,7 +56,7 @@ suite('ArchiveInstaller', () => {
5656
test('The folder is unzipped and the binaries have the expected permissions(except on Windows)', async () => {
5757
if (!((await PlatformInformation.GetCurrent()).isWindows())) {
5858
let resolvedBinaryPaths = Binaries.map(binary => path.join(installationPath, binary.path));
59-
await InstallArchive(testBuffer, fileDescription, installationPath, resolvedBinaryPaths, eventStream);
59+
await InstallZip(testBuffer, fileDescription, installationPath, resolvedBinaryPaths, eventStream);
6060
for (let binaryPath of resolvedBinaryPaths) {
6161
expect(await util.fileExists(binaryPath)).to.be.true;
6262
let mode = (await fs.stat(binaryPath)).mode;
@@ -65,18 +65,18 @@ suite('ArchiveInstaller', () => {
6565
}
6666
});
6767

68-
test('Error is thrown when the buffer contains an invalid archive', async () => {
69-
expect(InstallArchive(new Buffer("My file", "utf8"), "Text File", installationPath, [], eventStream)).to.be.rejected;
68+
test('Error is thrown when the buffer contains an invalid zip', async () => {
69+
expect(InstallZip(new Buffer("My file", "utf8"), "Text File", installationPath, [], eventStream)).to.be.rejected;
7070
});
7171

72-
test('Error event is created when the buffer contains an invalid archive', async () => {
72+
test('Error event is created when the buffer contains an invalid zip', async () => {
7373
try {
74-
await InstallArchive(new Buffer("some content", "utf8"), "Text File", installationPath, [], eventStream);
74+
await InstallZip(new Buffer("some content", "utf8"), "Text File", installationPath, [], eventStream);
7575
}
7676
catch{
7777
let eventSequence: BaseEvent[] = [
7878
new InstallationStart("Text File"),
79-
new ArchiveError("C# Extension was unable to download its dependencies. Please check your internet connection. If you use a proxy server, please visit https://aka.ms/VsCodeCsharpNetworking")
79+
new ZipError("C# Extension was unable to download its dependencies. Please check your internet connection. If you use a proxy server, please visit https://aka.ms/VsCodeCsharpNetworking")
8080
];
8181
expect(eventBus).to.be.deep.equal(eventSequence);
8282
}

test/unitTests/logging/WarningMessageObserver.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { WarningMessageObserver } from '../../../src/observers/WarningMessageObserver';
77
import { assert, use as chaiUse, expect, should } from 'chai';
88
import { getFakeVsCode, getMSBuildDiagnosticsMessage, getOmnisharpMSBuildProjectDiagnosticsEvent, getOmnisharpServerOnErrorEvent } from '../testAssets/Fakes';
9-
import { BaseEvent, ArchiveError } from '../../../src/omnisharp/loggingEvents';
9+
import { BaseEvent, ZipError } from '../../../src/omnisharp/loggingEvents';
1010
import { vscode } from '../../../src/vscodeAdapter';
1111
import { TestScheduler } from 'rxjs/testing/TestScheduler';
1212
import { Observable } from 'rxjs/Observable';
@@ -173,9 +173,9 @@ suite('WarningMessageObserver', () => {
173173
});
174174
});
175175

176-
suite('ArchiveError', () => {
176+
suite('ZipError', () => {
177177
test('When the event is fired then a warning message is displayed', () => {
178-
let event = new ArchiveError("This is an error");
178+
let event = new ZipError("This is an error");
179179
observer.post(event);
180180
expect(warningMessages.length).to.be.equal(1);
181181
expect(warningMessages[0]).to.be.equal("This is an error");

0 commit comments

Comments
 (0)