Skip to content

Instantly share code, notes, and snippets.

View adoprog's full-sized avatar

Alexander Doroshenko adoprog

View GitHub Profile
@adoprog
adoprog / gist:5361702
Created April 11, 2013 08:26
Run Watin tests from PowerShell
$checkoutFolder = "%teamcity.build.workingDir%"
$targetDll = "$checkoutFolder\bin\Debug\%DLL containing tests here%"
$fixture = "%your namespace here%"
$resultXml = "$checkoutFolder\TestResult.xml"
$resultHtml = "$checkoutFolder\TestResults"
rm $resultXml -Force -Verbose
rm $resultHtml -Force -Verbose -Recurse
$buildOptions = "/xml:$resultXml /fixture:$fixture"
properties {
$buildFolder = Resolve-Path ..
$revision = "100500"
$buildNumber = "15"
}
task Package -depends Init, Upt, Zip
task Init {
# Copy Sitecore DLL's, etc.
@adoprog
adoprog / gist:5363165
Created April 11, 2013 12:58
Run psake script
Remove-Module [p]sake
Import-Module .\Tools\psake\psake.psm1
$psake.use_exit_on_error = $true
Invoke-psake .\package.ps1 Package -properties @{ revision = '%env.BUILD_VCS_NUMBER%'; }
@adoprog
adoprog / gist:5418727
Created April 19, 2013 07:34
Copy Sitecore files to solution.
properties {
$distributivePath = "%path to storage%\Sitecore 6.6.0 rev. 130111.zip"
$localStorage = "C:\LocalStorage"
$distributiveName = [System.IO.Path]::GetFileNameWithoutExtension($distributivePath)
$zipFile = "$localStorage\$distributiveName.zip"
$buildFolder = Resolve-Path ..
$revision = "12345"
$buildNumber = "1"
}
@adoprog
adoprog / gist:5442033
Created April 23, 2013 09:10
PowerCore Deployment
Clear-Host
# Framework initialization
$scriptRoot = Split-Path (Resolve-Path $myInvocation.MyCommand.Path)
$env:PSModulePath = $env:PSModulePath + ";$scriptRoot\Framework"
Import-Module WebUtils
Import-Module ConfigUtils
Import-Module DBUtils
Import-Module IISUtils
@adoprog
adoprog / gist:5442120
Created April 23, 2013 09:23
Installing Sitecore update package from code
var files = Directory.GetFiles(Server.MapPath("/sitecore/admin/Packages"), "*.update", SearchOption.AllDirectories);
Sitecore.Context.SetActiveSite("shell");
using (new SecurityDisabler())
{
using (new ProxyDisabler())
{
using (new SyncOperationContext())
{
foreach (var file in files)
{
@adoprog
adoprog / gist:5480127
Created April 29, 2013 07:00
Run nUnit tests from PowerShell
$checkoutFolder = "%teamcity.build.workingDir%"
$targetDll = "$checkoutFolder\Website\TestProject\bin\Release\TestProject.dll"
$fixture = "TestProject.MediaPlayerEditorTest"
$resultXml = "$checkoutFolder\TestResult.xml"
rm $resultXml -Force -Verbose -ErrorAction SilentlyContinue
$buildOptions = "/xml:$resultXml /fixture:$fixture"
$command = 'C:\Chocolatey\bin\nunit-console.bat "$targetDll" ' + $buildOptions
task Init {
if (-not (Test-Path $localStorage)) {
New-Item $localStorage -type directory -Verbose
}
if (-not (Test-Path $zipFile)) {
Copy-Item $distributivePath $zipFile -Verbose
}
if (-not (Test-Path $localStorage\$distributiveName)) {
task Compile {
exec { msbuild $buildFolder\Website\LaunchSitecore.sln /p:Configuration=Release /t:Clean }
exec { msbuild $buildFolder\Website\LaunchSitecore.sln /p:Configuration=Release /t:Build }
}
task Courier {
New-Item $buildFolder\Data\serialization_empty -type directory -force
& "$buildFolder\Buildscript\Tools\Courier\Sitecore.Courier.Runner.exe" /source:$buildFolder\Data\serialization_empty /target:$buildFolder\Data\serialization /output:$buildFolder\Website\sitecore\admin\Packages\LaunchSitecoreItems.update
}