From 5944074c2a343ddcf349313e91a224208201eafa Mon Sep 17 00:00:00 2001 From: Elijah Date: Sat, 18 Nov 2017 15:22:52 +0200 Subject: [PATCH 1/2] fix choco.pack - remove duplicate additional arguments - add Force option to ChocoPushParams --- src/app/Fake.Windows.Chocolatey/Chocolatey.fs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/Fake.Windows.Chocolatey/Chocolatey.fs b/src/app/Fake.Windows.Chocolatey/Chocolatey.fs index 38598244ef0..cdcd0502c06 100644 --- a/src/app/Fake.Windows.Chocolatey/Chocolatey.fs +++ b/src/app/Fake.Windows.Chocolatey/Chocolatey.fs @@ -218,6 +218,9 @@ module Fake.Windows.Choco /// Do not prompt for user input or confirmations. Default `true`. /// Equivalent to the `-y` option. NonInteractive: bool + /// Force - force the behavior. Do not use force during normal operation - + /// it subverts some of the smart behavior for commands. + Force: bool } type private NuspecData = { @@ -319,6 +322,7 @@ module Fake.Windows.Choco ApiKey = null ToolPath = null AdditionalArgs = null + Force = false } let private getPaths = @@ -822,7 +826,8 @@ module Fake.Windows.Choco |> appendWithoutQuotesIfNotNull parameters.Source "--source " |> appendWithoutQuotesIfNotNull parameters.ApiKey "--apikey " |> appendIfTrueWithoutQuotes parameters.NonInteractive "-y" - |> appendWithoutQuotesIfNotNull parameters.AdditionalArgs parameters.AdditionalArgs + |> appendIfTrueWithoutQuotes parameters.Force "--force" + |> appendIfTrueWithoutQuotes (parameters.AdditionalArgs |> String.isNotNullOrEmpty) parameters.AdditionalArgs |> toText callChoco parameters.ToolPath args parameters.Timeout From bb60fb31dc1bc1c93b93fde6644f5170ba4370e2 Mon Sep 17 00:00:00 2001 From: Elijah Date: Mon, 20 Nov 2017 11:03:10 +0200 Subject: [PATCH 2/2] add ChocoCall funciton - fixed Force description --- src/app/Fake.Windows.Chocolatey/Chocolatey.fs | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/app/Fake.Windows.Chocolatey/Chocolatey.fs b/src/app/Fake.Windows.Chocolatey/Chocolatey.fs index cdcd0502c06..ac23ccd575c 100644 --- a/src/app/Fake.Windows.Chocolatey/Chocolatey.fs +++ b/src/app/Fake.Windows.Chocolatey/Chocolatey.fs @@ -218,8 +218,10 @@ module Fake.Windows.Choco /// Do not prompt for user input or confirmations. Default `true`. /// Equivalent to the `-y` option. NonInteractive: bool - /// Force - force the behavior. Do not use force during normal operation - - /// it subverts some of the smart behavior for commands. + /// Force - force the behavior. Do not use force during normal operation - + /// it subverts some of the smart behavior for commands. Maybe used for pushing + /// packages ot insecure private feeds. Default `false`. + /// Equivalent to the `--force` option. Force: bool } @@ -831,3 +833,26 @@ module Fake.Windows.Choco |> toText callChoco parameters.ToolPath args parameters.Timeout + + /// Call custom choco command + /// ## Parameters + /// - `args` - string that will be appendedn to choco.exe call + /// - `timeout` - parrent process maximum completion time + /// ## Sample usage + /// + /// Target "ChocoPush" (fun _ -> + /// + /// let newSpecFile = ... + /// let args = + /// new StringBuilder() + /// |> append "pack" + /// |> append newSpecFile + /// |> append "-y" + /// |> toText + /// + /// args |> Choco.CallChoco TimeSpan.FromMinutes 1. + /// ) + let CallChoco args timeout = + if args |> isNullOrEmpty then failwith "'args' must not be empty." + + callChoco null args timeout