This repository has been archived by the owner on Mar 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from johan-v-r/arg-options
Arg options
- Loading branch information
Showing
19 changed files
with
203 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<!-- https://natemcmaster.com/blog/2017/11/11/build-tools-in-nuget/ --> | ||
<PropertyGroup> | ||
<SassExe Condition=" '$(SassExe)'=='' ">$(MSBuildThisFileDirectory)../tool/LibSassBuilder.dll</SassExe> | ||
<LibSassBuilderArgs Condition=" '$(LibSassBuilderArgs)'=='' "></LibSassBuilderArgs> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,5 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<!-- https://natemcmaster.com/blog/2017/11/11/build-tools-in-nuget/ --> | ||
<PropertyGroup> | ||
<SassExe Condition=" '$(SassExe)'=='' ">$(MSBuildThisFileDirectory)../tool/LibSassBuilder.dll</SassExe> | ||
</PropertyGroup> | ||
|
||
<Target Name="SassBuild" BeforeTargets="PreBuildEvent"> | ||
<Exec Command="dotnet "$(SassExe)"" /> | ||
<Exec Command="dotnet "$(SassExe)" $(LibSassBuilderArgs)" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.IO; | ||
using Xunit; | ||
|
||
namespace LibSassBuilder.DirectoryTests | ||
{ | ||
// This project is configured to run LibSassBuilder in LibSassBuilder.DirectoryTests.csproj within ./logs directory | ||
public class DirectoryTests | ||
{ | ||
private readonly string _fileDirectory; | ||
|
||
public DirectoryTests() | ||
{ | ||
_fileDirectory = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; | ||
} | ||
|
||
[Fact] | ||
public void ExplicitDirectoryTest() | ||
{ | ||
var barFile = Path.Join(_fileDirectory, "foo/bar.css"); | ||
var binFile = Path.Join(_fileDirectory, "logs/bin/bin-file.css"); | ||
var logsFile = Path.Join(_fileDirectory, "logs/logs-file.css"); | ||
|
||
Assert.False(File.Exists(barFile)); // not in ./logs directory | ||
Assert.False(File.Exists(binFile)); // inside ./logs, but excluded by default nested bin folder | ||
Assert.True(File.Exists(logsFile)); // inside ./logs | ||
|
||
File.Delete(logsFile); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/LibSassBuilder.DirectoryTests/LibSassBuilder.DirectoryTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="1.3.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> | ||
<Exec Command="dotnet run --project ../LibSassBuilder ./logs" /> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
color: black; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
body { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
body { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System.IO; | ||
using Xunit; | ||
|
||
namespace LibSassBuilder.ExcludeTests | ||
{ | ||
// This project is configured to run LibSassBuilder in LibSassBuilder.DirectoryTests.csproj excluding foo & bar directories | ||
public class ExcludeTests | ||
{ | ||
private readonly string _fileDirectory; | ||
|
||
public ExcludeTests() | ||
{ | ||
_fileDirectory = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.FullName; | ||
} | ||
|
||
[Fact] | ||
public void ExcludeFooFilesTest() | ||
{ | ||
var fooFile = Path.Join(_fileDirectory, "foo/foo.css"); | ||
var barFile = Path.Join(_fileDirectory, "bar/bar.css"); | ||
var testFile = Path.Join(_fileDirectory, "test.css"); | ||
|
||
Assert.False(File.Exists(fooFile)); // excluded foo | ||
Assert.False(File.Exists(barFile)); // excluded bar | ||
Assert.True(File.Exists(testFile)); | ||
|
||
File.Delete(testFile); | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/LibSassBuilder.ExcludeTests/LibSassBuilder.ExcludeTests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="1.3.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> | ||
<Exec Command="dotnet run --project ../LibSassBuilder -e foo bar" /> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
color: black; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
color: black; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
color: black; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using CommandLine; | ||
using System.Collections.Generic; | ||
|
||
namespace LibSassBuilder | ||
{ | ||
public class Options | ||
{ | ||
[Value(0, Required = false, HelpText = "Directory in which to run. Defaults to current directory.")] | ||
public string Directory { get; set; } = System.IO.Directory.GetCurrentDirectory(); | ||
|
||
[Option('e', "exclude", Required = false, HelpText = "Specify explicit directories to exclude. Overrides the default.", Default = new[] { "bin", "obj", "logs", "node_modules" })] | ||
public IEnumerable<string> ExcludedDirectories { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters