Skip to content

Commit

Permalink
Ignore Example.cs in project
Browse files Browse the repository at this point in the history
This enables us to:
- Directly build the exercises from the command-line
- Simplify the build script
  • Loading branch information
ErikSchierboom committed Feb 21, 2017
1 parent 5a8fc26 commit 4300f5c
Show file tree
Hide file tree
Showing 105 changed files with 424 additions and 19 deletions.
27 changes: 8 additions & 19 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

open Fake
open Fake.DotNetCli
open System.Text

let project = environVarOrDefault "project" "*"
let buildDir = "./build/"
Expand All @@ -11,7 +12,7 @@ let projectDirs = buildDir @@ project
let testFiles = !! (projectDirs @@ "*Test.cs")
let allProjects = !! (projectDirs @@ "*.csproj")
let defaultProjects =
!! (projectDirs @@ ".csproj") --
!! (projectDirs @@ "*.csproj") --
(projectDirs @@ "DotDsl.csproj") --
(projectDirs @@ "Hangman.csproj") --
(projectDirs @@ "React.csproj")
Expand Down Expand Up @@ -40,22 +41,13 @@ Target "CopyExercises" (fun _ ->
CopyDir buildDir sourceDir allFiles
)

Target "IgnoreExampleImplementation" (fun _ ->
RegexReplaceInFilesWithEncoding
"</PropertyGroup>"
"</PropertyGroup><ItemGroup><Compile Remove=\"Example.cs\" /></ItemGroup>"
System.Text.Encoding.UTF8 allProjects
)

Target "BuildUsingStubImplementation" (fun _ ->
Seq.iter restoreAndBuild defaultProjects
)

Target "EnableAllTests" (fun _ ->
RegexReplaceInFilesWithEncoding
"Skip\s*=\s*\"Remove to run test\""
""
System.Text.Encoding.UTF8 testFiles
let skipProperty = "Skip\s*=\s*\"Remove to run test\""
RegexReplaceInFilesWithEncoding skipProperty "" Encoding.UTF8 testFiles
)

Target "TestRefactoringProjects" (fun _ ->
Expand All @@ -64,11 +56,9 @@ Target "TestRefactoringProjects" (fun _ ->

Target "ReplaceStubWithExampleImplementation" (fun _ ->
let replaceStubWithExampleImplementation project =
let projectDir = directory project
let stubFile = projectDir @@ filename project + "" |> changeExt ".cs"
let exampleFile = projectDir @@ "Example.cs"

CopyFile stubFile exampleFile
let stubFile = filename project + "" |> changeExt ".cs"
let exampleFile = "Example.cs"
RegexReplaceInFileWithEncoding exampleFile stubFile Encoding.UTF8 project

Seq.iter replaceStubWithExampleImplementation allProjects
)
Expand All @@ -79,11 +69,10 @@ Target "TestUsingExampleImplementation" (fun _ ->

"Clean"
==> "CopyExercises"
==> "IgnoreExampleImplementation"
==> "BuildUsingStubImplementation"
==> "EnableAllTests"
==> "TestRefactoringProjects"
==> "ReplaceStubWithExampleImplementation"
==> "TestUsingExampleImplementation"

RunTargetOrDefault "TestUsingExampleImplementation"
RunTargetOrDefault "TestUsingExampleImplementation"
4 changes: 4 additions & 0 deletions exercises/accumulate/Accumulate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/acronym/Acronym.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/all-your-base/AllYourBase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/allergies/Allergies.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/alphametics/Alphametics.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/anagram/Anagram.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/atbash-cipher/AtbashCipher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/bank-account/BankAccount.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/beer-song/BeerSong.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/binary-search-tree/BinarySearchTree.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/binary-search/BinarySearch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/bob/Bob.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/book-store/BookStore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/bowling/Bowling.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/bracket-push/BracketPush.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/change/Change.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/circular-buffer/CircularBuffer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/clock/Clock.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/connect/Connect.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/crypto-square/CryptoSquare.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/custom-set/CustomSet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/diamond/Diamond.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/difference-of-squares/DifferenceOfSquares.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/diffie-hellman/DiffieHellman.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/dominoes/Dominoes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/dot-dsl/DotDsl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/error-handling/ErrorHandling.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/etl/Etl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
4 changes: 4 additions & 0 deletions exercises/flatten-array/FlattenArray.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<TargetFramework>netcoreapp1.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Example.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170217-05" />
<PackageReference Include="xunit" Version="2.2.0-rc4-build3536" />
Expand Down
Loading

0 comments on commit 4300f5c

Please sign in to comment.