-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace odo analyze command #4330
Changes from 3 commits
3f34d5c
23e0616
1b01f49
6338174
8a9264e
f8dcc69
71031a3
265507d
e42fd0c
3be7b53
c614dd5
6a3ca0b
e105c2d
ddbb56b
f57469b
c82fa22
7b2a13b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import { ToolsConfig } from '../tools'; | |
import { ChildProcessUtil, CliExitData } from '../util/childProcessUtil'; | ||
import { VsCommandError } from '../vscommand'; | ||
import { Command } from './command'; | ||
import { AnalyzeResponse, ComponentTypeAdapter, ComponentTypeDescription, DevfileComponentType, Registry } from './componentType'; | ||
import { AlizerAnalyzeResponse, ComponentTypeAdapter, ComponentTypeDescription, DevfileComponentType, Registry } from './componentType'; | ||
import { ComponentDescription, StarterProject } from './componentTypeDescription'; | ||
import { BindableService } from './odoTypes'; | ||
|
||
|
@@ -194,13 +194,12 @@ export class Odo { | |
); | ||
} | ||
|
||
public async analyze(currentFolderPath: string): Promise<AnalyzeResponse[]> { | ||
public async alizerAnalyze(currentFolderPath: Uri): Promise<AlizerAnalyzeResponse[]> { | ||
const cliData: CliExitData = await this.execute( | ||
new CommandText('odo', 'analyze -o json'), | ||
currentFolderPath, | ||
new CommandText('alizer', `devfile ${currentFolderPath.fsPath}`) | ||
); | ||
const parse = JSON.parse(cliData.stdout) as AnalyzeResponse[]; | ||
return parse; | ||
const parse = JSON.parse(cliData.stdout) as AlizerAnalyzeResponse[]; | ||
return [[...parse].shift()]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shift returns the first element. Why not just return the first element (or undefined if there is no element) and change the return type to |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,12 +100,12 @@ suite('./odo/odoWrapper.ts', function () { | |
}); | ||
|
||
test('analyze()', async function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @msivasubramaniaan The |
||
const analysis1 = await Odo.Instance.analyze(tmpFolder1.fsPath); | ||
const analysis1 = await Odo.Instance.alizerAnalyze(tmpFolder1); | ||
expect(analysis1).to.exist; | ||
expect(analysis1[0].devfile).to.equal('nodejs'); | ||
const analysis2 = await Odo.Instance.analyze(tmpFolder2.fsPath); | ||
expect(analysis1[0].Name).to.equal('nodejs'); | ||
const analysis2 = await Odo.Instance.alizerAnalyze(tmpFolder2); | ||
expect(analysis2).to.exist; | ||
expect(analysis2[0].devfile).to.equal('go'); | ||
expect(analysis2[0].Name).to.equal('go'); | ||
}); | ||
}); | ||
|
||
|
@@ -208,9 +208,8 @@ suite('./odo/odoWrapper.ts', function () { | |
}); | ||
|
||
test('analyze()', async function() { | ||
const [analysis] = await Odo.Instance.analyze(tmpFolder); | ||
expect(analysis.name).to.equal(path.basename(tmpFolder).toLocaleLowerCase()); | ||
expect(analysis.devfile).to.equal(COMPONENT_TYPE); | ||
const [analysis] = await Odo.Instance.alizerAnalyze(Uri.file(tmpFolder)); | ||
expect(analysis.Name).to.equal(COMPONENT_TYPE); | ||
}); | ||
|
||
test('deleteComponentConfiguration()', async function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a good idea to move this function to it's own file, since it no longer uses odo, and this file contains wrappers around odo commands