diff --git a/README.md b/README.md index c944778e..2364a7db 100644 --- a/README.md +++ b/README.md @@ -41,11 +41,11 @@ Snippets are provided for the following Chocolatey Helper Functions: To use them, simply open your powershell file, and then type `choco` followed by `ctrl-space`. This will then show the available snippets... -![Available Chocolatey Snippets](https://raw.githubusercontent.com/gep13/chocolatey-vscode/master/images/Choco-Snippets.png) +![Available Chocolatey Snippets](https://raw.githubusercontent.com/chocolatey-community/chocolatey-vscode/master/images/Choco-Snippets.png) and then simply arrow up/down to the one you want and press enter, or left mouse click. From there the PowerShell code for the helper function will be generated, and the cursor will be placed ready for you to start filling in the content of function... -![Expanded Chocolatey Snippet](https://raw.githubusercontent.com/gep13/chocolatey-vscode/master/images/Expanded-Choco-Snippet.png) +![Expanded Chocolatey Snippet](https://raw.githubusercontent.com/chocolatey-community/chocolatey-vscode/master/images/Expanded-Choco-Snippet.png) ## Dependencies @@ -69,7 +69,7 @@ choco install chocolatey-vscode ## Documentation -You can find the documentation that is available for this project [here](https://gep13.github.io/chocolatey-vscode/). +You can find the documentation that is available for this project [here](https://chocolatey-community.github.io/chocolatey-vscode/). ## Thanks @@ -77,10 +77,10 @@ The execution of the Chocolatey commands in this extension would not have been p ## Contributing -If you would like to see any other snippet or features added for this VS Code Extension, feel free to raise an [issue](https://github.com/gep13/chocolatey-vscode/issues), and if possible, a follow up pull request. +If you would like to see any other snippet or features added for this VS Code Extension, feel free to raise an [issue](https://github.com/chocolatey-community/chocolatey-vscode/issues), and if possible, a follow up pull request. You can also join in the Gitter Chat [![Join the chat at https://gitter.im/gep13-oss/community](https://badges.gitter.im/gep13-oss/community.svg)](https://gitter.im/gep13-oss/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) ## Releases -To find out what was released in each version of this extension, check out the [releases](https://github.com/gep13/chocolatey-vscode/releases) page. +To find out what was released in each version of this extension, check out the [releases](https://github.com/chocolatey-community/chocolatey-vscode/releases) page. diff --git a/build.cake b/build.cake index 051a9a5c..b4369e56 100644 --- a/build.cake +++ b/build.cake @@ -119,7 +119,7 @@ Task("Install-Vsce") Task("Create-Release-Notes") .Does(() => { - GitReleaseManagerCreate(parameters.GitHub.UserName, parameters.GitHub.Password, "gep13", "chocolatey-vscode", new GitReleaseManagerCreateSettings { + GitReleaseManagerCreate(parameters.GitHub.UserName, parameters.GitHub.Password, "chocolatey-community", "chocolatey-vscode", new GitReleaseManagerCreateSettings { Milestone = parameters.Version.Milestone, Name = parameters.Version.Milestone, Prerelease = true, @@ -205,10 +205,10 @@ Task("Publish-GitHub-Release") foreach (var package in packageFiles.Select(f => MakeAbsolute(f))) { - GitReleaseManagerAddAssets(parameters.GitHub.UserName, parameters.GitHub.Password, "gep13", "chocolatey-vscode", parameters.Version.Milestone, package.ToString()); + GitReleaseManagerAddAssets(parameters.GitHub.UserName, parameters.GitHub.Password, "chocolatey-community", "chocolatey-vscode", parameters.Version.Milestone, package.ToString()); } - GitReleaseManagerClose(parameters.GitHub.UserName, parameters.GitHub.Password, "gep13", "chocolatey-vscode", parameters.Version.Milestone); + GitReleaseManagerClose(parameters.GitHub.UserName, parameters.GitHub.Password, "chocolatey-community", "chocolatey-vscode", parameters.Version.Milestone); }) .OnError(exception => { @@ -232,7 +232,7 @@ Task("Publish-Chocolatey-Package") .OnError(exception => { Information("Publish-Chocolatey-Package Task failed, but continuing with next Task..."); - + // TODO: Don't fail build if failure to push package to Chocolatey, as this is known to cause // some errors at the minute. An error can be returned, but the package is pushed correctly // publishingError = true; diff --git a/build/parameters.cake b/build/parameters.cake index c3bce679..bfad5c15 100644 --- a/build/parameters.cake +++ b/build/parameters.cake @@ -146,7 +146,7 @@ public class BuildParameters IsRunningOnWindows = context.IsRunningOnWindows(), IsRunningOnAppVeyor = buildSystem.AppVeyor.IsRunningOnAppVeyor, IsPullRequest = buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest, - IsMasterRepo = StringComparer.OrdinalIgnoreCase.Equals("gep13/chocolatey-vscode", buildSystem.AppVeyor.Environment.Repository.Name), + IsMasterRepo = StringComparer.OrdinalIgnoreCase.Equals("chocolatey-community/chocolatey-vscode", buildSystem.AppVeyor.Environment.Repository.Name), IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals("master", buildSystem.AppVeyor.Environment.Repository.Branch), IsDevelopBranch = StringComparer.OrdinalIgnoreCase.Equals("develop", buildSystem.AppVeyor.Environment.Repository.Branch), IsReleaseBranch = buildSystem.AppVeyor.Environment.Repository.Branch.StartsWith("release", StringComparison.OrdinalIgnoreCase), @@ -198,9 +198,9 @@ public class BuildParameters WyamConfigurationFile = context.MakeAbsolute((FilePath)"config.wyam"), WyamRecipe = "Docs", WyamTheme = "Samson", - WebHost = "gep13.github.io", + WebHost = "chocolatey-community.github.io", WebLinkRoot = "chocolatey-vscode", - WebBaseEditUrl = "https://github.com/gep13/chocolatey-vscode/tree/master/input/" + WebBaseEditUrl = "https://github.com/chocolatey-community/chocolatey-vscode/tree/master/input/" }; } } diff --git a/chocolatey/chocolatey-vscode.nuspec b/chocolatey/chocolatey-vscode.nuspec index 959cb0f5..022a72e7 100644 --- a/chocolatey/chocolatey-vscode.nuspec +++ b/chocolatey/chocolatey-vscode.nuspec @@ -8,14 +8,14 @@ Chocolatey VSCode extension Gary Ewan Park - https://github.com/gep13/chocolatey-vscode - https://cdn.jsdelivr.net/gh/gep13/chocolatey-vscode@19e4cf675a962d39e0840907e041c21879f48d3b/images/chocolatey.png + https://github.com/chocolatey-community/chocolatey-vscode + https://cdn.jsdelivr.net/gh/chocolatey-community/chocolatey-vscode@19e4cf675a962d39e0840907e041c21879f48d3b/images/chocolatey.png Copyright (c) 2016 Gary Ewan Park - https://github.com/gep13/chocolatey-vscode/blob/develop/LICENSE + https://github.com/chocolatey-community/chocolatey-vscode/blob/develop/LICENSE true - https://github.com/gep13/chocolatey-vscode + https://github.com/chocolatey-community/chocolatey-vscode - https://github.com/gep13/chocolatey-vscode/issues + https://github.com/chocolatey-community/chocolatey-vscode/issues chocolatey-vscode vscode extension Chocolatey Extension for Visual Studio Code @@ -35,12 +35,12 @@ Snippets are provided for the following Chocolatey Helper Functions: - Install-ChocolateyPackage - Uninstall-ChocolateyPackage To use them, simply open your powershell file, and then type choco followed by ctrl-space. This will then show the available snippets... -![Available Chocolatey Snippets](https://cdn.jsdelivr.net/gh/gep13/chocolatey-vscode@19e4cf675a962d39e0840907e041c21879f48d3b/images/Choco-Snippets.png) +![Available Chocolatey Snippets](https://cdn.jsdelivr.net/gh/chocolatey-community/chocolatey-vscode@19e4cf675a962d39e0840907e041c21879f48d3b/images/Choco-Snippets.png) and then simply arrow up/down to the one you want and press enter, or left mouse click. From there the PowerShell for the helper function will be generated, and the cursor will be placed ready for you to start filling in the content of function... -Full release notes found on [GitHub Release Page](https://github.com/gep13/chocolatey-vscode/releases) +Full release notes found on [GitHub Release Page](https://github.com/chocolatey-community/chocolatey-vscode/releases) diff --git a/chocolatey/tools/VERIFICATION.txt b/chocolatey/tools/VERIFICATION.txt index f8264d16..b3e73230 100644 --- a/chocolatey/tools/VERIFICATION.txt +++ b/chocolatey/tools/VERIFICATION.txt @@ -5,9 +5,9 @@ in verifying that this package's contents are trustworthy. This package is being officially supplied by the software author of these scripts (Gary Ewan Park, thanks to contributions from Kim J. Nordmo) The included binary file can be downloaded from our releases page located at - + and should match the checksum of the included vsix file. The file 'LICENSE.md' is also available in the repository at - \ No newline at end of file + \ No newline at end of file diff --git a/docs/input/_Bottom.cshtml b/docs/input/_Bottom.cshtml index f2f4952d..60cae31a 100644 --- a/docs/input/_Bottom.cshtml +++ b/docs/input/_Bottom.cshtml @@ -1,9 +1,9 @@ diff --git a/package.json b/package.json index 27774f03..2260df8b 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,12 @@ "name": "gep13" }, "bugs": { - "url": "https://github.com/gep13/chocolatey-vscode/issues" + "url": "https://github.com/chocolatey-community/chocolatey-vscode/issues" }, - "homepage": "https://github.com/gep13/chocolatey-vscode", + "homepage": "https://github.com/chocolatey-community/chocolatey-vscode", "repository": { "type": "git", - "url": "https://github.com/gep13/chocolatey-vscode" + "url": "https://github.com/chocolatey-community/chocolatey-vscode" }, "main": "./out/extension", "galleryBanner": { diff --git a/src/ChocolateyCliManager.ts b/src/ChocolateyCliManager.ts index c6566569..d9fdda42 100644 --- a/src/ChocolateyCliManager.ts +++ b/src/ChocolateyCliManager.ts @@ -236,7 +236,7 @@ export class ChocolateyCliManager { } public installTemplates(): void { - const config = workspace.getConfiguration("chocolatey").templatePackages; + const config: any = workspace.getConfiguration("chocolatey").templatePackages; let chocoArguments: Array = ["install"]; @@ -251,7 +251,7 @@ export class ChocolateyCliManager { } private _findPackageTemplates(): string[] { - let templateDir = getPathToChocolateyTemplates(); + let templateDir: string = getPathToChocolateyTemplates(); if (!templateDir || !fs.existsSync(templateDir) || !this._isDirectory(templateDir)) { return []; @@ -260,7 +260,7 @@ export class ChocolateyCliManager { return fs.readdirSync(templateDir).map(name => path.join(templateDir, name)).filter(this._isDirectory); } - private _isDirectory(path: string) { + private _isDirectory(path: string):boolean { return fs.lstatSync(path).isDirectory(); } } diff --git a/src/extension.ts b/src/extension.ts index a7b033e7..641446dc 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -1,111 +1,112 @@ -import {window, commands, workspace, QuickPickItem} from "vscode"; -import * as chocolateyCli from "./ChocolateyCliManager"; -import * as chocolateyOps from "./ChocolateyOperation"; -import * as path from "path"; -import * as fs from "fs"; - -var chocolateyManager : chocolateyCli.ChocolateyCliManager; -var installed : boolean = false; - -export function activate(): void { - // register Commands - commands.registerCommand("chocolatey.new", () => execute("new")); - commands.registerCommand("chocolatey.pack", () => execute("pack")); - commands.registerCommand("chocolatey.delete", () => deleteNupkgs()); - commands.registerCommand("chocolatey.push", () => execute("push")); - commands.registerCommand("chocolatey.installTemplates", () => execute("installTemplates")); -} - -function deleteNupkgs():void { - // Check if there is an open folder in workspace - if (workspace.rootPath === undefined) { - window.showErrorMessage("You have not yet opened a folder."); - } - - workspace.findFiles("**/*.nupkg").then((nupkgFiles) => { - if(nupkgFiles.length ===0) { - window.showErrorMessage("There are no nupkg files in the current workspace."); - return; - } - - let quickPickItems: Array = nupkgFiles.map((filePath) => { - return { - label: path.basename(filePath.fsPath), - description: filePath.fsPath - }; - }); - - if(quickPickItems.length > 1) { - quickPickItems.unshift({label: "All nupkg files"}); - } - - window.showQuickPick(quickPickItems, { - placeHolder: "Available nupkg files..." - }).then((nupkgSelection) => { - if(!nupkgSelection) { - return; - } - - if(nupkgSelection.label === "All nupkg files") { - quickPickItems.forEach((quickPickItem) => { - if(quickPickItem.label === "All nupkg files") { - return; - } - - if(quickPickItem.description && fs.existsSync(quickPickItem.description)) { - fs.unlinkSync(quickPickItem.description); - console.log("Deleted file: " + quickPickItem.description); - } - }); - } else { - if(nupkgSelection.description && fs.existsSync(nupkgSelection.description)) { - fs.unlinkSync(nupkgSelection.description); - console.log("Deleted file: " + nupkgSelection.description); - } - } - }); - }); -} - -function execute(cmd?: string | undefined, arg?: any[] | undefined): Thenable | undefined { - // Check if there is an open folder in workspace - if (workspace.rootPath === undefined) { - window.showErrorMessage("You have not yet opened a folder."); - } - - if (!chocolateyManager) { - chocolateyManager = new chocolateyCli.ChocolateyCliManager(); - } - - if (!installed) { - installed = chocolateyOps.isChocolateyCliInstalled(); - } - - if (!cmd) { - return; - } - - // ensure Chocolatey is installed - if (!installed) { - return window.showErrorMessage("Chocolatey is not installed"); - } - - // check if there is an open folder in workspace - if (workspace.rootPath === undefined) { - return window.showErrorMessage("You have not yet opened a folder."); - } - - let ecmd: any = chocolateyManager[cmd]; - if (typeof ecmd === "function") { - try { - ecmd.apply(chocolateyManager, arg); - return; - } catch (e) { - // well, clearly we didn't call a function - console.log(e); - return; - } - } - - return; -} +import {window, commands, workspace, QuickPickItem} from "vscode"; +import * as chocolateyCli from "./ChocolateyCliManager"; +import * as chocolateyOps from "./ChocolateyOperation"; +import * as path from "path"; +import * as fs from "fs"; + +var chocolateyManager : chocolateyCli.ChocolateyCliManager; +var installed : boolean = false; + +export function activate(): void { + // register Commands + commands.registerCommand("chocolatey.new", () => execute("new")); + commands.registerCommand("chocolatey.pack", () => execute("pack")); + commands.registerCommand("chocolatey.delete", () => deleteNupkgs()); + commands.registerCommand("chocolatey.push", () => execute("push")); + commands.registerCommand("chocolatey.installTemplates", () => execute("installTemplates")); +} + +function deleteNupkgs():void { + // check if there is an open folder in workspace + if (workspace.rootPath === undefined) { + window.showErrorMessage("You have not yet opened a folder."); + return; + } + + workspace.findFiles("**/*.nupkg").then((nupkgFiles) => { + if(nupkgFiles.length ===0) { + window.showErrorMessage("There are no nupkg files in the current workspace."); + return; + } + + let quickPickItems: Array = nupkgFiles.map((filePath) => { + return { + label: path.basename(filePath.fsPath), + description: filePath.fsPath + }; + }); + + if(quickPickItems.length > 1) { + quickPickItems.unshift({label: "All nupkg files"}); + } + + window.showQuickPick(quickPickItems, { + placeHolder: "Available nupkg files..." + }).then((nupkgSelection) => { + if(!nupkgSelection) { + return; + } + + if(nupkgSelection.label === "All nupkg files") { + quickPickItems.forEach((quickPickItem) => { + if(quickPickItem.label === "All nupkg files") { + return; + } + + if(quickPickItem.description && fs.existsSync(quickPickItem.description)) { + fs.unlinkSync(quickPickItem.description); + console.log("Deleted file: " + quickPickItem.description); + } + }); + } else { + if(nupkgSelection.description && fs.existsSync(nupkgSelection.description)) { + fs.unlinkSync(nupkgSelection.description); + console.log("Deleted file: " + nupkgSelection.description); + } + } + }); + }); +} + +function execute(cmd?: string | undefined, arg?: any[] | undefined): Thenable | undefined { + // check if there is an open folder in workspace + if (workspace.rootPath === undefined) { + return window.showErrorMessage("You have not yet opened a folder."); + } + + if (!chocolateyManager) { + chocolateyManager = new chocolateyCli.ChocolateyCliManager(); + } + + if (!installed) { + installed = chocolateyOps.isChocolateyCliInstalled(); + } + + if (!cmd) { + return; + } + + // ensure Chocolatey is installed + if (!installed) { + return window.showErrorMessage("Chocolatey is not installed"); + } + + // check if there is an open folder in workspace + if (workspace.rootPath === undefined) { + return window.showErrorMessage("You have not yet opened a folder."); + } + + let ecmd: any = chocolateyManager[cmd]; + if (typeof ecmd === "function") { + try { + ecmd.apply(chocolateyManager, arg); + return; + } catch (e) { + // well, clearly we didn't call a function + console.log(e); + return; + } + } + + return; +}