Skip to content

Commit 3ecfd23

Browse files
authored
Merge pull request #16 from stadub/7-Zip-Release-1.1
7 zip release 1.1 Fix issues #14 #15
2 parents e3ff052 + 6f8e8f6 commit 3ecfd23

7 files changed

Lines changed: 68 additions & 241 deletions

File tree

7Zip/7zip-Archive.SmokeTests.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Import-Module .\7zip-Archive.psm1
2+
3+
4+
ls -Exclude .git | New-ZipFile "scripts"
5+
Test-ZipFileContent .\scripts.7z
6+
Get-ZipFileContent -Archive .\scripts.7z
7+
Remove-ZipFileContent -Archive .\scripts.7z -File "temp.log"
8+
Read-ZipFile -Archive .\scripts.7z
9+
Add-ZipFileContent -Path .\scripts.7z -FileName .\7zip-Archive.psd1

7Zip/7zip-Archive.psd1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
# RootModule = ''
1212

1313
# Version number of this module.
14-
ModuleVersion = '1.0.3'
14+
15+
ModuleVersion = '1.1.0'
1516

1617
# Supported PSEditions
1718
# CompatiblePSEditions = @()

7Zip/7zip-Archive.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
. $PSScriptRoot\Functions.ps1
44

5-
CheckPsGalleryUpdate "7zip-Archive" "1.0.3"
5+
szCheckPsGalleryUpdate 7Zip "1.1.0"
66

77
_Initalize
88

7Zip/Aliases.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Set-Alias sza Add-ZipFileContent -Scope Global
33
Set-Alias szrm Remove-ZipFileContent -Scope Global
44
Set-Alias szt Test-ZipFileContent -Scope Global
55
Set-Alias br Get-ZipFileContent -Scope Global
6+
Set-Alias szc New-ZipFile -Scope Global
67

7Zip/Functions.ps1

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
function _Initalize() {
44

5-
$script:_binDir = Get-ProfileDir "7zip" "bin"
5+
$script:_binDir = szGet-ProfileDir "7zip" "bin"
66
Write-Debug "The 7-zip is dir set to $_binDir"
77
$script:_7zWin = Join-Path $_binDir "7za.exe"
88
$script:_7zWinDownloadDir='https://www.7-zip.org/a/7za920.zip'
@@ -22,19 +22,19 @@ function Test-7ZipInstall {
2222
Write-Debug "Trying to locate 7-zip by the path: $script:_7zWin"
2323

2424
if( -not (Test-Path "$script:_7zWin")){
25-
Write-Output '7Zip didn''t found.'
25+
Write-Output '7Zip didn''t downloaded.'
2626
Write-Output 'Now script going to try to download it.'
2727

28-
$file = Get-TempFileName
28+
$file = szGet-TempFileName
2929
Write-Debug "Temp file: ${file}"
3030

31-
Receive-File "7-Zip" $file $_7zWinDownloadDir
31+
szReceive-File "7-Zip" $file $_7zWinDownloadDir
3232
Write-Debug "Extracting to directory ${_binDir}"
3333
if ( -not (Test-Path $_binDir )) {
3434
New-Item -Path $_binDir -ItemType 'Directory'
3535
}
3636

37-
Extract-ZipFile -FileName "$file" -Path "$_binDir"
37+
szExtract-ZipFile -FileName "$file" -Path "$_binDir"
3838
}
3939
$script:_7zPath = $script:_7zWin
4040

@@ -56,7 +56,7 @@ function AddKeyArg {
5656
$AllArgs = $null,
5757
[string]$Key = $null
5858
)
59-
if( -not (Test-Empty $Key)){
59+
if( -not (szTest-Empty $Key)){
6060
$AllArgs += "-p$Key"
6161
}
6262
return $AllArgs
@@ -206,7 +206,6 @@ function Remove-ZipFileContent {
206206
[Alias("Path","Name", "Archive", "p")]
207207
[string]$ArchiveName,
208208

209-
[ValidateScript( { Test-Path $_ -pathType leaf })]
210209
[Parameter(Position = 1, Mandatory = $true)]
211210
[Alias("File", "f")]
212211
[string]$FileName,
@@ -364,7 +363,7 @@ function New-ZipFile {
364363
process {
365364

366365
$FileNames| ForEach-Object{
367-
if( -not (Test-Empty $_) ){
366+
if( -not (szTest-Empty $_) ){
368367
Write-Debug "Adding file ""$_"""
369368
$files += $_
370369
}
@@ -432,7 +431,7 @@ function New-ZipFile {
432431
}
433432

434433

435-
if( -not (Test-Empty $([string]$SplitSize) )){
434+
if( -not (szTest-Empty $([string]$SplitSize) )){
436435

437436
$factorName="b"
438437
switch ( $SplitSizeFactor )
@@ -518,7 +517,7 @@ function Test-ZipFileContent {
518517
$AllArgs = @('t', "$ArchiveName")
519518

520519

521-
if( -not (Test-Empty $FileName) ){
520+
if( -not (szTest-Empty $FileName) ){
522521
$AllArgs += "$FileName"
523522
}
524523

@@ -586,12 +585,12 @@ function Get-ZipFileContent {
586585

587586
$AllArgs = @('e', "$ArchiveName")
588587

589-
if( -not (Test-Empty $FileName) ){
588+
if( -not (szTest-Empty $FileName) ){
590589
$AllArgs += "$FileName"
591590
}
592591

593-
if( -not (Test-Empty $destFolder) ){
594-
CreateFolderIfNotExist "${destFolder}"
592+
if( -not (szTest-Empty $destFolder) ){
593+
szCreateFolderIfNotExist "${destFolder}"
595594
$AllArgs += "-o$destFolder"
596595
}
597596

7Zip/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Test-ZipFileContent - Perform zip file check
8282

8383
| Cmdlet | Alias |
8484
| ---------------------|:------:|
85+
| New-ZipFile | szc |
8586
| Read-ZipFile | szr |
8687
| Add-ZipFileContent | sza |
8788
| Remove-ZipFileContent| szrm |
@@ -179,6 +180,13 @@ Test-ZipFileContent - Perform zip file check
179180

180181
## Changelog
181182

183+
184+
### [v1.1.0](https://github.com/stadub/PowershellScripts/releases/tag/v0.9.5) Spet 9, 2019
185+
186+
* Fix Remove-ZipFileContent error #15
187+
* Fix szc Allias #14
188+
* Add smoke tests
189+
182190
### [v1.0.0](https://github.com/stadub/PowershellScripts/releases/tag/v0.4.0)
183191

184192
*First public release.

0 commit comments

Comments
 (0)