Skip to content

Commit 82bfbf6

Browse files
author
Jeff Treuting
committed
Created power shell script to automate nuget builds
It's convention based. It goes through each sub-directory in /nuget/ and updates the version in the nuspec file based on the nuspec.template, then uses that new file to create a new package and puts that file into the proper nuget directory. Then we will upload through the website as normal.
1 parent 19c7ffc commit 82bfbf6

9 files changed

Lines changed: 129 additions & 8 deletions

nuget/SharpRepository.Caching.Memcached/SharpRepository.Caching.Memcached.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>SharpRepository.Caching.Memcached</id>
5-
<version>1.0.0.1</version>
5+
<version>1.0.0.211</version>
66
<title>SharpRepository Caching Provider for Memcached</title>
77
<authors>Ben Griswold, Jeff Treuting, Fairway Technologies</authors>
88
<owners>jtreuting, bgriswold</owners>
@@ -17,4 +17,4 @@
1717
<dependency id="SharpRepository.Repository" version="1.0.0.0" />
1818
</dependencies>
1919
</metadata>
20-
</package>
20+
</package>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>SharpRepository.Caching.Memcached</id>
5+
<version></version>
6+
<title>SharpRepository Caching Provider for Memcached</title>
7+
<authors>Ben Griswold, Jeff Treuting, Fairway Technologies</authors>
8+
<owners>jtreuting, bgriswold</owners>
9+
<licenseUrl>https://github.com/SharpRepository/SharpRepository/blob/develop/license.txt</licenseUrl>
10+
<projectUrl>https://github.com/SharpRepository/SharpRepository</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>SharpRepository is a generic repository written in C# which includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDb and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, Memcache and standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits.</description>
13+
<releaseNotes>Initial release</releaseNotes>
14+
<copyright>Copyright 2012</copyright>
15+
<tags>SharpRepository Repository Caching Memcached</tags>
16+
<dependencies>
17+
<dependency id="SharpRepository.Repository" version="1.0.0.0" />
18+
</dependencies>
19+
</metadata>
20+
</package>

nuget/SharpRepository.Ef5Repository/SharpRepository.Ef5Repository.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>SharpRepository.Ef5Repository</id>
5-
<version>1.0.0.1</version>
5+
<version>1.0.0.211</version>
66
<title>SharpRepository for EF5</title>
77
<authors>Ben Griswold, Jeff Treuting, Fairway Technologies</authors>
88
<owners>jtreuting, bgriswold</owners>
@@ -17,4 +17,4 @@
1717
<dependency id="SharpRepository.Repository" version="1.0.0.1" />
1818
</dependencies>
1919
</metadata>
20-
</package>
20+
</package>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>SharpRepository.Ef5Repository</id>
5+
<version></version>
6+
<title>SharpRepository for EF5</title>
7+
<authors>Ben Griswold, Jeff Treuting, Fairway Technologies</authors>
8+
<owners>jtreuting, bgriswold</owners>
9+
<licenseUrl>https://github.com/SharpRepository/SharpRepository/blob/develop/license.txt</licenseUrl>
10+
<projectUrl>https://github.com/SharpRepository/SharpRepository</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>SharpRepository is a generic repository written in C# which includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDb and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, Memcache and standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits.</description>
13+
<releaseNotes>Initial release</releaseNotes>
14+
<copyright>Copyright 2012</copyright>
15+
<tags>SharpRepository Repository EF5 EntityFramework</tags>
16+
<dependencies>
17+
<dependency id="SharpRepository.Repository" version="1.0.0.1" />
18+
</dependencies>
19+
</metadata>
20+
</package>

nuget/SharpRepository.InMemoryRepository/SharpRepository.InMemoryRepository.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>SharpRepository.InMemoryRepository</id>
5-
<version>1.0.0.1</version>
5+
<version>1.0.0.211</version>
66
<title>SharpRepository for InMemory</title>
77
<authors>Ben Griswold, Jeff Treuting, Fairway Technologies</authors>
88
<owners>jtreuting, bgriswold</owners>
@@ -14,4 +14,4 @@
1414
<copyright>Copyright 2012</copyright>
1515
<tags>SharpRepository Repository InMemory</tags>
1616
</metadata>
17-
</package>
17+
</package>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>SharpRepository.InMemoryRepository</id>
5+
<version></version>
6+
<title>SharpRepository for InMemory</title>
7+
<authors>Ben Griswold, Jeff Treuting, Fairway Technologies</authors>
8+
<owners>jtreuting, bgriswold</owners>
9+
<licenseUrl>https://github.com/SharpRepository/SharpRepository/blob/develop/license.txt</licenseUrl>
10+
<projectUrl>https://github.com/SharpRepository/SharpRepository</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>SharpRepository is a generic repository written in C# which includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDb and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, Memcache and standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits.</description>
13+
<releaseNotes>Initial release</releaseNotes>
14+
<copyright>Copyright 2012</copyright>
15+
<tags>SharpRepository Repository InMemory</tags>
16+
</metadata>
17+
</package>

nuget/SharpRepository.Repository/SharpRepository.Repository.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package >
33
<metadata>
44
<id>SharpRepository.Repository</id>
5-
<version>1.0.0.1</version>
5+
<version>1.0.0.211</version>
66
<title>SharpRepository</title>
77
<authors>Ben Griswold, Jeff Treuting, Fairway Technologies</authors>
88
<owners>jtreuting, bgriswold</owners>
@@ -14,4 +14,4 @@
1414
<copyright>Copyright 2012</copyright>
1515
<tags>SharpRepository Repository</tags>
1616
</metadata>
17-
</package>
17+
</package>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<package >
3+
<metadata>
4+
<id>SharpRepository.Repository</id>
5+
<version></version>
6+
<title>SharpRepository</title>
7+
<authors>Ben Griswold, Jeff Treuting, Fairway Technologies</authors>
8+
<owners>jtreuting, bgriswold</owners>
9+
<licenseUrl>https://github.com/SharpRepository/SharpRepository/blob/develop/license.txt</licenseUrl>
10+
<projectUrl>https://github.com/SharpRepository/SharpRepository</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>SharpRepository is a generic repository written in C# which includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDb and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, Memcache and standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits.</description>
13+
<releaseNotes>Initial release</releaseNotes>
14+
<copyright>Copyright 2012</copyright>
15+
<tags>SharpRepository Repository</tags>
16+
</metadata>
17+
</package>

nuget/nuget-build.ps1

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Go through each directory in the current directory and build the nuget package for it
2+
# The user will be prompted for what version number to use
3+
4+
function Get-Directory([string[]]$path, [string[]]$include, [switch]$recurse)
5+
{
6+
Get-ChildItem -Path $path -Include $include -Recurse:$recurse | `
7+
Where-Object { $_.PSIsContainer }
8+
}
9+
10+
Write-Host "This will build all of the nuget packages in this directory"
11+
Write-Host ""
12+
13+
$cur_directory = $(Get-Location)
14+
$version_holder = "<version></version>"
15+
$new_version = Read-Host "What version number should we use? (e.g. 1.0.0.3)"
16+
17+
Write-Host ""
18+
19+
$directories = Get-Directory $(Get-Location), "SharpRepository.*" -recurse
20+
21+
foreach($directory in $directories)
22+
{
23+
$dir_fullname = $directory.fullname
24+
25+
Write-Host "Processing " $dir_fullname
26+
27+
$template_path = ($directory.fullname + "\" + $directory + ".nuspec.template")
28+
$nuspec_path = ($directory.fullname + "\" + $directory + ".nuspec")
29+
30+
# update the version number
31+
((Get-Content $template_path) -creplace $version_holder, ("<version>" + $new_version + "</version>")) | Set-Content $nuspec_path
32+
33+
# copy the nuspec file over to the main project directory because I only know how to create the nuget package from that diretory, but that's just me i think :)
34+
Copy-Item $nuspec_path "..\$directory\$directory.nuspec"
35+
36+
# build the nuget package
37+
#& "C\NuGet\nuget.exe pack ..\$directory\$directory.csproj -Prop Configuration=Release"
38+
Invoke-Expression "& `"nuget.exe`" pack ..\$directory\$directory.csproj -Prop Configuration=Release"
39+
40+
# move the nuget package back to the nuget directories
41+
Move-Item "$cur_directory\$directory.$new_version.nupkg" "$dir_fullname\$directory.$new_version.nupkg"
42+
43+
# delete the nuspec file from the project directory
44+
Remove-Item "..\$directory\$directory.nuspec"
45+
}
46+
47+
Read-Host -prompt "Finished. Press Enter key to exit"

0 commit comments

Comments
 (0)