From 6fc385422891e154cf1406c41cb34882d630b3d8 Mon Sep 17 00:00:00 2001
From: Michael Jolley
Date: Mon, 5 Feb 2024 15:41:46 -0600
Subject: [PATCH] Many updates
---
.all-contributorsrc | 89 -------------------
.../CODE_OF_CONDUCT.md | 0
CONTRIBUTING.md => .github/CONTRIBUTING.md | 10 +--
.github/FUNDING.yml | 2 +-
.github/workflows/CI.yml | 31 +++++++
.github/workflows/stale.yml | 21 -----
CHANGELOG.md | 16 +++-
README.md | 43 +++------
azure-pipelines.yml | 31 -------
.../GitHub/Invoke-GitHubRepository.Tests.ps1 | 12 +--
src/Export/GitHub/Invoke-GitHubRepository.ps1 | 2 +-
.../Helpers/Invoke-ReloadEnvironment.ps1 | 25 ------
.../Helpers/Test-PSHostHasAdministrator.ps1 | 16 ----
src/devtoolbox.psd1 | 16 ++--
14 files changed, 77 insertions(+), 237 deletions(-)
delete mode 100644 .all-contributorsrc
rename CODE_OF_CONDUCT.md => .github/CODE_OF_CONDUCT.md (100%)
rename CONTRIBUTING.md => .github/CONTRIBUTING.md (86%)
create mode 100644 .github/workflows/CI.yml
delete mode 100644 .github/workflows/stale.yml
delete mode 100644 azure-pipelines.yml
delete mode 100644 src/Export/Helpers/Invoke-ReloadEnvironment.ps1
delete mode 100644 src/Export/Helpers/Test-PSHostHasAdministrator.ps1
diff --git a/.all-contributorsrc b/.all-contributorsrc
deleted file mode 100644
index 16eb443..0000000
--- a/.all-contributorsrc
+++ /dev/null
@@ -1,89 +0,0 @@
-{
- "files": [
- "README.md"
- ],
- "imageSize": 100,
- "commit": false,
- "contributors": [
- {
- "login": "MichaelJolley",
- "name": "Michael Jolley",
- "avatar_url": "https://avatars2.githubusercontent.com/u/1228996?v=4",
- "profile": "https://michaeljolley.com/",
- "contributions": [
- "code",
- "ideas",
- "doc"
- ]
- },
- {
- "login": "RyannosaurusRex",
- "name": "Ryan Hayes",
- "avatar_url": "https://avatars3.githubusercontent.com/u/438357?v=4",
- "profile": "http://ryanhayes.net",
- "contributions": [
- "code",
- "ideas",
- "doc"
- ]
- },
- {
- "login": "parithon",
- "name": "Anthony Conrad",
- "avatar_url": "https://avatars3.githubusercontent.com/u/8602418?v=4",
- "profile": "https://github.com/parithon",
- "contributions": [
- "code",
- "ideas",
- "doc",
- "test"
- ]
- },
- {
- "login": "brettmillerb",
- "name": "Brett Miller",
- "avatar_url": "https://avatars0.githubusercontent.com/u/24279339?v=4",
- "profile": "https://millerb.co.uk",
- "contributions": [
- "code",
- "ideas",
- "doc"
- ]
- },
- {
- "login": "corbob",
- "name": "corbob",
- "avatar_url": "https://avatars2.githubusercontent.com/u/30301021?v=4",
- "profile": "https://github.com/corbob",
- "contributions": [
- "ideas",
- "code"
- ]
- },
- {
- "login": "cmjchrisjones",
- "name": "Chris Jones",
- "avatar_url": "https://avatars0.githubusercontent.com/u/3969086?v=4",
- "profile": "https://c-j.tech",
- "contributions": [
- "doc"
- ]
- },
- {
- "login": "RamblingGeekUK",
- "name": "Wayne Taylor",
- "avatar_url": "https://avatars3.githubusercontent.com/u/7108949?v=4",
- "profile": "https://www.ramblinggeek.co.uk",
- "contributions": [
- "code",
- "doc"
- ]
- }
- ],
- "contributorsPerLine": 7,
- "projectName": "devtoolbox",
- "projectOwner": "MichaelJolley",
- "repoType": "github",
- "repoHost": "https://github.com",
- "skipCi": true
-}
diff --git a/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
similarity index 100%
rename from CODE_OF_CONDUCT.md
rename to .github/CODE_OF_CONDUCT.md
diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
similarity index 86%
rename from CONTRIBUTING.md
rename to .github/CONTRIBUTING.md
index 08efbec..9a651c8 100644
--- a/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -25,23 +25,21 @@ Fork, then clone the repo:
git clone git@github.com:your-username/ps-alias.git
-**All changes should be based from the `vNext` branch.**
-
- All functions placed in the `src/devtoolbox/Export` folder will be available to the end-user.
- All functions placed in the `src/devtoolbox/Private` folder will only be available to the module's scripts *not* the end-user.
Please follow these steps to include a new function to the module:
-1. Create a new function in the `src/devltoolbox/Export` folder.
+1. Create a new function in the `src/devltoolbox/export` folder.
1. Run the `/UpdateManifest.ps1` to update the manifest.
1. If you have previously installed the module, run `/UninstallModule.ps1`.
1. Run `/InstallModule.ps1` to install the module to your local module folder and test your new function.
-Push to your fork and [submit a pull request](https://github.com/builders-club/devtoolbox/compare/) against the `vNext` branch.
+Push to your fork and [submit a pull request](https://github.com/michaeljolley/devtoolbox/compare/).
At this point you're waiting on us. We like to at least comment on pull requests
-within three days (and, typically, one day). We may suggest
-some changes or improvements or alternatives.
+within three days (and, typically, one day). We may suggest some changes or
+improvements or alternatives.
Normally reviews & merging occur live on stream at [https://twitch.tv/baldbeardedbuilder](https://twitch.tv/baldbeardedbuilder).
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 76605a5..a4f21c3 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,6 +1,6 @@
# These are supported funding model platforms
-github: [builders-club]
+github: [michaeljolley]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
new file mode 100644
index 0000000..49ddac2
--- /dev/null
+++ b/.github/workflows/CI.yml
@@ -0,0 +1,31 @@
+name: CI/CD
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Build module
+ shell: pwsh
+ run: |
+ . "$(Build.Repository.LocalPath)/_build/build.ps1"
+
+ deploy:
+ needs: build
+ runs-on: ubuntu-latest
+ steps:
+ - name: Deploy to PowerShell Gallery
+ env:
+ PS_GALLERY_API_KEY: ${{ secrets.PS_GALLERY_API_KEY }}
+ shell: pwsh
+ run: |
+ Publish-Module -Path "$(Build.Repository.LocalPath)/dist" -NuGetApiKey $(PS_GALLERY_API_KEY)
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
deleted file mode 100644
index 86b1d89..0000000
--- a/.github/workflows/stale.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: Mark stale issues and pull requests
-
-on:
- schedule:
- - cron: "0 0 * * *"
-
-jobs:
- stale:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/stale@v1
- with:
- repo-token: ${{ secrets.GITHUB_TOKEN }}
- stale-issue-message: 'Issue has not had any activity for 30 days'
- stale-pr-message: 'Pull Request has not had any activity for 30 days'
- stale-issue-label: 'stale'
- stale-pr-label: 'stale'
- days-before-stale: 30
- days-before-close: 60
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a1d0580..4ce7dce 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
---
+## [1.0.0]
+
+### Updated
+
+- Changed the `gh` command to `github` in order to avoid conflicts with the GitHub CLI
+- Moved CI/CD process to GitHub Actions
+- Cleaned up repo to reflect updates in Code of Conduct, Contributing, etc.
+
+### Deleted
+
+- Removed the reload environment `reload` command
+- Removed the `IsAdmin` command
+
## [0.6.2]
### Added
@@ -43,7 +56,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- New `gh` command that launches browser to GitHub repo if the directory is a GitHub repo
- Tons :)
-[Unreleased]: https://github.com/builders-club/devtools/compare/[0.6.2]...HEAD
+[Unreleased]: https://github.com/builders-club/devtools/compare/[1.0.0]...HEAD
+[0.6.2]: https://github.com/builders-club/devtools/compare/[0.6.2]...[1.0.0]
[0.6.2]: https://github.com/builders-club/devtools/compare/[0.6.0]...[0.6.2]
[0.6.0]: https://github.com/builders-club/devtools/compare/[0.5.0]...[0.6.0]
[0.5.0]: https://github.com/builders-club/devtools/compare/[0.0.4]...[0.5.0]
diff --git a/README.md b/README.md
index af4181e..f2983ac 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,7 @@
-| Release | Contributors | Downloads |
-| --- | --- | --- |
-| [![Build Status](https://dev.azure.com/michaeljolley/devtoolbox/_apis/build/status/MichaelJolley.devtools?branchName=master)](https://dev.azure.com/michaeljolley/devtoolbox/_build/latest?definitionId=4&branchName=master) | [![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributing) | [![Downloads](https://img.shields.io/powershellgallery/dt/devtoolbox.svg)](https://www.powershellgallery.com/packages/devtoolbox) |
+[![Downloads](https://img.shields.io/powershellgallery/dt/devtoolbox.svg)](https://www.powershellgallery.com/packages/devtoolbox)
# What & Why
@@ -16,6 +14,10 @@ For more information as to how this repo came about, check out this [blog post](
The easiest way to install devtoolbox is via the [PowerShell Gallery](https://www.powershellgallery.com/packages/devtoolbox).
+```ps
+Install-Module -Name devtoolbox
+```
+
---
## Parameters
@@ -24,10 +26,10 @@ All aliases accept parameters of the commands they call.
For example, the below are identical:
-```CMD
-g cl https://github.com/builders-club/devtoolbox.git
+```bash
+g cl https://github.com/michaeljolley/devtoolbox.git
-git clone https://github.com/builders-club/devtoolbox.git
+git clone https://github.com/michaeljolley/devtoolbox.git
```
---
@@ -97,37 +99,14 @@ All aliases for Git begin with `g`.
| Command | Executes |
| --- | --- |
-| gh | Launches browser to GitHub repo if the directory is tracked by Git and its origin url is at GitHub |
+| github | Launches browser to GitHub repo if the directory is tracked by Git and its origin url is at GitHub |
| hosts | If in Windows, opens the hosts file in an elevated editor. Choosing, in order, between VS Code, VS Code (insiders), Notepad. |
-| ~~reload~~ | ~~Restarts PowerShell in-place. Useful in the event you have added something to the path or user profile script and need a powershell restart in order for it to be recognized.~~ |
-| Restore-WorkspacePackages (rwp) | Restores NPM, Nuget, and Libman packages starting at the root folder of a workspace. |
+| rwp | Restores NPM, Nuget, and Libman packages starting at the root folder of a workspace. |
| Syntax | Prints PowerShell Command Syntax vertically, replicating docs.microsoft.com layout |
| Sort-Reverse | Reverses the order of an array. Accepts pipeline support e.g. `1,2,3,4,5 | Sort-Reverse` |
-| p `` | Changes your current directory to the directory of the project you provide. It will search the root directory (or the current directory if no root directory is set in the environment variables) recursively for the project directory you provided. |
---
## Contributing
-Want to contribute? Check out our [Code of Conduct](CODE_OF_CONDUCT.md) and [Contributing](CONTRIBUTING.md) docs. This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
-
-Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
-
-
-
-
-
-
-
-
-
+Want to contribute? Check out our [Code of Conduct](CODE_OF_CONDUCT.md) and [Contributing](CONTRIBUTING.md) docs. Contributions of any kind welcome!
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
deleted file mode 100644
index 49ed65b..0000000
--- a/azure-pipelines.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-# Docs: https://aka.ms/yaml
-name: $(Build.DefinitionName)_$(GitVersion_InformationalVersion)
-pr:
-- master
-
-queue:
- name: Hosted VS2017
-
-steps:
-# - powershell: .\_build\bootstrap.ps1
-# displayName: 'Install pre-requisites'
-
-#- task: richardfennellBM.BM-VSTS-PesterRunner-Task.Pester-Task.Pester@8
-# displayName: 'Pester Test Runner'
-# inputs:
-# scriptFolder: '$(System.DefaultWorkingDirectory)\tests\*'
-# additionalModulePath: '$(Build.ArtifactStagingDirectory)'
-# resultsFile: '$(Common.TestResultsDirectory)\Test-$(Build.DefinitionName)_$(Build.BuildNumber).xml'
-
-#- task: PublishTestResults@2
-# displayName: 'Publish Test Results'
-# condition: always()
-# inputs:
-# testRunner: NUnit
-# searchFolder: '$(Common.TestResultsDirectory)'
-
-- powershell: . "$(Build.Repository.LocalPath)/_build/build.ps1"
- displayName: 'Build the dist folder for publishing'
-
-- powershell: Publish-Module -Path "$(Build.Repository.LocalPath)/dist" -NuGetApiKey $(NugetAPIKey)
- displayName: 'Publish PowerShell Module'
diff --git a/src/Export/GitHub/Invoke-GitHubRepository.Tests.ps1 b/src/Export/GitHub/Invoke-GitHubRepository.Tests.ps1
index 924c987..aad40e3 100644
--- a/src/Export/GitHub/Invoke-GitHubRepository.Tests.ps1
+++ b/src/Export/GitHub/Invoke-GitHubRepository.Tests.ps1
@@ -39,25 +39,25 @@ Describe("Invoke-GitHubRepository") {
$cmd | Should -Be $repoUrl
}
- It("Should open default browser to $repoURL/tree/vnext") {
+ It("Should open default browser to $repoURL/tree/main") {
Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "config" } -MockWith { return $repoUrl }
- Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "--show-current" } -MockWith { return "vnext" }
- Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "-r" } -MockWith { return @("origin/vnext") }
+ Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "--show-current" } -MockWith { return "main" }
+ Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "-r" } -MockWith { return @("origin/main") }
Mock -CommandName "Start-Process" -MockWith {
param($FilePath)
$Script:cmd = $FilePath
}
Invoke-GitHubRepository -Branch
- $cmd | Should -Be ($repoUrl + "/tree/vnext")
+ $cmd | Should -Be ($repoUrl + "/tree/main")
}
It("Should throw if branch doesn't exist") {
Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "config" } -MockWith { return $repoUrl }
- Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "--show-current" } -MockWith { return "vnext" }
+ Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "--show-current" } -MockWith { return "main" }
Mock -CommandName "git" -ParameterFilter { $PassThruArgs[0] -eq "branch" -and $PassThruArgs[1] -eq "-r" } -MockWith { return @("origin/main") }
Mock -CommandName "Start-Process" -MockWith {}
- { Invoke-GitHubRepository -Branch } | Should -Throw -ExpectedMessage "Git branch 'vnext' does not exist at $repoUrl"
+ { Invoke-GitHubRepository -Branch } | Should -Throw -ExpectedMessage "Git branch 'main' does not exist at $repoUrl"
}
}
\ No newline at end of file
diff --git a/src/Export/GitHub/Invoke-GitHubRepository.ps1 b/src/Export/GitHub/Invoke-GitHubRepository.ps1
index 8132f6c..0b93551 100644
--- a/src/Export/GitHub/Invoke-GitHubRepository.ps1
+++ b/src/Export/GitHub/Invoke-GitHubRepository.ps1
@@ -1,5 +1,5 @@
Function Invoke-GitHubRepository {
- [Alias('gh')]
+ [Alias('github')]
Param(
# Browse the branch
[Parameter()]
diff --git a/src/Export/Helpers/Invoke-ReloadEnvironment.ps1 b/src/Export/Helpers/Invoke-ReloadEnvironment.ps1
deleted file mode 100644
index d730161..0000000
--- a/src/Export/Helpers/Invoke-ReloadEnvironment.ps1
+++ /dev/null
@@ -1,25 +0,0 @@
-Function Invoke-ReloadEnvironment {
- [Alias("reload")]
- param()
- if ($IsWindows) {
- $SystemEnvironment = Get-Item "HKLM:\System\CurrentControlSet\Control\Session Manager\Environment"
- $UserEnvironment = Get-Item "HKCU:\Environment"
- Push-Location Env:
- $SystemEnvironment | Select-Object -ExpandProperty Property | Where-Object {$_ -notlike "PS*"} | Foreach-Object {
- Set-Item -Path "$_" $SystemEnvironment.GetValue($_)
- }
- $UserEnvironment | Select-Object -ExpandProperty Property | Where-Object {$_ -notlike "PS*"} | Foreach-Object {
- if ($_ -eq "Path") {
- Set-Item -Path "$_" ((Get-Item Path).Value + ";" + $UserEnvironment.GetValue($_))
- }
- else {
- Set-Item -Path "$_" ($existing + $UserEnvironment.GetValue($_))
- }
- }
- Set-Item USERNAME $([Environment]::USERNAME)
- Pop-Location
- }
- if (Test-Path $PROFILE -ErrorAction SilentlyContinue) {
- & $PROFILE
- }
-}
\ No newline at end of file
diff --git a/src/Export/Helpers/Test-PSHostHasAdministrator.ps1 b/src/Export/Helpers/Test-PSHostHasAdministrator.ps1
deleted file mode 100644
index a4f4e85..0000000
--- a/src/Export/Helpers/Test-PSHostHasAdministrator.ps1
+++ /dev/null
@@ -1,16 +0,0 @@
-function Test-PSHostHasAdministrator {
- <#
- .SYNOPSIS
- Check to see if the current user is an administrator
- #>
- [Alias("IsAdmin")]
- param()
- $p = New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())
- if ($p.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)) {
- return $true
- }
- else {
- return $false
- }
- return $false
-}
\ No newline at end of file
diff --git a/src/devtoolbox.psd1 b/src/devtoolbox.psd1
index 59b8b5e..8fa2d7a 100644
--- a/src/devtoolbox.psd1
+++ b/src/devtoolbox.psd1
@@ -3,7 +3,7 @@
#
# Generated by: Michael Jolley
#
-# Generated on: 12/30/2019
+# Generated on: 02/05/2024
#
@{
@@ -12,7 +12,7 @@
# RootModule = ''
# Version number of this module.
- ModuleVersion = '0.6.2'
+ ModuleVersion = '1.0.0'
# Supported PSEditions
# CompatiblePSEditions = @()
@@ -70,9 +70,9 @@ NestedModules = @()
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'Edit-HostsFile', 'Get-Syntax', 'Invoke-Docker', 'Invoke-DockerCompose',
- 'Invoke-Git', 'Invoke-GitHubRepository', 'Invoke-ReloadEnvironment',
+ 'Invoke-Git', 'Invoke-GitHubRepository',
'Invoke-ReverseSort', 'Out-Menu', 'Restart-PSHost',
- 'Restore-WorkspacePackages', 'Test-PSHostHasAdministrator'
+ 'Restore-WorkspacePackages'
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()
@@ -81,7 +81,7 @@ FunctionsToExport = 'Edit-HostsFile', 'Get-Syntax', 'Invoke-Docker', 'Invoke-Doc
VariablesToExport = '*'
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
-AliasesToExport = 'hosts', 'Syntax', 'd', 'dc', 'g', 'gh', 'reload', 'menu', 'rwp', 'IsAdmin'
+AliasesToExport = 'hosts', 'Syntax', 'd', 'dc', 'g', 'github', 'reload', 'menu', 'rwp', 'IsAdmin'
# DSC resources to export from this module
# DscResourcesToExport = @()
@@ -101,10 +101,10 @@ AliasesToExport = 'hosts', 'Syntax', 'd', 'dc', 'g', 'gh', 'reload', 'menu', 'rw
Tags = 'docker','git','docker-compose','alias'
# A URL to the license for this module.
- LicenseUri = 'https://github.com/builders-club/devtoolbox/blob/master/LICENSE'
+ LicenseUri = 'https://github.com/michaeljolley/devtoolbox/blob/main/LICENSE'
# A URL to the main website for this project.
- ProjectUri = 'https://github.com/builders-club/devtoolbox'
+ ProjectUri = 'https://github.com/michaeljolley/devtoolbox'
# A URL to an icon representing this module.
IconUri = 'https://user-images.githubusercontent.com/1228996/60137349-4025ec00-976c-11e9-82f1-db6f8e1a3af8.png'
@@ -126,7 +126,7 @@ AliasesToExport = 'hosts', 'Syntax', 'd', 'dc', 'g', 'gh', 'reload', 'menu', 'rw
} # End of PrivateData hashtable
# HelpInfo URI of this module
-HelpInfoURI = 'https://github.com/builders-club/devtoolbox/issues'
+HelpInfoURI = 'https://github.com/michaeljolley/devtoolbox/issues'
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''