This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
[assembly: AssemblyTitle("armenAnalytics")] | |
[assembly: AssemblyDescription("")] | |
[assembly: AssemblyConfiguration("")] | |
[assembly: AssemblyCompany("")] | |
[assembly: AssemblyProduct("armenAnalytics")] | |
[assembly: AssemblyCopyright("Copyright © 2014")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Task PatchAssemblyInfo{ | |
function GetAssemblyVersion { | |
#skip the details for now -> returns the version major.minor (e.g. "6.7") | |
} | |
function GetAssemblyFileVersion { | |
#skip the details for now -> returns the long version major.minor.build (e.g. "6.7.35698") | |
} | |
function PatchFile ([string] $pattern, [string] $replaceString, [string] $fullPath){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#load all targets | |
Get-ChildItem (Join-Path $PSScriptRoot -ChildPath "./targets") | ForEach-Object{ & $_.FullName } | |
Task Example -Depends PatchAssemblyInfo, RenameMSI { | |
Write-Host "Example target executed" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetRevisionNumber { | |
$major = "1" | |
$minor = "0" | |
#we use the environment variable BUILD_NUMBER provided by teamcity, use -1 is not found to test locally the process | |
$patch= if ([string]::IsNullOrEmpty($env:BUILD_NUMBER)) { "-1" } else { $env:BUILD_NUMBER } | |
$major + "." + $minor + "." + $patch | |
} | |
function PatchFile ([string] $pattern, [string] $replaceString, [string] $fullPath){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RegistryKey baseRegistryHklm; | |
RegistryKey baseRegistryHkcu; | |
if (Environment.Is64BitOperatingSystem) //Use OS not process... | |
{ | |
baseRegistryHklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64); | |
baseRegistryHkcu = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64); | |
} | |
else | |
{ | |
baseRegistryHklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Script for extractingn YAML of .html files. | |
#The extracted content is put in a directory YAMLS <websiteroot>/ignored/YAMLS | |
if(-Not (Test-Path (Join-Path $PSScriptRoot -ChildPath "ignored"))){ | |
throw "It is assumed that a directory ignored exists" | |
} | |
function ContainsYAML([string] $htmlFile){ | |
$lines = Get-Content $htmlFile | |
$lineCount = $lines.Length - 1 | |
$indices = (0 .. $lineCount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GitLog | |
{ | |
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Tree = | |
|Node of string*list<Tree ref> | |
|Empty | |
//create tree from a branch | |
let rec branchToTree (inputList:list<string>) = | |
match inputList with | |
| [] -> Tree.Empty | |
| head::tail -> Tree.Node (head, [ref (branchToTree tail)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let tree = ref Tree.Empty | |
let branch1 = ["a";"b";"c"] | |
let branch2 = ["a";"b";"d"] | |
let branch3 = ["a";"f"] | |
do mergeInto tree branch1 | |
do mergeInto tree branch2 | |
do mergeInto tree branch3 | |
//the following tree is created | |
// a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Tree = | |
| TreeNode of string* Tree list | |
| Empty | |
member this.GetLabel = | |
match this with | |
| Empty -> failwith "cannot get the label of an empty tree" | |
| TreeNode(lbl,_) -> lbl | |
//transform the branch into a tree | |
let rec branchToTree (inputList:list<string>) = |