This is an automated email from the ASF dual-hosted git repository. marat pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
The following commit(s) were added to refs/heads/main by this push: new 0d93e8a Fix #570 0d93e8a is described below commit 0d93e8ab781c90e7cfb674f6f1d98f220f2a8347 Author: Marat Gubaidullin <marat.gubaidul...@gmail.com> AuthorDate: Mon Dec 19 14:31:15 2022 -0500 Fix #570 --- karavan-vscode/package.json | 14 ++++++++++++++ karavan-vscode/src/extension.ts | 25 +------------------------ karavan-vscode/src/utils.ts | 32 +++++++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/karavan-vscode/package.json b/karavan-vscode/package.json index 97bb49f..fd4f3e2 100644 --- a/karavan-vscode/package.json +++ b/karavan-vscode/package.json @@ -168,6 +168,20 @@ "scope": "machine", "order": 70 }, + "Karavan.applicationGitignore": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "default": [ + ".export", + ".camel-jbang" + ], + "description": "Default .gitignore for application", + "scope": "machine", + "order": 80 + }, "Karavan.quarkusApplicationProperties": { "type": "array", "uniqueItems": true, diff --git a/karavan-vscode/src/extension.ts b/karavan-vscode/src/extension.ts index b009636..60b7ecf 100644 --- a/karavan-vscode/src/extension.ts +++ b/karavan-vscode/src/extension.ts @@ -96,7 +96,7 @@ export function activate(context: ExtensionContext) { if (createApp){ window.showQuickPick(runtimeOptions, { title: "Select Runtime", canPickMany: false }).then((runtime) => { window.showQuickPick(deployOptions, { title: "Select Deploy Target", canPickMany: false }).then((target) => { - if (runtime && target) inputExportGav(runtime.label, target.label) + if (runtime && target) utils.createApplication(runtime.label, target.label) }) }) } @@ -195,29 +195,6 @@ export async function exportAndRunProject(rootPath?: string, run?: boolean) { }) } -/** - * export with gav - */ -export async function inputExportGav(runtime: string, target: string) { - window.showInputBox({ - title: "Export project with " + runtime, - ignoreFocusOut: true, - prompt: "groupId:artifactId:version", - value: utils.defaultGAV(), - validateInput: (text: string): string | undefined => { - if (!text || text.length === 0) { - return 'Name should not be empty. Format groupId:artifactId:version'; - } else { - return undefined; - } - } - }).then(gav => { - if (gav) { - utils.createApplicationproperties(runtime, gav, target) - } - }); -} - export function deactivate() { commands.executeCommand("setContext", KARAVAN_LOADED, false); } diff --git a/karavan-vscode/src/utils.ts b/karavan-vscode/src/utils.ts index 136b6c7..4b8968f 100644 --- a/karavan-vscode/src/utils.ts +++ b/karavan-vscode/src/utils.ts @@ -295,7 +295,28 @@ export function currentFolderName(): string | undefined { } } -export async function createApplicationproperties(runtime: string, gav: string, target: string) { +export async function createApplication(runtime: string, target: string) { + window.showInputBox({ + title: "Export project with " + runtime, + ignoreFocusOut: true, + prompt: "groupId:artifactId:version", + value: defaultGAV(), + validateInput: (text: string): string | undefined => { + if (!text || text.length === 0) { + return 'Name should not be empty. Format groupId:artifactId:version'; + } else { + return undefined; + } + } + }).then(gav => { + if (gav) { + createApplicationProperties(runtime, gav, target); + createApplicationGitignore(); + } + }); +} + +export async function createApplicationProperties(runtime: string, gav: string, target: string) { if (workspace.workspaceFolders) { const uriFolder: Uri = workspace.workspaceFolders[0].uri; const name = currentFolderName() || ""; @@ -318,6 +339,15 @@ export async function createApplicationproperties(runtime: string, gav: string, } } +export async function createApplicationGitignore() { + if (workspace.workspaceFolders) { + const uriFolder: Uri = workspace.workspaceFolders[0].uri; + const gitignore: string[] = workspace.getConfiguration().get("Karavan.applicationGitignore") || []; + const text = gitignore.join('\n'); + write(path.join(uriFolder.path, ".gitignore"), text); + } +} + export function createYaml(filename: string, restYaml: string, camelYaml?: string, crd?: boolean): string { if (camelYaml) { const i = CamelDefinitionYaml.yamlToIntegration(filename, camelYaml);