Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonWahlin committed Jun 3, 2023
1 parent 9540541 commit fb0b196
Show file tree
Hide file tree
Showing 26 changed files with 1,004 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Needed for publishing of examples, build worker defaults to core.autocrlf=input.
* text eol=autocrlf

*.mof text eol=crlf
*.sh text eol=lf
*.svg eol=lf

# Ensure any exe files are treated as binary
*.exe binary
*.jpg binary
*.xl* binary
*.pfx binary
*.png binary
*.dll binary
*.so binary
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Additional context**
Add any other context or screenshots about the feature request here.
22 changes: 22 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Contributing a Pull Request

If you haven't already, read the full [contribution guide](https://github.com/StageCoder/StageCoder-PowerShell/blob/main/CONTRIBUTING.md). The guide may have changed since the last time you read it, so please double-check. Once you are done and ready to submit your PR, run through the relevant checklist below.

## Overview/Summary

<!--Replace this with a brief description of what this Pull Request fixes, changes, etc...-->

## This PR fixes/adds/changes/removes

1. *Replace me*
2. *Replace me*
3. *Replace me*

## As part of this Pull Request I have

- [ ] Checked for duplicate [Pull Requests](https://github.com/StageCoder/StageCoder-PowerShell/pulls)
- [ ] Associated it with relevant [issues](https://github.com/StageCoder/StageCoder-PowerShell/issues), for tracking and closure.
- [ ] Ensured my code/branch is up-to-date with the latest changes in the `main` [branch](https://github.com/StageCoder/StageCoder-PowerShell/tree/main)
- [ ] Performed testing and provided evidence.
- [ ] Verified build scripts work.
- [ ] Updated relevant and associated documentation.
81 changes: 81 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Build, Test and Release

on:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set PSModulePath
shell: pwsh
run: |
$PSModulePath = @(
[System.IO.Path]::Combine($Env:GITHUB_WORKSPACE, 'TMP', 'Modules'),
$Env:PSModulePath
) -join [System.IO.Path]::PathSeparator
"PSModulePath=$PSModulePath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.14
with:
versionSpec: '5.x'

- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.14

- name: Setup assets cache
id: assetscache
uses: actions/cache@v3
with:
path: |
TMP/Modules
key: ${{ hashFiles('Scripts/BuildDependencies.ps1') }}

- name: Download required assemblies
if: steps.assetscache.outputs.cache-hit != 'true'
shell: pwsh
run: ./Scripts/BuildDependencies.ps1

- name: Build module
shell: pwsh
run: ./Scripts/Build.ps1 -PublishArtifact -Version "${{steps.gitversion.outputs.LegacySemVerPadded}}"

- name: Publish release artifact
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: StageCoder.zip
path: StageCoder.zip

release:
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: StageCoder.zip

- name: Publish assets
uses: softprops/action-gh-release@v1
with:
files: StageCoder.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish module to PSGallery
shell: pwsh
run: |
Expand-Archive -Path 'StageCoder.zip'
Publish-Module -Path "./StageCoder/StageCoder" -NuGetApiKey $Env:PSGALLERY_KEY -Verbose
env:
PSGALLERY_KEY: ${{ secrets.PSGALLERY_KEY }}

17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
output/

**.bak
*.local.*
!**/README.md
.kitchen/

*.nupkg
*.suo
*.user
*.coverage
.vs
.psproj
.sln
markdownissues.txt
node_modules
package-lock.json
80 changes: 80 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Contributing to StageCoder

You are more than welcome to contribute to the StageCoder module, whether it is [Pull Requests](#pull-requests), [Feature Suggestions](#feature-suggestions) or [Bug Reports](#bug-reports)!

## Getting Started

- Fork this repo (see [this forking guide](https://guides.github.com/activities/forking/) for more information).
- Checkout the repo locally with `git clone git@github.com:{your_username}/StageCoder-PowerShell.git`.
- If you haven't already, you will need the [PlatyPs](https://github.com/PowerShell/platyPS) PowerShell Module to generate command help and docs.

## Developing

### Structure

The repo is organized as below:

- **Private** (`Src/Private`): All private functions used by the module.
- **Public** (`Src/Public`): All functions exported by the module.
- **Tests** (`Tests`): Pester tests executed at Pull Request.
- **Help** (`Docs/Help`): Markdown help files for external help.

### Running the module locally

- Import the module:

```powershell
Import-Module ./Src/StageCoder.psd1
```

### platyPS

[platyPS](https://github.com/PowerShell/platyPS) is used to write the external help in markdown. When contributing always make sure that the changes are added to the help file.

#### Quickstart

- Install the platyPS module from the [PowerShell Gallery](https://powershellgallery.com):

```powershell
Install-Module -Name platyPS -Scope CurrentUser
Import-Module platyPS
```

- Create initial Markdown help file for `StageCoder` module (This will only create help files for new commands, existing files will not be overwritten):

```powershell
# you should have module imported in the session
Import-Module './Src/StageCoder.psd1'
New-MarkdownHelp -Command 'My-NewCommand' -OutputFolder './Docs/Help'
```

Edit the markdown file(s) in the `./Docs/Help` folder and populate `{{ ... }}` placeholders with missed help content.

- If you've made a lot of changes to the module code, you can easily update the markdown file(s) automatically with:

```powershell
# re-import your module with latest changes
Import-Module './Src/StageCoder.psd1' -Force
Update-MarkdownHelp './Docs/Help'
```

## Pull Requests

If you like to start contributing to the StageCoder module. Please make sure that there is a related issue to link to your PR.

- Make sure that the issue is tagged in the PR, e.g. "fixes #45"
- Write a short but informative commit message, it will be added to the release notes.

## Feature Suggestions

- Please first search [Open Issues](https://github.com/StageCoder/StageCoder-PowerShell/Issues) before opening an issue to check whether your feature has already been suggested.
If it has, feel free to add your own comments to the existing issue.
- Ensure you have included a "What?" - what your feature entails, being as specific as possible, and giving mocked-up syntax examples where possible.
- Ensure you have included a "Why?" - what the benefit of including this feature will be.
- Use the "Feature Request" issue template [here](https://github.com/StageCoder/StageCoder-PowerShell/issues/new/choose) to submit your request.

## Bug Reports

- Please first search [Open Issues](https://github.com/StageCoder/StageCoder-PowerShell/issues) before opening an issue, to see if it has already been reported.
- Try to be as specific as possible, including the version of the ADOPS PowerShell module, PowerShell version and OS used to reproduce the issue, and any example files or snippets of ADOPS code needed to reproduce it.
- Use the "Bug Report" issue template [here](https://github.com/StageCoder/StageCoder-PowerShell/issues/new/choose) to submit your request.
44 changes: 44 additions & 0 deletions Docs/Help/Get-Demo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
external help file: StageCoder-help.xml
Module Name: StageCoder
online version:
schema: 2.0.0
---

# Get-Demo

## SYNOPSIS
Get current list of demo commands

## SYNTAX

```
Get-Demo [<CommonParameters>]
```

## DESCRIPTION
Get list of current demo commands

## EXAMPLES

### Example 1
```powershell
PS C:\> Get-Demo
```

Outputs list of current demo commands

## PARAMETERS

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

### None
## OUTPUTS

### System.Object
## NOTES

## RELATED LINKS
75 changes: 75 additions & 0 deletions Docs/Help/Get-DemoCommand.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
external help file: StageCoder-help.xml
Module Name: StageCoder
online version:
schema: 2.0.0
---

# Get-DemoCommand

## SYNOPSIS
Get next demo command and put it in clipboard.

## SYNTAX

```
Get-DemoCommand [[-Index] <Int32>] [-Passthru] [<CommonParameters>]
```

## DESCRIPTION
Get next demo command and put it in clipboard. If -Passthru is specified, the command is also returned as a string.
Use this command in a PSReadLineKeyHandler to bind it to a hotkey.

## EXAMPLES

### Example 1
```powershell
PS C:\> Get-DemoCommand
```

Get next demo command and put it in clipboard.

## PARAMETERS

### -Index
Get a command of specific index. If not specified, the next command is returned.

```yaml
Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Passthru
Also output the command as a string.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
### None
## OUTPUTS
### System.Object
## NOTES
## RELATED LINKS
Loading

0 comments on commit fb0b196

Please sign in to comment.