diff --git a/src/app/FakeLib/SquirrelHelper.fs b/src/app/FakeLib/SquirrelHelper.fs index c364b1fae0e..afe712b4320 100644 --- a/src/app/FakeLib/SquirrelHelper.fs +++ b/src/app/FakeLib/SquirrelHelper.fs @@ -23,6 +23,9 @@ type SquirrelParams = /// The full path to an optional animated gif to be displayed during installation LoadingGif : string option + /// The full path to an optional icon, which will be used for the generated installer. + SetupIcon : string option + /// The path to Squirrel: `squirrel.exe` ToolPath : string @@ -36,7 +39,7 @@ type SquirrelParams = SigningKeyFile : string option /// The secret key for the code signing certificate - SigningSecret : string option} + SigningSecret : string option } /// The Squirrel default parameters. /// @@ -46,6 +49,7 @@ type SquirrelParams = /// - `WorkingDir` - `None` /// - `BootstrapperExe` - `None` /// - `LoadingGif` - `None` +/// - `SetupIcon` - `None` /// - `ToolPath` - The `squirrel.exe` path if it exists in a subdirectory of the current directory. /// - `TimeOut` - 10 minutes /// - `SignExecutable` - `None` @@ -58,6 +62,7 @@ let SquirrelDefaults = WorkingDir = None BootstrapperExe = None LoadingGif = None + SetupIcon = None ToolPath = findToolInSubPath toolname (currentDirectory @@ "tools" @@ "Squirrel") TimeOut = TimeSpan.FromMinutes 10. SignExecutable = None @@ -66,19 +71,20 @@ let SquirrelDefaults = let private createSigningArgs (parameters : SquirrelParams) = new StringBuilder() - |> appendWithoutQuotes "--signWithParams=\"/a" + |> appendWithoutQuotes "--signWithParams=\"" |> appendWithoutQuotes "/a" |> appendIfSome parameters.SigningKeyFile (sprintf "/f %s") |> appendIfSome parameters.SigningSecret (sprintf "/p %s") |> appendWithoutQuotes "\"" |> toText -let internal buildSquirrelArgs parameters nugetPackage= +let internal buildSquirrelArgs parameters nugetPackage = new StringBuilder() |> appendIfNotNullOrEmpty nugetPackage "--releasify=" |> appendIfNotNullOrEmpty parameters.ReleaseDir "--releaseDir=" - |> appendIfSome parameters.LoadingGif (sprintf "--loadingGif= %s") - |> appendIfSome parameters.BootstrapperExe (sprintf "--bootstrapperExe= %s") + |> appendIfSome parameters.LoadingGif (sprintf "\"--loadingGif=%s\"") + |> appendIfSome parameters.SetupIcon (sprintf "\"--setupIcon=%s\"") + |> appendIfSome parameters.BootstrapperExe (sprintf "\"--bootstrapperExe=%s\"") |> appendIfSome parameters.SignExecutable (fun s -> createSigningArgs parameters) |> toText diff --git a/src/test/Test.FAKECore/SquirrelHelperSpec.cs b/src/test/Test.FAKECore/SquirrelHelperSpec.cs index 142f1c64863..077a0725893 100644 --- a/src/test/Test.FAKECore/SquirrelHelperSpec.cs +++ b/src/test/Test.FAKECore/SquirrelHelperSpec.cs @@ -13,14 +13,12 @@ namespace Test.FAKECore.SquirrelHelperSpec internal abstract class BuildArgumentsSpecsBase { protected static Squirrel.SquirrelParams Parameters; - protected static string[] Assemblies; protected static string Arguments; protected static string NuGetPackage = "my.nuget"; Establish context = () => { Parameters = Squirrel.SquirrelDefaults; - Assemblies = new[] { "test.dll", "other.dll" }; }; Because of = () => @@ -33,9 +31,10 @@ internal abstract class BuildArgumentsSpecsBase internal class When_using_the_default_parameters : BuildArgumentsSpecsBase { - It should_not_include_releasify = () => Arguments.ShouldContain("--releasify=" + NuGetPackage); + It should_include_releasify = () => Arguments.ShouldContain("--releasify=" + NuGetPackage); It should_not_include_releasedir = () => Arguments.ShouldNotContain("--releaseDir="); It should_not_include_loading_gif = () => Arguments.ShouldNotContain("--loadingGif="); + It should_not_include_setup_icon = () => Arguments.ShouldNotContain("--setupIcon="); It should_not_include_bootstrapper_exe = () => Arguments.ShouldNotContain("--bootstrapperExe="); } @@ -60,8 +59,16 @@ internal class When_specifying_loading_gif const string LoadingGif = "spinner.gif"; Establish context = () => Parameters = Parameters.With(p => p.LoadingGif, FSharpOption.Some(LoadingGif)); - It should_include_loading_gif_param = () => Arguments.ShouldContain("--loadingGif="); - It should_include_loading_gif_file = () => Arguments.ShouldContain(LoadingGif); + It should_include_loading_gif_param = () => Arguments.ShouldContain("--loadingGif=" + LoadingGif); + } + + internal class When_specifying_setup_icon + : BuildArgumentsSpecsBase + { + const string SetupIcon = "setup.ico"; + Establish context = () => Parameters = Parameters.With(p => p.SetupIcon, FSharpOption.Some(SetupIcon)); + + It should_include_setup_icon = () => Arguments.ShouldContain("--setupIcon=" + SetupIcon); } internal class When_specifying_bootstrapper_exe @@ -70,8 +77,7 @@ internal class When_specifying_bootstrapper_exe const string BootstrapperExe = "bootstrap.exe"; Establish context = () => Parameters = Parameters.With(p => p.BootstrapperExe, FSharpOption.Some(BootstrapperExe)); - It should_include_bootstrapper_param = () => Arguments.ShouldContain("--bootstrapperExe="); - It should_include_bootstrapper_file = () => Arguments.ShouldContain(BootstrapperExe); + It should_include_bootstrapper_param = () => Arguments.ShouldContain("--bootstrapperExe=" + BootstrapperExe); } internal class When_requesting_package_signing_with_default_parameters