Skip to content

Commit b8ee946

Browse files
authored
Replace justfile with PowerShell
Signed-off-by: Bradley Reynolds <[email protected]>
1 parent f90912e commit b8ee946

File tree

2 files changed

+116
-42
lines changed

2 files changed

+116
-42
lines changed

justfile

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

make.ps1

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<#
2+
.SYNOPSIS
3+
Makefile
4+
5+
.DESCRIPTION
6+
USAGE
7+
.\make.ps1 <command>
8+
9+
COMMANDS
10+
init install Python build tools
11+
install install local package in production mode
12+
install-dev install local package in editable mode
13+
lint run `isort` and `black`
14+
pylint run `pylint`
15+
test run `pytest`
16+
build-dist run `python -m build`
17+
clean delete generated content
18+
help, -? show this help message
19+
#>
20+
param(
21+
[Parameter(Position = 0)]
22+
[ValidateSet("init", "install", "install-dev", "lint", "pylint", "test", "build-dist", "clean", "help")]
23+
[string]$Command
24+
)
25+
26+
function Invoke-Help
27+
{
28+
Get-Help $PSCommandPath
29+
}
30+
31+
function Invoke-Init
32+
{
33+
python -m pip install --upgrade pip wheel setuptools build
34+
}
35+
36+
function Invoke-Install
37+
{
38+
python -m pip install --upgrade .
39+
}
40+
41+
function Invoke-Install-Dev
42+
{
43+
python -m pip install --upgrade --editable ".[dev, tests, docs]"
44+
}
45+
46+
function Invoke-Lint
47+
{
48+
python -m isort src/
49+
python -m black src/
50+
}
51+
52+
function Invoke-Pylint
53+
{
54+
python -m pylint src/
55+
}
56+
57+
function Invoke-Test
58+
{
59+
python -m pytest
60+
}
61+
62+
function Invoke-Build-Dist
63+
{
64+
python -m pip install --upgrade build
65+
python -m build
66+
}
67+
68+
function Invoke-Clean
69+
{
70+
$folders = @("build", "dist")
71+
foreach ($folder in $folders)
72+
{
73+
if (Test-Path $folder)
74+
{
75+
76+
Write-Verbose "Deleting $folder"
77+
Remove-Item $folder -Recurse -Force
78+
}
79+
}
80+
}
81+
82+
switch ($Command)
83+
{
84+
"init" {
85+
Invoke-Init
86+
}
87+
"install" {
88+
Invoke-Install
89+
}
90+
"install-dev" {
91+
Invoke-Install-Dev
92+
}
93+
"lint" {
94+
Invoke-Lint
95+
}
96+
"pylint" {
97+
Invoke-Pylint
98+
}
99+
"test" {
100+
Invoke-Test
101+
}
102+
"build-dist" {
103+
Invoke-Build-Dist
104+
}
105+
"clean" {
106+
Invoke-Clean
107+
}
108+
"help" {
109+
Invoke-Help
110+
}
111+
default
112+
{
113+
Invoke-Init
114+
Invoke-Install-Dev
115+
}
116+
}

0 commit comments

Comments
 (0)