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. 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 ## 1.5.0
### Enhancements ### Enhancements

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

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

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

@ -1,73 +1,127 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<link rel="stylesheet" href="{{root}}/resources/welcome/main.css"> <link rel="stylesheet" href="{{root}}/resources/welcome/main.css" />
</head> </head>
<body class="vscode-dark"> <body class="vscode-dark">
<div id="content"> <div id="content">
<div id="main-content"> <div id="main-content">
<div class="required-block"> <div class="required-block">
<div> <div>
<h2>Required apps</h2> <h2>Required apps</h2>
<br> <br />
This extension requires your development machine have the following tools already installed. These cannot be installed directly by the extension. This extension requires your development machine have
If you do not have these tools already installed, the links below will take you to the download page the following tools already installed. These cannot be
<ul> installed directly by the extension. If you do not have
<li>Node JS</li> these tools already installed, the links below will take
<li>Git</li> you to the download page
<li>Python</li> <ul>
</ul> <li>Node JS</li>
<p> <li>Git</li>
<a href="https://aka.ms/vscodebcextensionwiki">Click here</a> to learn more about this extension, and view the users guide <li>Python</li>
</p> </ul>
<div class="required"> <p>
<div id="node" class="required-app disabled"> <a href="https://aka.ms/vscodebcextensionwiki"
<img src="{{root}}/images/NodeLogo.png"> >Click here</a
<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> to learn more about this extension, and view the
</div> users guide
<div id="git" class="required-app disabled"> </p>
<img src="{{root}}/images/GitLogo.png"> <div class="required">
<div class="description">Required version: <span class="version">2.10.0</span></div> <div id="node" class="required-app disabled">
<a class="spinner" href="https://git-scm.com/downloads"><span>Install Git</span></a> <img src="{{root}}/images/NodeLogo.png" />
</div> <div class="description">
<div id="python" class="required-app disabled"> Required version:
<img src="{{root}}/images/PythonLogo.png"> <span class="version">10.15.0</span>
<div class="description">Required version: <span class="version">2.7.15</span></div> </div>
<a class="spinner" href="https://www.python.org/downloads/release/python-2715/"><span>Install Python</span></a> <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>
</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. <p class="showOnStartup">
Click the links below to install the Truffle tools directly from this extension <input
type="checkbox"
id="showOnStartup"
class="checkbox"
checked="checked"
/>
<label class="caption" for="showOnStartup"
>Show this page on startup</label
>
</p> </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>
</div> </div>
<script
<p class="showOnStartup"> type="text/javascript"
<input type="checkbox" id="showOnStartup" class="checkbox" checked="checked"> src="{{root}}/resources/welcome/jquery-3.3.1.min.js"
<label class="caption" for="showOnStartup">Show this page on startup</label> ></script>
</p> <script
</div> type="text/javascript"
</div> src="{{root}}/resources/welcome/main.js"
<script type="text/javascript" src="{{root}}/resources/welcome/jquery-3.3.1.min.js"></script> ></script>
<script type="text/javascript" src="{{root}}/resources/welcome/main.js"></script> </body>
</body>
</html> </html>

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

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

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

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

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

@ -26,11 +26,6 @@ const gitValidVersion: commands.ICommandResult = {
cmdOutputIncludingStderr: '', cmdOutputIncludingStderr: '',
code: 0, code: 0,
}; };
const pythonValidVersion: commands.ICommandResult = {
cmdOutput: ' 2.9.0',
cmdOutputIncludingStderr: '',
code: 0,
};
const truffleValidVersion: commands.ICommandResult = { const truffleValidVersion: commands.ICommandResult = {
cmdOutput: 'truffle@5.5.0', cmdOutput: 'truffle@5.5.0',
cmdOutputIncludingStderr: '', 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', () => { describe('getTruffleVersion', () => {
it('should return local version', async () => { it('should return local version', async () => {
// Arrange // Arrange
@ -463,16 +410,15 @@ describe('Required helper', () => {
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion); tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion); tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(gitValidVersion); tryExecuteCommandMock.onCall(2).returns(gitValidVersion);
tryExecuteCommandMock.onCall(3).returns(pythonValidVersion); tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion); tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
// Act // Act
const result = await requiredRewire.required.getAllVersions(); const result = await requiredRewire.required.getAllVersions();
// Assert // Assert
assert.strictEqual(result.length, 6, 'returned result should have length 6'); assert.strictEqual(result.length, 5, 'returned result should have length 5');
assert.strictEqual(tryExecuteCommandMock.callCount, 6, 'tryExecuteCommand should be called 6 times'); 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(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion); tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(gitValidVersion); tryExecuteCommandMock.onCall(2).returns(gitValidVersion);
tryExecuteCommandMock.onCall(3).returns(pythonValidVersion); tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion); tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
// Act // Act
const result = await requiredRewire.required.checkAppsSilent( const result = await requiredRewire.required.checkAppsSilent(
RequiredApps.node, RequiredApps.node,
RequiredApps.npm, RequiredApps.npm,
RequiredApps.git, RequiredApps.git,
RequiredApps.python,
); );
// Assert // Assert
assert.strictEqual(result, true, 'returned result should be true'); 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 () => { it('should return false when there are invalid versions', async () => {
@ -506,30 +450,23 @@ describe('Required helper', () => {
cmdOutputIncludingStderr: '', cmdOutputIncludingStderr: '',
code: 0, code: 0,
}; };
const executionResultPython: commands.ICommandResult = {
cmdOutput: ' 2.5.0',
cmdOutputIncludingStderr: '',
code: 0,
};
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion); tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion); tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(executionResultGit); tryExecuteCommandMock.onCall(2).returns(executionResultGit);
tryExecuteCommandMock.onCall(3).returns(executionResultPython); tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion); tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
// Act // Act
const result = await requiredRewire.required.checkAppsSilent( const result = await requiredRewire.required.checkAppsSilent(
RequiredApps.node, RequiredApps.node,
RequiredApps.npm, RequiredApps.npm,
RequiredApps.git, RequiredApps.git,
RequiredApps.python,
); );
// Assert // Assert
assert.strictEqual(result, false, 'returned result should be false'); 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(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion); tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(gitValidVersion); tryExecuteCommandMock.onCall(2).returns(gitValidVersion);
tryExecuteCommandMock.onCall(3).returns(pythonValidVersion); tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion); tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
// Act // Act
const result = await requiredRewire.required.checkApps( const result = await requiredRewire.required.checkApps(
RequiredApps.node, RequiredApps.node,
RequiredApps.npm, RequiredApps.npm,
RequiredApps.git, RequiredApps.git,
RequiredApps.python,
); );
// Assert // Assert
assert.strictEqual(result, true, 'returned result should be true'); 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(showErrorMessageMock.called, false, 'showErrorMessage shouldn\'t be called');
assert.strictEqual(executeVSCommandMock.called, false, 'executeVSCommand shouldn\'t be called'); assert.strictEqual(executeVSCommandMock.called, false, 'executeVSCommand shouldn\'t be called');
}); });
@ -565,30 +500,23 @@ describe('Required helper', () => {
cmdOutputIncludingStderr: '', cmdOutputIncludingStderr: '',
code: 0, code: 0,
}; };
const executionResultPython: commands.ICommandResult = {
cmdOutput: ' 2.5.0',
cmdOutputIncludingStderr: '',
code: 0,
};
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion); tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion); tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(executionResultGit); tryExecuteCommandMock.onCall(2).returns(executionResultGit);
tryExecuteCommandMock.onCall(3).returns(executionResultPython); tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion); tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
// Act // Act
const result = await requiredRewire.required.checkApps( const result = await requiredRewire.required.checkApps(
RequiredApps.node, RequiredApps.node,
RequiredApps.npm, RequiredApps.npm,
RequiredApps.git, RequiredApps.git,
RequiredApps.python,
); );
// Assert // Assert
assert.strictEqual(result, false, 'returned result should be false'); 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(showErrorMessageMock.called, true, 'showErrorMessage should be called');
assert.strictEqual(executeVSCommandMock.called, true, 'executeVSCommand 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(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion); tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(gitValidVersion); tryExecuteCommandMock.onCall(2).returns(gitValidVersion);
tryExecuteCommandMock.onCall(3).returns(pythonValidVersion); tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion); tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
// Act // Act
const result = await requiredRewire.required.checkRequiredApps(); const result = await requiredRewire.required.checkRequiredApps();
@ -621,18 +548,12 @@ describe('Required helper', () => {
cmdOutputIncludingStderr: '', cmdOutputIncludingStderr: '',
code: 0, code: 0,
}; };
const executionResultPython: commands.ICommandResult = {
cmdOutput: ' 2.5.0',
cmdOutputIncludingStderr: '',
code: 0,
};
tryExecuteCommandMock.onCall(0).returns(nodeValidVersion); tryExecuteCommandMock.onCall(0).returns(nodeValidVersion);
tryExecuteCommandMock.onCall(1).returns(npmValidVersion); tryExecuteCommandMock.onCall(1).returns(npmValidVersion);
tryExecuteCommandMock.onCall(2).returns(executionResultGit); tryExecuteCommandMock.onCall(2).returns(executionResultGit);
tryExecuteCommandMock.onCall(3).returns(executionResultPython); tryExecuteCommandMock.onCall(3).returns(truffleValidVersion);
tryExecuteCommandMock.onCall(4).returns(truffleValidVersion); tryExecuteCommandMock.onCall(4).returns(ganacheValidVersion);
tryExecuteCommandMock.onCall(5).returns(ganacheValidVersion);
// Act // Act
const result = await requiredRewire.required.checkRequiredApps(); const result = await requiredRewire.required.checkRequiredApps();