Skip to content

Instantly share code, notes, and snippets.

@JonCubed
Created November 15, 2017 10:30
Show Gist options
  • Save JonCubed/e2de228fa18537a350653d68057992b1 to your computer and use it in GitHub Desktop.
Save JonCubed/e2de228fa18537a350653d68057992b1 to your computer and use it in GitHub Desktop.
temp.cake
#addin nuget:D:\packages?package=Cake.Microsoft.Extensions.Configuration&version=0.1.0-alpha015&loaddependencies=true&prerelease
#addin "nuget:?package=Cake.Incubator&version=1.6.0&loaddependencies=true"
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
MySettings settings;
private class MySettings
{
public ICollection<NuGetSource> NuGetSources { get; set; } = new List<NuGetSource>();
internal class NuGetSource
{
public NuGetSource()
{
IsSensitiveSource = true;
}
public string Name { get; set; }
public string SourceUrl { get; set; }
public string Credential_Usr { get; set; }
public string Credential_Psw { get; set; }
public bool IsSensitiveSource { get; set; }
public bool StorePasswordInClearText { get; set; }
}
}
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(ctx =>
{
#break
settings = GetConfiguration<MySettings>();
});
Teardown(ctx =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.Does(() => {
Information($"There are {settings.NuGetSources.Count()} items");
Information($"NuGetSources:");
foreach(var item in settings.NuGetSources)
{
Information($"{item.Dump()}");
}
});
RunTarget("Default");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment