View UpgradeTentacle.ps1
function Uninstall-OldTentacle { | |
Write-Output "Uninstalling the 1.0 Tentacle" | |
$app = Get-WmiObject -Query "SELECT * FROM Win32_Product WHERE Name = 'Octopus Deploy Tentacle' AND Version < 2.0" | |
$app.Uninstall() | |
& sc.exe delete "Octopus Tentacle" | |
} | |
function Upgrade-Tentacle |
View gulpfile.js
var fs = require('fs'); | |
var path = require('path'); | |
var es = require('event-stream'); | |
var gulp = require('gulp'); | |
var concat = require('gulp-concat'); | |
var rename = require('gulp-rename'); | |
var uglify = require('gulp-uglify'); | |
var scriptsPath = './src/scripts/'; |
View orderedDirectory.js
function readJson(file) { | |
return JSON.parse(fs.readFileSync(file, 'utf8')); | |
} | |
function getFilesInFolder(dir) { | |
console.log("Exploring " + dir); | |
return fs.readdirSync(dir) | |
.map(function(fileName) { | |
var filePath = path.join(dir, fileName); | |
var stat = fs.statSync(filePath); |
View HtmlRequestValidationModelBinder.cs
public class HtmlRequestValidationModelBinder : DefaultModelBinder | |
{ | |
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) | |
{ | |
try | |
{ | |
return base.BindModel(controllerContext, bindingContext); | |
} | |
catch (HttpRequestValidationException) | |
{ |
View AntiForgeryTokenFilter.cs
public class AntiForgeryTokenFilter : IAuthorizationFilter | |
{ | |
public void OnAuthorization(AuthorizationContext filterContext) | |
{ | |
if (IsHttpPostRequest(filterContext) && !SkipCsrfCheck(filterContext)) | |
AntiForgery.Validate(); | |
} | |
private static bool IsHttpPostRequest(AuthorizationContext filterContext) | |
{ |
View DateTimeExtensions.cs
public static DateTime AddWorkingDays(this DateTime date, int workingDaysToAdd, string countryCode = null) | |
{ | |
return AddWorkingDays(date, workingDaysToAdd, (dateToTest) => IsWorkingDay(dateToTest, countryCode)); | |
} | |
public static DateTime AddWorkingDays(this DateTime date, int workingDaysToAdd, Func<DateTime,bool> isWorkingDay) | |
{ | |
var sign = Math.Sign(workingDaysToAdd); | |
var unsignedDays = Math.Abs(workingDaysToAdd); | |
for (var i = 0; i < unsignedDays; i++) |
View Day1.hs
-- Question 1 | |
allEven :: [Integer] -> [Integer] | |
allEven [] = [] | |
allEven (h:t) = if even h then h:allEven t else allEven t | |
allEven2 :: [Integer] -> [Integer] | |
allEven2 list = [a | a <- list, even a] | |
-- Question 2 |
View build.fsx
Target "TestCoverage" (fun _ -> | |
let filters = "-:*.Tests;" # exclude test assemblies from coverage stats | |
# run NUnit tests via dotCover | |
!! testAssemblies | |
|> DotCoverNUnit (fun p -> { p with | |
Output = artifactsDir @@ "NUnitDotCover.snapshot" | |
Filters = filters }) nunitOptions | |
# run the MSpec tests via dotCover | |
!! testAssemblies |
View ndepend.fsx
module Fake.NDepend | |
open Fake | |
open System | |
open System.IO | |
open System.Text | |
let getWorkingDir workingDir = | |
Seq.find isNotNullOrEmpty [workingDir; environVar("teamcity.build.workingDir"); "."] | |
|> Path.GetFullPath |
OlderNewer