This commit is contained in:
Cale Teeter 2020-11-05 15:11:25 -05:00
Родитель efbe844ed2
Коммит 2a50f58124
6 изменённых файлов: 151 добавлений и 174 удалений

Просмотреть файл

@ -2,6 +2,16 @@
All notable changes to the "azure blockchain" extension will be documented in this file.
## 1.6.0
### Enhancements
- Removed the dependency of Python for this extension. This was required by a nested component used by the exntension but has been removed. ([#67](https://github.com/microsoft/vscode-azure-blockchain-ethereum/issues/67) by [@pinakighatak](https://github.com/pinakighatak))
### Fixes
### Internal Improvements
## 1.5.0
### Enhancements

Просмотреть файл

@ -5,7 +5,7 @@
"publisher": "AzBlockchain",
"preview": false,
"icon": "images/blockchain-service-logo.png",
"version": "1.5.0",
"version": "1.6.0",
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/vscode-azure-blockchain-ethereum"

Просмотреть файл

@ -1,73 +1,127 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="{{root}}/resources/welcome/main.css">
</head>
<body class="vscode-dark">
<div id="content">
<div id="main-content">
<div class="required-block">
<div>
<h2>Required apps</h2>
<br>
This extension requires your development machine have the following tools already installed. These cannot be installed directly by the extension.
If you do not have these tools already installed, the links below will take you to the download page
<ul>
<li>Node JS</li>
<li>Git</li>
<li>Python</li>
</ul>
<p>
<a href="https://aka.ms/vscodebcextensionwiki">Click here</a> to learn more about this extension, and view the users guide
</p>
<div class="required">
<div id="node" class="required-app disabled">
<img src="{{root}}/images/NodeLogo.png">
<div class="description">Required version: <span class="version">10.15.0</span></div>
<a class="spinner" href="https://nodejs.org"><span>Install Node.js</span></a>
</div>
<div id="git" class="required-app disabled">
<img src="{{root}}/images/GitLogo.png">
<div class="description">Required version: <span class="version">2.10.0</span></div>
<a class="spinner" href="https://git-scm.com/downloads"><span>Install Git</span></a>
</div>
<div id="python" class="required-app disabled">
<img src="{{root}}/images/PythonLogo.png">
<div class="description">Required version: <span class="version">2.7.15</span></div>
<a class="spinner" href="https://www.python.org/downloads/release/python-2715/"><span>Install Python</span></a>
<head>
<link rel="stylesheet" href="{{root}}/resources/welcome/main.css" />
</head>
<body class="vscode-dark">
<div id="content">
<div id="main-content">
<div class="required-block">
<div>
<h2>Required apps</h2>
<br />
This extension requires your development machine have
the following tools already installed. These cannot be
installed directly by the extension. If you do not have
these tools already installed, the links below will take
you to the download page
<ul>
<li>Node JS</li>
<li>Git</li>
<li>Python</li>
</ul>
<p>
<a href="https://aka.ms/vscodebcextensionwiki"
>Click here</a
>
to learn more about this extension, and view the
users guide
</p>
<div class="required">
<div id="node" class="required-app disabled">
<img src="{{root}}/images/NodeLogo.png" />
<div class="description">
Required version:
<span class="version">10.15.0</span>
</div>
<a class="spinner" href="https://nodejs.org"
><span>Install Node.js</span></a
>
</div>
<div id="git" class="required-app disabled">
<img src="{{root}}/images/GitLogo.png" />
<div class="description">
Required version:
<span class="version">2.10.0</span>
</div>
<a
class="spinner"
href="https://git-scm.com/downloads"
><span>Install Git</span></a
>
</div>
<div id="npm" class="required-app disabled">
<img src="{{root}}/images/NpmLogo.png" />
<div class="description">
Required version:
<span class="version">6.4.1</span>
</div>
<a
id="installNpm"
class="spinner action"
title="Install NPM"
><span>Install NPM</span></a
>
</div>
</div>
<p>
At this time, while the extension is still in
public-preview, you will also need to install the
Truffle Suite of developer tools. Click the links
below to install the Truffle tools directly from
this extension
</p>
<div class="required">
<div id="truffle" class="required-app disabled">
<img src="{{root}}/images/TruffleLogo.svg" />
<div class="description">
Required version:
<span class="version">5.0.0</span>
</div>
<a
id="installTruffle"
class="spinner action"
title="Install Truffle"
><span>Install Truffle Suite</span></a
>
</div>
<div id="ganache-cli" class="required-app disabled">
<img src="{{root}}/images/GanacheLogo.png" />
<div class="description">
Required version:
<span class="version">6.0.0</span>
</div>
<a
id="installGanache"
class="spinner action"
title="Install Ganache"
><span>Install Ganache CLI</span></a
>
</div>
</div>
</div>
</div>
<p>
At this time, while the extension is still in public-preview, you will also need to install the Truffle Suite of developer tools.
Click the links below to install the Truffle tools directly from this extension
<p class="showOnStartup">
<input
type="checkbox"
id="showOnStartup"
class="checkbox"
checked="checked"
/>
<label class="caption" for="showOnStartup"
>Show this page on startup</label
>
</p>
<div class="required">
<div id="npm" class="required-app disabled">
<img src="{{root}}/images/NpmLogo.png">
<div class="description">Required version: <span class="version">6.4.1</span></div>
<a id="installNpm" class="spinner action" title="Install NPM"><span>Install NPM</span></a>
</div>
<div id="truffle" class="required-app disabled">
<img src="{{root}}/images/TruffleLogo.svg">
<div class="description">Required version: <span class="version">5.0.0</span></div>
<a id="installTruffle" class="spinner action" title="Install Truffle"><span>Install Truffle Suite</span></a>
</div>
<div id="ganache-cli" class="required-app disabled">
<img src="{{root}}/images/GanacheLogo.png">
<div class="description">Required version: <span class="version">6.0.0</span></div>
<a id="installGanache" class="spinner action" title="Install Ganache"><span>Install Ganache CLI</span></a>
</div>
</div>
</div>
</div>
<p class="showOnStartup">
<input type="checkbox" id="showOnStartup" class="checkbox" checked="checked">
<label class="caption" for="showOnStartup">Show this page on startup</label>
</p>
</div>
</div>
<script type="text/javascript" src="{{root}}/resources/welcome/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="{{root}}/resources/welcome/main.js"></script>
</body>
<script
type="text/javascript"
src="{{root}}/resources/welcome/jquery-3.3.1.min.js"
></script>
<script
type="text/javascript"
src="{{root}}/resources/welcome/main.js"
></script>
</body>
</html>

Просмотреть файл

@ -110,10 +110,6 @@ export class Constants {
},
[RequiredApps.node]: '10.15.0',
[RequiredApps.npm]: '6.4.1',
[RequiredApps.python]: {
max: '3.0.0',
min: '2.7.15',
},
[RequiredApps.truffle]: {
max: '6.0.0',
min: '5.0.0',
@ -602,7 +598,7 @@ export class Constants {
NoContractBody: 'No contract body in AST',
NoSubscriptionFound: 'No subscription found.',
NoSubscriptionFoundClick: 'No subscription found, click an Azure account ' +
'at the bottom left corner and choose Select All',
'at the bottom left corner and choose Select All',
PleaseRenameOldStyleTruffleConfig: 'Please rename file "truffle.js" to "truffle-config.js"',
RequiredAppsAreNotInstalled: 'To run command you should install required apps',
SolidityContractsNotFound: 'Solidity contracts were not found',

Просмотреть файл

@ -144,10 +144,6 @@ export namespace required {
currentState.git = currentState.git ||
await createRequiredVersion(RequiredApps.git, getGitVersion);
}
if (apps.includes(RequiredApps.python)) {
currentState.python = currentState.python ||
await createRequiredVersion(RequiredApps.python, getPythonVersion);
}
if (apps.includes(RequiredApps.truffle)) {
currentState.truffle = currentState.truffle ||
await createRequiredVersion(RequiredApps.truffle, getTruffleVersion);

Просмотреть файл

@ -26,11 +26,6 @@ const gitValidVersion: commands.ICommandResult = {
cmdOutputIncludingStderr: '',
code: 0,
};
const pythonValidVersion: commands.ICommandResult = {
cmdOutput: ' 2.9.0',
cmdOutputIncludingStderr: '',
code: 0,
};
const truffleValidVersion: commands.ICommandResult = {
cmdOutput: 'truffle@5.5.0',
cmdOutputIncludingStderr: '',
@ -208,54 +203,6 @@ describe('Required helper', () => {
});
});
describe('getPythonVersion', () => {
it('should return empty string when tryExecuteCommand throws an error', async () => {
// Arrange
tryExecuteCommandMock.throws(TestConstants.testError);
// Act
const result = await requiredRewire.required.getPythonVersion();
// Assert
assert.strictEqual(result, '', 'returned result should be empty');
assert.strictEqual(tryExecuteCommandMock.calledOnce, true, 'tryExecuteCommand should be called once');
});
it('should return empty string when tryExecuteCommand returns not zero code', async () => {
// Arrange
const executionResult: commands.ICommandResult = {
cmdOutput: ' 11.0.0',
cmdOutputIncludingStderr: '',
code: 1,
};
tryExecuteCommandMock.returns(executionResult);
// Act
const result = await requiredRewire.required.getPythonVersion();
// Assert
assert.strictEqual(result, '', 'returned result should be empty');
assert.strictEqual(tryExecuteCommandMock.calledOnce, true, 'tryExecuteCommand should be called once');
});
it('should return version', async () => {
// Arrange
const executionResult: commands.ICommandResult = {
cmdOutput: ' 11.0.0',
cmdOutputIncludingStderr: '',
code: 0,
};
tryExecuteCommandMock.returns(executionResult);
// Act
const result = await requiredRewire.required.getPythonVersion();
// Assert
assert.strictEqual(result, '11.0.0', 'returned result should be defined');
assert.strictEqual(tryExecuteCommandMock.calledOnce, true, 'tryExecuteCommand should be called once');
});
});
describe('getTruffleVersion', () => {
it('should return local version', async () => {
// Arrange
@ -463,16 +410,15 @@ describe('Required helper', () => {
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(gitValidVersion);
tryExecuteCommandMock.onCall(3).returns(pythonValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
// Act
const result = await requiredRewire.required.getAllVersions();
// Assert
assert.strictEqual(result.length, 6, 'returned result should have length 6');
assert.strictEqual(tryExecuteCommandMock.callCount, 6, 'tryExecuteCommand should be called 6 times');
assert.strictEqual(result.length, 5, 'returned result should have length 5');
assert.strictEqual(tryExecuteCommandMock.callCount, 5, 'tryExecuteCommand should be called 5 times');
});
});
@ -482,21 +428,19 @@ describe('Required helper', () => {
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(gitValidVersion);
tryExecuteCommandMock.onCall(3).returns(pythonValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
// Act
const result = await requiredRewire.required.checkAppsSilent(
RequiredApps.node,
RequiredApps.npm,
RequiredApps.git,
RequiredApps.python,
);
// Assert
assert.strictEqual(result, true, 'returned result should be true');
assert.strictEqual(tryExecuteCommandMock.callCount, 4, 'tryExecuteCommand should be called 4 times');
assert.strictEqual(tryExecuteCommandMock.callCount, 3, 'tryExecuteCommand should be called 3 times');
});
it('should return false when there are invalid versions', async () => {
@ -506,30 +450,23 @@ describe('Required helper', () => {
cmdOutputIncludingStderr: '',
code: 0,
};
const executionResultPython: commands.ICommandResult = {
cmdOutput: ' 2.5.0',
cmdOutputIncludingStderr: '',
code: 0,
};
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(executionResultGit);
tryExecuteCommandMock.onCall(3).returns(executionResultPython);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
// Act
const result = await requiredRewire.required.checkAppsSilent(
RequiredApps.node,
RequiredApps.npm,
RequiredApps.git,
RequiredApps.python,
);
// Assert
assert.strictEqual(result, false, 'returned result should be false');
assert.strictEqual(tryExecuteCommandMock.callCount, 4, 'tryExecuteCommand should be called 4 times');
assert.strictEqual(tryExecuteCommandMock.callCount, 3, 'tryExecuteCommand should be called 3 times');
});
});
@ -539,21 +476,19 @@ describe('Required helper', () => {
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(gitValidVersion);
tryExecuteCommandMock.onCall(3).returns(pythonValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
// Act
const result = await requiredRewire.required.checkApps(
RequiredApps.node,
RequiredApps.npm,
RequiredApps.git,
RequiredApps.python,
);
// Assert
assert.strictEqual(result, true, 'returned result should be true');
assert.strictEqual(tryExecuteCommandMock.callCount, 4, 'tryExecuteCommand should be called 4 times');
assert.strictEqual(tryExecuteCommandMock.callCount, 3, 'tryExecuteCommand should be called 3 times');
assert.strictEqual(showErrorMessageMock.called, false, 'showErrorMessage shouldn\'t be called');
assert.strictEqual(executeVSCommandMock.called, false, 'executeVSCommand shouldn\'t be called');
});
@ -565,30 +500,23 @@ describe('Required helper', () => {
cmdOutputIncludingStderr: '',
code: 0,
};
const executionResultPython: commands.ICommandResult = {
cmdOutput: ' 2.5.0',
cmdOutputIncludingStderr: '',
code: 0,
};
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(executionResultGit);
tryExecuteCommandMock.onCall(3).returns(executionResultPython);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
// Act
const result = await requiredRewire.required.checkApps(
RequiredApps.node,
RequiredApps.npm,
RequiredApps.git,
RequiredApps.python,
);
// Assert
assert.strictEqual(result, false, 'returned result should be false');
assert.strictEqual(tryExecuteCommandMock.callCount, 4, 'tryExecuteCommand should be called 4 times');
assert.strictEqual(tryExecuteCommandMock.callCount, 3, 'tryExecuteCommand should be called 3 times');
assert.strictEqual(showErrorMessageMock.called, true, 'showErrorMessage should be called');
assert.strictEqual(executeVSCommandMock.called, true, 'executeVSCommand should be called');
});
@ -600,9 +528,8 @@ describe('Required helper', () => {
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(gitValidVersion);
tryExecuteCommandMock.onCall(3).returns(pythonValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
// Act
const result = await requiredRewire.required.checkRequiredApps();
@ -621,18 +548,12 @@ describe('Required helper', () => {
cmdOutputIncludingStderr: '',
code: 0,
};
const executionResultPython: commands.ICommandResult = {
cmdOutput: ' 2.5.0',
cmdOutputIncludingStderr: '',
code: 0,
};
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(executionResultGit);
tryExecuteCommandMock.onCall(3).returns(executionResultPython);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
// Act
const result = await requiredRewire.required.checkRequiredApps();