-
Notifications
You must be signed in to change notification settings - Fork 0
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 paralexm/master
Changed branding, filename comparer and added readme
- Loading branch information
Showing
17 changed files
with
145 additions
and
106 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,55 @@ | ||
# Vertiq | ||
# Vertiq.BTool | ||
|
||
**Vertiq.BTool** is a dotnet global tool | ||
that enables fast and efficient build script execution from any location on the commandline. | ||
|
||
## Description | ||
|
||
Whenever you need to locate and execute a build script within a repo subdirectory, Vertiq.BTool is there to help. | ||
Simply issue `b` command, | ||
and it will search the current directory and its subfolders for your build script, and execute it. | ||
No more navigating to build scripts! | ||
|
||
## Installation | ||
|
||
Download and install one of the currently supported [.NET SDKs](https://www.microsoft.com/net/download). | ||
Once installed, you can install the tool globally using the following command: | ||
|
||
```shell | ||
dotnet tool install --global vertiq.btool | ||
``` | ||
|
||
### Update | ||
|
||
If you already have a previous version of **Vertiq.BTool** installed, | ||
you can upgrade to the latest version using the following command: | ||
|
||
```shell | ||
dotnet tool update --global vertiq.btool | ||
``` | ||
|
||
### Uninstall | ||
|
||
If you want to remove the tool, you can do it using the following command: | ||
|
||
```shell | ||
dotnet tool uninstall --global vertiq.btool | ||
``` | ||
|
||
## Usage | ||
|
||
Running `b` without any parameters will locate and execute the build script in its default mode. | ||
|
||
```shell | ||
b | ||
``` | ||
|
||
All command-line arguments are passed to the build script. | ||
|
||
```shell | ||
b --configuration=Release --platform=x64 | ||
``` | ||
|
||
## Contributing | ||
|
||
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. |
5 changes: 1 addition & 4 deletions
5
Xenial.BTool.Tests/BuildExecutorTests.cs → Vertiq.BTool.Tests/BuildExecutorTests.cs
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
2 changes: 1 addition & 1 deletion
2
Xenial.BTool.Tests/IgnoreUnixFact.cs → Vertiq.BTool.Tests/IgnoreUnixFact.cs
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
File renamed without changes.
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,48 @@ | ||
using System.IO.Abstractions; | ||
|
||
namespace Vertiq.BTool; | ||
|
||
public sealed record BuildLocator(IFileSystem FileSystem) | ||
{ | ||
private static HashSet<string> Extensions { get; } = | ||
OperatingSystem.IsWindows() ? new HashSet<string>(StringComparer.OrdinalIgnoreCase) | ||
{ | ||
".bat", ".cmd", ".ps1", | ||
} : | ||
OperatingSystem.IsMacOS() || OperatingSystem.IsLinux() ? new HashSet<string>(StringComparer.Ordinal) | ||
{ | ||
".sh", | ||
} : | ||
[]; | ||
|
||
private static HashSet<string> Filenames { get; } = new(StringComparer.OrdinalIgnoreCase) | ||
{ | ||
"b", "build", | ||
}; | ||
|
||
public string? LocateBuildScript(string? cd = null) | ||
{ | ||
cd ??= Environment.CurrentDirectory; | ||
var directoryInfo = FileSystem.DirectoryInfo.New(cd); | ||
|
||
return Locate(directoryInfo); | ||
} | ||
|
||
private string? Locate(IDirectoryInfo? directoryInfo) | ||
{ | ||
if(directoryInfo is null) | ||
{ | ||
return null; | ||
} | ||
|
||
foreach (var file in directoryInfo.EnumerateFiles("*.*", SearchOption.TopDirectoryOnly)) | ||
{ | ||
if (Extensions.Contains(file.Extension) && Filenames.Contains(FileSystem.Path.GetFileNameWithoutExtension(file.Name))) | ||
{ | ||
return file.FullName; | ||
} | ||
} | ||
|
||
return Locate(directoryInfo.Parent); | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.