Skip to content

AArnott/Sourcy

 
 

Repository files navigation

Sourcy

Sourcy is a Source Generator that gives you static compile-time properties to file paths within your repository.

This can be useful for things like tests, scripts or pipelines where you may need to locate something from the file system.

This can avoid having to deal with relative paths, or defining absolute paths which may change machine-to-machine.

Getting Started

After installing the Sourcy package(s) you want, properties can be found within the Sourcy namespace. So just start typing Sourcy. and your IDE should help you with the rest.

Currently Sourcy has 4 packages:

Sourcy.Git

Attempts to find your Git directory by parsing the result of git rev-parse --show-toplevel

Sourcy.DotNet

Searches for Projects with a .csproj or .fsproj extension

Searches for Solutions with a .sln, .slnx or .slnf extension

Sourcy.Node

Locates Node projects within your repository by looking for a package-lock.json or yarn.lock file

Sourcy.Docker

Locates Dockerfiles within your repository

For files you are given a FileInfo object, and for directories a DirectoryInfo object. This allows you to easy call things like EnumerateFiles on.

e.g.

var testResultsReport = Sourcy.Git.RootDirectory
            .EnumerateFiles("*.trx", SearchOption.AllDirectories)
            .First();

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%