Skip to content

Commit 959c679

Browse files
authored
Merge pull request #171 from snazy2000/develop
Develop
2 parents ec6c96f + bd7d4ce commit 959c679

File tree

6 files changed

+80
-31
lines changed

6 files changed

+80
-31
lines changed

SnipeitPS.build.ps1

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,14 @@ task GitStatus -If (Test-Path .git) {
8888
}
8989
}
9090

91-
task TestVersions TestPS3, TestPS4, TestPS4, TestPS5
92-
task TestPS3 {
93-
exec {powershell.exe -Version 3 -NoProfile Invoke-Build PesterTests}
94-
}
95-
task TestPS4 {
96-
exec {powershell.exe -Version 4 -NoProfile Invoke-Build PesterTests}
97-
}
98-
task TestPS5 {
99-
exec {powershell.exe -Version 5 -NoProfile Invoke-Build PesterTests}
91+
task TestVersions TestPS
92+
93+
task TestPS {
94+
if($env:PShell -eq '7') {
95+
exec {pwsh.exe -NoProfile Invoke-Build PesterTests}
96+
}else {
97+
exec {powershell.exe -NoProfile Invoke-Build PesterTests}
98+
}
10099
}
101100

102101
# Synopsis: Invoke Pester Tests
@@ -192,7 +191,9 @@ task Deploy -If (
192191
(-not ($env:APPVEYOR_PULL_REQUEST_NUMBER)) -and
193192
# Do not deploy if the commit contains the string "skip-deploy"
194193
# Meant for major/minor version publishes with a .0 build/patch version (like 2.1.0)
195-
$env:APPVEYOR_REPO_COMMIT_MESSAGE -notlike '*skip-deploy*'
194+
$env:APPVEYOR_REPO_COMMIT_MESSAGE -notlike '*skip-deploy*' -and
195+
# publish from one powershell version is enought
196+
$env:PShell -eq '5'
196197
) {
197198
Remove-Module SnipeitPS -ErrorAction SilentlyContinue
198199
}, PublishToGallery

SnipeitPS/Public/Set-SnipeitComponent.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ ID number of category
1717
.PARAMETER qty
1818
Quantity of the components you have
1919
20+
.PARAMETER min_amt
21+
Minimum Quantity of the components before alert is triggered
22+
2023
.PARAMETER location_id
2124
ID number of the location the accessory is assigned to
2225
@@ -55,6 +58,8 @@ function Set-SnipeitComponent()
5558
[parameter(mandatory = $true)]
5659
[int]$qty,
5760

61+
[int]$min_amt,
62+
5863
[string]$name,
5964

6065
[int]$company_id,

SnipeitPS/Public/Set-SnipeitLicenseSeat.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ function Set-SnipeitLicenseSeat()
4646
[int]$seat_id,
4747

4848
[Alias('assigned_id')]
49-
[int]$assigned_to,
49+
[Nullable[System.Int32]]$assigned_to,
5050

51-
[int]$asset_id,
51+
[Nullable[System.Int32]]$asset_id,
5252

5353
[string]$note,
5454

SnipeitPS/SnipeitPS.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Copyright = '(c) 2017 Stephen Maunder. All rights reserved.'
3333
Description = 'Powershell API for Snipeit Asset Management'
3434

3535
# Minimum version of the Windows PowerShell engine required by this module
36-
PowerShellVersion = '3.0'
36+
PowerShellVersion = '5.1'
3737

3838
# Name of the Windows PowerShell host required by this module
3939
# PowerShellHostName = ''

appveyor.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
#
88
############################################################
99

10-
# This tells AppVeyor that we need WMF 5 and PowerShell 5.0
11-
os: WMF 5
10+
# powershell core and 5.1
11+
image:
12+
- Visual Studio 2017
13+
- Visual Studio 2019
1214

1315
environment:
1416
PSGalleryAPIKey:
1517
secure: UdM6qhf5B0G8liHhUrwWERCZr44iSqmg4jUq0lwlTjZs4KyeoiwnBzdej0phqIAm
18+
PShell: '5'
1619

1720
version: 1.7.{build}
1821

@@ -53,15 +56,40 @@ before_build:
5356
build_script:
5457
- ps: Invoke-Build -Task Build
5558

56-
# after_build:
57-
# - cmd: mdspell %releasePath%\**/*.md --ignore-numbers --ignore-acronyms --report
58-
5959
test_script:
6060
- ps: Invoke-Build -Task Test
6161

6262
before_deploy:
6363
- ps: Invoke-Build -Task Deploy
6464

65+
#Build with powershell core
66+
for:
67+
-
68+
matrix:
69+
only:
70+
- image: Visual Studio 2019
71+
environment:
72+
PShell: '7'
73+
install:
74+
- pwsh: |
75+
Install-Module InvokeBuild -Scope CurrentUser -Force
76+
Install-Module BuildHelpers -Scope CurrentUser -Force
77+
Install-Module platyPS -Scope CurrentUser -Force
78+
Install-Module Pester -Scope CurrentUser -Force
79+
Install-Module PSScriptAnalyzer -Scope CurrentUser -Force
80+
$env:releasePath = "$($pwd.Path)\Release"
81+
before_build:
82+
- pwsh: Invoke-Build -Task ShowDebug
83+
build_script:
84+
- pwsh: Invoke-Build -Task Build
85+
86+
test_script:
87+
- pwsh: Invoke-Build -Task Test
88+
89+
before_deploy:
90+
- pwsh: Invoke-Build -Task Deploy
91+
92+
6593
deploy:
6694
provider: GitHub
6795
release: v$(appveyor_build_version)

docs/Set-SnipeitComponent.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Updates component
1313
## SYNTAX
1414

1515
```
16-
Set-SnipeitComponent [-id] <Int32> [-qty] <Int32> [[-name] <String>] [[-company_id] <Int32>]
17-
[[-location_id] <Int32>] [[-order_number] <String>] [[-purchase_date] <DateTime>] [[-purchase_cost] <Single>]
18-
[-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
16+
Set-SnipeitComponent [-id] <Int32[]> [-qty] <Int32> [[-min_amt] <Int32>] [[-name] <String>]
17+
[[-company_id] <Int32>] [[-location_id] <Int32>] [[-order_number] <String>] [[-purchase_date] <DateTime>]
18+
[[-purchase_cost] <Single>] [-url] <String> [-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
1919
```
2020

2121
## DESCRIPTION
@@ -39,7 +39,7 @@ Parameter Sets: (All)
3939
Aliases:
4040

4141
Required: True
42-
Position: 10
42+
Position: 11
4343
Default value: None
4444
Accept pipeline input: False
4545
Accept wildcard characters: False
@@ -54,7 +54,7 @@ Parameter Sets: (All)
5454
Aliases:
5555

5656
Required: False
57-
Position: 4
57+
Position: 5
5858
Default value: 0
5959
Accept pipeline input: False
6060
Accept wildcard characters: False
@@ -64,14 +64,14 @@ Accept wildcard characters: False
6464
ID number of name
6565
6666
```yaml
67-
Type: Int32
67+
Type: Int32[]
6868
Parameter Sets: (All)
6969
Aliases:
7070

7171
Required: True
7272
Position: 1
7373
Default value: 0
74-
Accept pipeline input: False
74+
Accept pipeline input: True (ByPropertyName)
7575
Accept wildcard characters: False
7676
```
7777
@@ -84,7 +84,22 @@ Parameter Sets: (All)
8484
Aliases:
8585

8686
Required: False
87-
Position: 5
87+
Position: 6
88+
Default value: 0
89+
Accept pipeline input: False
90+
Accept wildcard characters: False
91+
```
92+
93+
### -min_amt
94+
Minimum Quantity of the components before alert is triggered
95+
96+
```yaml
97+
Type: Int32
98+
Parameter Sets: (All)
99+
Aliases:
100+
101+
Required: False
102+
Position: 3
88103
Default value: 0
89104
Accept pipeline input: False
90105
Accept wildcard characters: False
@@ -99,7 +114,7 @@ Parameter Sets: (All)
99114
Aliases:
100115

101116
Required: False
102-
Position: 3
117+
Position: 4
103118
Default value: None
104119
Accept pipeline input: False
105120
Accept wildcard characters: False
@@ -114,7 +129,7 @@ Parameter Sets: (All)
114129
Aliases:
115130

116131
Required: False
117-
Position: 6
132+
Position: 7
118133
Default value: None
119134
Accept pipeline input: False
120135
Accept wildcard characters: False
@@ -129,7 +144,7 @@ Parameter Sets: (All)
129144
Aliases:
130145

131146
Required: False
132-
Position: 8
147+
Position: 9
133148
Default value: 0
134149
Accept pipeline input: False
135150
Accept wildcard characters: False
@@ -144,7 +159,7 @@ Parameter Sets: (All)
144159
Aliases:
145160

146161
Required: False
147-
Position: 7
162+
Position: 8
148163
Default value: None
149164
Accept pipeline input: False
150165
Accept wildcard characters: False
@@ -174,7 +189,7 @@ Parameter Sets: (All)
174189
Aliases:
175190

176191
Required: True
177-
Position: 9
192+
Position: 10
178193
Default value: None
179194
Accept pipeline input: False
180195
Accept wildcard characters: False

0 commit comments

Comments
 (0)