Skip to content

Commit c41f257

Browse files
authored
Merge pull request #4 from ferricoxide/AddRunContent
Adds actual functionality ("run content") to the skeleton-project
2 parents 8bd443f + 696d2b1 commit c41f257

62 files changed

Lines changed: 1807 additions & 93 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.2.1
2+
current_version = 0.0.1
33
commit = True
44
message = Bumps version to {new_version}
55
tag = False

.github/workflows/test.yml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run test jobs
1+
name: Run salt tests
22
on:
33
pull_request:
44

@@ -7,5 +7,54 @@ concurrency:
77
cancel-in-progress: true
88

99
jobs:
10-
test:
11-
uses: plus3it/actions-workflows/.github/workflows/test.yml@ce3cef72cf4ac9605a29350d1d4387dfb86cd7a8
10+
windows:
11+
uses: plus3it/actions-workflows/.github/workflows/test-salt-windows.yml@00ff10246f901f01818db412fa99124dbed4a00c
12+
strategy:
13+
matrix:
14+
os_version:
15+
- windows-2019
16+
- windows-2022
17+
- windows-2025
18+
salt_state:
19+
- notepad-plusplus
20+
salt_pillar_root:
21+
- ./tests/pillar/test-main
22+
with:
23+
salt-os-version: ${{ matrix.os_version }}
24+
salt-state: ${{ matrix.salt_state }}
25+
salt-pillar-root: ${{ matrix.salt_pillar_root }}
26+
27+
lint_powershell:
28+
name: PowerShell Linting
29+
runs-on: windows-latest
30+
steps:
31+
- name: Checkout Code
32+
uses: actions/checkout@v4
33+
34+
- name: Run PSScriptAnalyzer
35+
shell: pwsh
36+
run: |
37+
$files = Get-ChildItem -Path ./ -Include *.ps1 -Recurse
38+
Write-Host "--- Starting PowerShell Static Analysis ---"
39+
40+
$anyErrors = $false
41+
42+
foreach ($file in $files) {
43+
$relativePath = $file.FullName.Replace($PWD.ProviderPath, ".")
44+
$results = Invoke-ScriptAnalyzer -Path $file.FullName -Severity Warning
45+
46+
if ($results) {
47+
Write-Host "FAIL: $relativePath" -ForegroundColor Red
48+
$results | Format-Table -AutoSize
49+
$anyErrors = $true
50+
} else {
51+
Write-Host "PASS: $relativePath" -ForegroundColor Green
52+
}
53+
}
54+
55+
if ($anyErrors) {
56+
Write-Error "Static analysis failed. Please fix the errors above."
57+
exit 1
58+
} else {
59+
Write-Host "--- All files passed analysis! ---"
60+
}

CHANGELOG.md

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,22 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7-
### [1.2.1] (https://github.com/plus3it/repo-template/releases/tag/1.2.1)
7+
### [0.0.1] (https://github.com/plus3it/repo-template/releases/tag/0.0.1)
88

9-
**Summary**:
10-
11-
* Updated README.md to include config settings for github
12-
* Updated LICENSE copyright year
13-
14-
### [1.2.0] (https://github.com/plus3it/repo-template/releases/tag/1.2.0)
9+
**Released**: 2026.04.14
1510

1611
**Summary**:
1712

18-
* Updated SHA value for Github Actions Workflows
19-
* Updated CHANGELOG.template.md file
20-
* Added Master branch in release workflow logic to make migration to Github Actions more efficient
21-
22-
### 1.1.0
23-
24-
**Commit Delta**: N/A
25-
26-
**Released**: 2023.01.27
27-
28-
**Summary**:
13+
* Adds all necessary, initial install and configuration content for the Notepad++ application to be installed and ready-to-run
14+
* Adds all necessary "clean" content for the Notepad++ application to be fully removed (binaries, config-files and registry-settings
15+
* Activates initial CI content from repo-template repository
2916

30-
* Updated workflow files to be consumable and reusable, and now points to actions-workflows repo
3117

32-
### 1.0.0
3318

34-
**Commit Delta**: N/A
19+
### [0.0.0] (https://github.com/plus3it/repo-template/releases/tag/0.0.0)
3520

36-
**Released**: 2023.01.10
21+
**Released**: 2026.04.09
3722

3823
**Summary**:
3924

40-
* Initial release of capability
25+
* "Skeleton" content cloned from [repo-template](https://github.com/plus3it/repo-template) repository

CHANGELOG.template.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2024 Maintainers of plus3it/repo-template
189+
Copyright 2026 Maintainers of plus3it/repo-template
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 40 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,40 @@
1-
# repo-template
2-
Generic repo template for Plus3IT repositories
3-
4-
To use this template:
5-
6-
1. Select the green "Use this template" button, or [click here](https://github.com/plus3it/repo-template/generate).
7-
2. Select the repo Owner, give the repo a name, enter a description, select Public or Private, and click "Create repository from template".
8-
3. Clone the repository and create a new branch.
9-
4. Configure the following settings on your new repo.
10-
* `GENERAL`
11-
* `Features`
12-
* Turn off Wikis, Sponsorships, Discussions, and Projects
13-
* `Pull Requests`
14-
* Turn off Squash Merging
15-
* Turn off Rebase Merging
16-
* Turn on Allow Auto-Merge
17-
* Turn on Automatically delete head branches
18-
* `Pushes`
19-
* Limit how many branches can be updated in a single push: 2
20-
* `COLLABORATORS and TEAMS`
21-
* `Manage Access`
22-
* Add relevant team roles, for example
23-
* `tardigrade-admins` (Admin)
24-
* `terraform` (Write)
25-
* `releasebot` (Write)
26-
* `Branches`
27-
* `Create Branch Protection rule` for `main`
28-
* Turn on Require pull request before merging
29-
* Turn on Require approvals
30-
* Turn on Dismiss stale pull requests...
31-
* `Required Status Checks`
32-
* As relevant to projects, for example
33-
* WIP
34-
* lint/actionlint
35-
* lint/tardigradelint
36-
* test / mockstacktest
37-
* Turn on Do not allow bypassing the above settings
38-
5. Edit the following files to customize them for the new repository:
39-
* `LICENSE`
40-
* Near the end of the file, edit the date and change the repository name
41-
* `CHANGELOG.template.md`
42-
* Rename to `CHANGELOG.md`, replacing the repo-template changelog
43-
* Edit templated items for the new repo
44-
* `.bumpversion.cfg`
45-
* Edit the version number for the new repo, ask team if not sure what to
46-
start with
47-
* `README.md`
48-
* Replace contents for the new repo
49-
* `.github/`
50-
* Inspect dependabot and workflow files in case changes are needed for
51-
the new repo
52-
6. Commit the changes and open a pull request
1+
# notepad-plusplus-formula
2+
3+
A Saltstack formula designed to install and configure the [Notepad++](https://notepad-plus-plus.org/) text-editor (and to uninstall it later).
4+
5+
It is primarily expected that this formula will be run via [P3](https://www.plus3it.com/)'s "[watchmaker](https://watchmaker.readthedocs.io/en/stable/)" framework.
6+
7+
This formula is able to install and configure the Notepad++ text-editor on Windows-based systems. Linux functionality would also have been provided, but there's currently no Linux variant from the same makers.
8+
9+
## Available states
10+
11+
- [notepad-plusplus](#notepad-plusplus)
12+
- [notepad-plusplus.clean](#notepad-plusplus.clean)
13+
- [notepad-plusplus.package](#notepad-plusplus.package)
14+
- [notepad-plusplus.package.clean](#notepad-plusplus.package.clean)
15+
- [notepad-plusplus.config](#notepad-plusplus.config)
16+
- [notepad-plusplus.config.clean](#notepad-plusplus.config.clean)
17+
18+
### notepad-plusplus
19+
20+
Executes the `package` and `config` states to install and configure the Notepad++ editor. This includes the editor binaries, as well as some Windows Registry settings and user-configuration template files.
21+
22+
### notepad-plusplus.clean
23+
24+
Executes the `package` and `config` states' `clean` actions to fully uninstall the Notepad++ editor and associated registry entries
25+
26+
### notepad-plusplus.package
27+
28+
Executes _just_ the `package` state to install the Notepad++ package.
29+
30+
### notepad-plusplus.package.clean
31+
32+
Executes _just_ the `package` state's `clean` module to uninstall the Notepad++ binaries.
33+
34+
### notepad-plusplus.config
35+
36+
Executes _just_ the `config` state to install registry-keys and other configuration-items to support the healthy running of the Notepad++ application
37+
38+
### notepad-plusplus.config.clean
39+
40+
Executes _just_ the `config` state's `clean` module to uninstall the Notepad++ application's registry keys and other configuration-items set up during a prior, formula-managed installation.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# yamllint disable rule:indentation rule:line-length
2+
# {{ grains.get("osfinger", grains.os) }}
3+
---
4+
{#- use salt.slsutil.serialize to avoid encoding errors on some platforms #}
5+
{{ salt["slsutil.serialize"](
6+
"yaml",
7+
map,
8+
default_flow_style=False,
9+
allow_unicode=True,
10+
)
11+
| regex_replace("^\s+'$", "'", multiline=True)
12+
| trim
13+
}}

notepad-plusplus/_mapdata/init.sls

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=sls
3+
---
4+
{#- Get the `tplroot` from `tpldir` #}
5+
{%- set tplroot = tpldir.split("/")[0] %}
6+
{%- from tplroot ~ "/map.jinja" import mapdata with context %}
7+
8+
{%- set _mapdata = {
9+
"values": mapdata,
10+
} %}
11+
{%- do salt["log.debug"]("### MAP.JINJA DUMP ###\n" ~ _mapdata | yaml(False)) %}
12+
13+
{%- set output_dir = "/temp" if grains.os_family == "Windows" else "/tmp" %}
14+
{%- set output_file = output_dir ~ "/salt_mapdata_dump.yaml" %}
15+
16+
{{ tplroot }}-mapdata-dump:
17+
file.managed:
18+
- name: {{ output_file }}
19+
- source: salt://{{ tplroot }}/_mapdata/_mapdata.jinja
20+
- template: jinja
21+
- context:
22+
map: {{ _mapdata | yaml }}

notepad-plusplus/clean.sls

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=sls
3+
4+
{%- if grains.os_family == "Windows" %}
5+
include:
6+
- .config.clean
7+
- .package.clean
8+
{%- else %}
9+
Invalid Platform
10+
test.show_notification:
11+
- text: |
12+
----------------------------------------
13+
The notepad++ application is not
14+
published for non-Windows platform.
15+
Skipping all further actions.
16+
----------------------------------------
17+
{%- endif %}
18+

notepad-plusplus/config/clean.sls

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=sls
3+
4+
{#- Get the `tplroot` from `tpldir` #}
5+
{%- set tplroot = tpldir.split('/')[0] %}
6+
{%- from tplroot ~ "/map.jinja" import mapdata as notepad_plusplus with context %}
7+
{%- set npp_admins = notepad_plusplus.config.npp_admins or ['Administrator'] %}
8+
{%- set npp_dir = 'C:\\Program Files\\Notepad++' %}
9+
10+
{# Map descriptive IDs to their respective Registry paths #}
11+
{%- set npp_registry_map = {
12+
'NPP Application Path': 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\notepad++.exe',
13+
'NPP Context Menu Entry': 'HKEY_CLASSES_ROOT\\*\\shell\\Open with Notepad++',
14+
'NPP MuiCache Entry': 'HKEY_CLASSES_ROOT\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache',
15+
'NPP OpenWithList txt': 'HKEY_CLASSES_ROOT\\.txt\\OpenWithList\\notepad++.exe',
16+
'NPP System Notepad Replacement': 'HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Opt
17+
ions\\notepad.exe'
18+
}
19+
%}
20+
21+
{%- for desc, reg_path in npp_registry_map.items() %}
22+
Remove {{ desc }}:
23+
reg.absent:
24+
- name: '{{ reg_path }}'
25+
{%- endfor %}
26+
27+
{%- for admin in npp_admins %}
28+
Remove NPP AppData for {{ admin }}:
29+
file.absent:
30+
- name: 'C:\Users\{{ admin }}\AppData\Roaming\Notepad++'
31+
{%- endfor %}
32+
33+
Remove NPP System Config Files:
34+
file.absent:
35+
- names:
36+
- '{{ npp_dir }}\updater\gup.xml'
37+
- '{{ npp_dir }}\config.model.xml'

0 commit comments

Comments
 (0)