Merge branch 'upstream' into dev-whitespace

Conflicts:
	test/00-Project.Tests.ps1
This commit is contained in:
Roy Ivy III
2015-08-31 17:29:33 -07:00
2 changed files with 75 additions and 0 deletions

21
bucket/pcregrep.json Normal file
View File

@@ -0,0 +1,21 @@
{
"homepage": "http://pcre.org",
"version": "10.20",
"license": "BSD",
"architecture": {
"32bit": {
"url": "https://github.com/rivy/PCRE/releases/download/10.20/pcre2grep-10.20-x32.zip"
,"hash": "a07c0d43132855bf350d85f71a9ee781d0e62721cd9053f1ff2894c52f4cfd85"
},
"64bit": {
"url": "https://github.com/rivy/PCRE/releases/download/10.20/pcre2grep-10.20-x64.zip"
,"hash": "6b69d123b9e09e288f12e828f4a827e2bec59991e743802287c389fbbc99f54d"
}
},
"bin": [
"pcre2grep.exe"
,"pcre2test.exe"
,[ "pcre2grep.exe", "pcregrep" ]
,[ "pcre2test.exe", "pcretest" ]
]
}

View File

@@ -1,5 +1,59 @@
$repo_dir = (Get-Item $MyInvocation.MyCommand.Path).directory.parent.FullName
describe 'Project code' {
$files = @(
Get-ChildItem $repo_dir -file -recurse -force | ? { $_.fullname -match '.(ps1|psm1)$' }
)
function Test-PowerShellSyntax {
# ref: http://powershell.org/wp/forums/topic/how-to-check-syntax-of-scripts-automatically @@ https://archive.is/xtSv6
# originally created by Alexander Petrovskiy & Dave Wyatt
[CmdletBinding()]
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true)]
[string[]]
$Path
)
process {
foreach ($scriptPath in $Path) {
$contents = Get-Content -Path $scriptPath
if ($null -eq $contents) {
continue
}
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
New-Object psobject -Property @{
Path = $scriptPath
SyntaxErrorsFound = ($errors.Count -gt 0)
}
}
}
}
it 'PowerShell files do not contain syntax errors' {
$badFiles = @(
foreach ($file in $files)
{
if ( (Test-PowerShellSyntax $file.FullName).SyntaxErrorsFound )
{
$file.FullName
}
}
)
if ($badFiles.Count -gt 0)
{
throw "The following files have syntax errors: `r`n`r`n$($badFiles -join "`r`n")"
}
}
}
describe 'Project style constraints' {
$files = @(