Skip to content

Commit

Permalink
Merge pull request #2055 from kblohm/fixTemplate
Browse files Browse the repository at this point in the history
Fix the template version
  • Loading branch information
matthid authored Aug 11, 2018
2 parents 6821684 + c6efb14 commit 2bcfe48
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
14 changes: 0 additions & 14 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -694,17 +694,6 @@ Target.create "_DotNetPackage" (fun _ ->
Environment.setEnvironVar "PackageProjectUrl" "https://github.com/fsharp/Fake"
Environment.setEnvironVar "PackageLicenseUrl" "https://github.com/fsharp/FAKE/blob/d86e9b5b8e7ebbb5a3d81c08d2e59518cf9d6da9/License.txt"

// Update template
let templateFromVersion, templateToVersion = """"defaultValue": "5.*",""", sprintf """"defaultValue": "%s",""" nugetVersion
let templateConfigFile = "src/template/fake-template/Content/.template.config/template.json"
let replaceInTemplate fromDefault toDefault =
[ templateConfigFile ]
|> Shell.replaceInFiles [ fromDefault, toDefault ]
let configContents = File.ReadAllText(templateConfigFile)
if not <| configContents.Contains templateFromVersion then
failwithf "Make sure to revert your changes in '%s' or update the build script accordingly" templateConfigFile
replaceInTemplate templateFromVersion templateToVersion

// dotnet pack
DotNet.pack (fun c ->
{ c with
Expand All @@ -716,9 +705,6 @@ Target.create "_DotNetPackage" (fun _ ->
else c.Common
} |> dtntSmpl) "Fake.sln"

// Revert template
replaceInTemplate templateToVersion templateFromVersion

// TODO: Check if we run the test in the current build!
Directory.ensure "temp"
let testZip = "temp/tests.zip"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"type": "parameter",
"description": "Version of FAKE to install. This parameter is only applicable when either 'tool' or 'project' is used for bootstrapping",
"dataType": "string",
"defaultValue": "5.*",
"defaultValue": "latest",
"replaces": "(version)"
}
},
Expand Down Expand Up @@ -105,4 +105,4 @@
},
"continueOnError": false
}]
}
}
4 changes: 4 additions & 0 deletions src/template/fake-template/Content/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<!--#if (version == "latest") -->
<DotNetCliToolReference Include="dotnet-fake" Version="*" />
<!--#else-->
<DotNetCliToolReference Include="dotnet-fake" Version="(version)" />
<!--#endif-->
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/template/fake-template/Content/fake.tool.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
SET TOOL_PATH=(ToolPath)

IF NOT EXIST "%TOOL_PATH%\fake.exe" (
rem #if (version == "latest")
dotnet tool install fake-cli --tool-path ./%TOOL_PATH%
rem #else
dotnet tool install fake-cli --tool-path ./%TOOL_PATH% --version (version)
rem #endif
)

"%TOOL_PATH%/fake.exe" %*
4 changes: 4 additions & 0 deletions src/template/fake-template/Content/fake.tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ FAKE="$TOOL_PATH"/fake

if ! [ -e "$FAKE" ]
then
#if (version == "latest")
dotnet tool install fake-cli --tool-path "$TOOL_PATH"
#else
dotnet tool install fake-cli --tool-path "$TOOL_PATH" --version (version)
#endif
fi
"$FAKE" "$@"

0 comments on commit 2bcfe48

Please sign in to comment.