-
Notifications
You must be signed in to change notification settings - Fork 41
/
ZipSrc.ps1
89 lines (79 loc) · 2.73 KB
/
ZipSrc.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# -------------------------------------------------------
# ZipSrc.ps1
#
# Zips the source tree for DotNetZip. This is used when producing a
# release.
#
# This script is part of DotNetZip.
# DotNetZip is Copyright 2008-2011 Dino Chiesa.
#
# DotNetZip is licensed under the MS-PL. See the accompanying
# License.txt file.
#
# Last Updated: <2011-July-30 15:56:10>
#
# -------------------------------------------------------
function ZipUp-Files ( $directory )
{
$children = get-childitem -path $directory
foreach ($o in $children)
{
if (!$BaseDir -or ($BaseDir -eq "")) {
$ix = $o.PSParentPath.IndexOf("::")
$BaseDir = $o.PSParentPath.Substring($ix+2)
$x = get-item $BaseDir
$ix = $x.PSParentPath.IndexOf("::")
$ParentOfBase = $x.PSParentPath.Substring($ix+2) + "\\"
}
if ($o.Name -ne "TestResults" -and
$o.Name -ne "_UpgradeReport_Files" -and
$o.Name -ne "obj" -and
$o.Name -ne "releases" -and
$o.Name -ne "bin" -and
$o.Name -ne "_tfs" -and
$o.Name -ne "notused" -and
$o.Name -ne "Todo.txt" -and
$o.Name -ne "AppNote.txt" -and
$o.Name -ne "AppNote.iz.txt" -and
$o.Name -ne "CodePlex-Readme.txt" -and
$o.Name -ne "ReadThis.txt" -and
$o.Name -ne "Ionic.snk" -and
$o.Name -ne "Ionic.pfx" -and
$o.Name -ne "Debug" -and
$o.Name -ne "Release" )
# -and $o.Name -ne "Resources" )
{
if ($o.PSIsContainer)
{
ZipUp-Files ( $o.FullName )
}
else
{
#Write-output $o.FullName
if ($o.Name -and
$o.Name -ne "" -and
$o.Name -ne ".tfs-ignore" -and
(!$o.Name.StartsWith("UpgradeLog")) -and
(!$o.Name.EndsWith("~")) -and
(!$o.Name.EndsWith("#")) -and
(!$o.Name.EndsWith(".vsp")) -and
(!$o.Name.EndsWith(".vspscc")) -and
(!$o.Name.EndsWith(".psess")) -and
(!$o.Name.EndsWith(".user")) -and
(!$o.Name.EndsWith(".cache"))
# -and (!$o.Name.EndsWith(".zip")) # was eliminating test cases
)
{
Write-output $o.FullName.Replace($ParentOfBase, "")
$e= $zipfile.AddFile($o.FullName.Replace($ParentOfBase, ""))
}
}
}
}
}
[System.Reflection.Assembly]::LoadFrom("c:\\dev\\dotnet\\Ionic.Zip.dll");
$version = get-content -path 'DotNetZip\SolutionInfo.cs' | select-string -pattern 'AssemblyFileVersion\("[0-9]+(\.([0-9]+|\*)){1,3}"\)' | %{$_ -replace "[^0-9.]",""}
$ZipFileName = "DotNetZip-src-v$version.zip"
$zipfile = new-object Ionic.Zip.ZipFile($ZipFileName);
ZipUp-Files "DotNetZip"
$zipfile.Save()