Giter Site home page Giter Site logo

link-code / cake.powershell Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sharperad/cake.powershell

0.0 0.0 0.0 3.08 MB

Powershell addin for Cake

Home Page: http://cakebuild.net

License: MIT License

Batchfile 0.27% PowerShell 9.42% C# 87.84% Shell 2.47%

cake.powershell's Introduction

Cake.Powershell

Cake-Build addin that extends Cake with Powershell commands

cakebuild.net

Join the chat at https://gitter.im/cake-build/cake

Table of contents

  1. Implemented functionality
  2. Continuous integration
  3. Referencing
  4. Usage
  5. Example
  6. TroubleShooting
  7. Plays well with
  8. License
  9. Share the love

Implemented functionality

  • Local / remote scripts
  • Script files
  • Download and run remote script file
  • Script parameters
  • Outputting to the cake console

Continuous integration

Build server Platform Build status
AppVeyor Windows AppVeyor
Travis Linux / MacOS Travis

Referencing

NuGet Version NuGet Downloads

Cake.Powershell is available as a nuget package from the package manager console:

Install-Package Cake.Powershell

or directly in your build script via a cake addin directive:

#addin "Cake.Powershell"

Usage

#addin "Cake.Powershell"

Task("Powershell-Script")
    .Description("Run an example powershell command with parameters")
    .Does(() =>
{
    StartPowershellScript("Write-Host", args =>
        {
            args.AppendQuoted("Testing...");
        });
});

Task("Powershell-Script-Settings")
    .Description("Run an example powershell command with settings and parameters")
    .Does(() =>
{
    StartPowershellScript("Get-Process", new PowershellSettings()
        .SetFormatOutput()
        .SetLogOutput()
        .WithArguments(args =>
        {
            args.AppendQuoted("svchost");
        }));
});


Task("Powershell-File")
    .Description("Run an example powershell script file with parameters")
    .Does(() =>
{
    StartPowershellFile("../Scripts/Install.ps1", args =>
        {
            args.Append("Username", "admin")
                .AppendSecret("Password", "pass1");
        });
});

Task("Powershell-File-Settings")
    .Description("Run an example powershell script file with settings and parameters")
    .Does(() =>
{
    StartPowershellFile("../Scripts/sql.ps1", new PowershellSettings()
        .WithModule("sqlps")
        .WithArguments(args =>
        {
            args.Append("Username", "admin")
                .AppendSecret("Password", "pass1");
        }));
});


Task("Powershell-Remote-Script")
    .Description("Run an example powershell command remotely")
    .Does(() =>
{
    StartPowershellScript("Get-Services", new PowershellSettings()
    {
        ComputerName = "remote-location",
        Username = "admin",
        Password = "pass1",

        FormatOutput = true,
        LogOutput = true
    });
});

Task("Powershell-Remote-File")
    .Description("Run an example powershell file remotely")
    .Does(() =>
{
    StartPowershellFile("C:/Scripts/sql.ps1", new PowershellSettings()
        {
            ComputerName = "remote-location",
            Username = "admin",
            Password = "pass1",

            FormatOutput = true,
            LogOutput = true
        }.WithArguments(args =>
        {
            args.Append("task", "do-what-i-say");
        }));
});



Task("Powershell-Download")
    .Description("Run an example powershell script file after downloading its contents to a local directory")
    .Does(() =>
{
    StartPowershellDownload("https://chocolatey.org/install.ps1", "C:/Temp/install.ps1", new PowershellSettings());
});

RunTarget("Powershell-Script");

Example

A complete Cake example can be found here.

TroubleShooting

  • Please be aware of the breaking changes that occurred with the release of Cake v0.22.0, you will need to upgrade Cake in order to use Cake.Powershell v0.4.0 or above.

A few pointers for correctly enabling powershell scripting can be found here.

Plays well with

If your looking for a way to trigger cake tasks based on windows events or at scheduled intervals then check out CakeBoss.

License

Copyright (c) 2015 - 2016 Phillip Sharpe

Cake.Powershell is provided as-is under the MIT license. For more information see LICENSE.

Share the love

If this project helps you in anyway then please โญ the repository.

cake.powershell's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.