Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
ignore semver'd files (see #12)
Browse files Browse the repository at this point in the history
  • Loading branch information
staxmanade committed Jul 30, 2014
1 parent 20b2f0f commit 8a53325
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions CreatePackages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,46 @@ param(

# https://github.com/borisyankov/DefinitelyTyped.git

<# test code (used to test the semver implementation)
function testSemver($expected, $packageName, $fileName) {
$actual = isSemverFile $packageName $fileName
if($actual -ne $expected) {
throw "Expected $file to return $expected - but got $actual"
}
}
testSemver $true "jquery" "jquery-1.2.0.d.ts"
testSemver $true "jquery" "jquery-1.2.0.d.ts"
testSemver $true "jquery" "jquery-1.2.0-beta.d.ts"
testSemver $false "jquery" "jquery.d.ts"
testSemver $false "jquery" "jquery-bar.d.ts"
#>

$nuget = (get-item ".\tools\NuGet.CommandLine.2.2.1\tools\NuGet.exe")
$packageIdFormat = "{0}.TypeScript.DefinitelyTyped"
$nuspecTemplate = get-item ".\PackageTemplate.nuspec"


function isSemverFile($packageName, $fileName) {

#write-host "*************"
#write-host $fileName
#write-host "$packageName-[0-9]+\.[0-9]\+(.*)\.d\.ts"
#write-host "*************"

if( $fileName -match "$packageName-[0-9]+\.[0-9]+(.*)\.d\.ts") {
write-host "Excluding semver file $fileName..."
return $true
}
return $false

}

function Get-MostRecentNugetSpec($nugetPackageId) {
$feeedUrl= "http://packages.nuget.org/v1/FeedService.svc/Packages()?`$filter=Id%20eq%20'$nugetPackageId'&`$orderby=Version%20desc&`$top=1"
$webClient = new-object System.Net.WebClient
Expand Down Expand Up @@ -134,7 +170,9 @@ function Create-Package($packagesAdded, $newCommitHash) {
$packageName = $dir.Name
$packageId = $packageIdFormat -f $packageName

$tsFiles = ls $dir -recurse -include *.d.ts | Where-Object {$_.FullName -notMatch "legacy"}
$tsFiles = ls $dir -recurse -include *.d.ts | `
Where-Object {$_.FullName -notMatch "legacy"} | `
Where-Object { !(isSemverFile $packageName $_.Name) }

if(!($tsFiles)) {
return;
Expand Down Expand Up @@ -264,6 +302,7 @@ else {
$allPackageDirectories = ls .\Definitions\* | ?{ $_.PSIsContainer }
}


# Clean the build directory
if(test-path build) {
rm build -recurse -force -ErrorAction SilentlyContinue
Expand All @@ -275,7 +314,7 @@ pushd build
$packagesUpdated = New-Object Collections.Generic.List[string]

# Filter out already published packages if we already have a LAST_PUBLISHED_COMMIT
if($lastPublishedCommitReference -ne $null) {
if($lastPublishedCommitReference -ne $null -and !$specificPackages) {
$packageDirectories = $allPackageDirectories | where { $projectsToUpdate -contains $_.Name }
}
else {
Expand Down

0 comments on commit 8a53325

Please sign in to comment.