feat(project): add support for Julia

This commit is contained in:
David Anthoff 2022-12-18 05:55:57 -08:00 committed by GitHub
parent 2ff98e2c81
commit f965dc49aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 0 deletions

View file

@ -117,6 +117,11 @@ func (n *Project) Init(props properties.Properties, env platform.Environment) {
Files: []string{"*.vbproj", "*.fsproj", "*.csproj"},
Fetcher: n.getDotnetProject,
},
{
Name: "julia",
Files: []string{"JuliaProject.toml", "Project.toml"},
Fetcher: n.getProjectData,
},
}
}
@ -226,3 +231,16 @@ func (n *Project) getDotnetProject(item ProjectItem) *ProjectData {
Name: name,
}
}
func (n *Project) getProjectData(item ProjectItem) *ProjectData {
content := n.env.FileContent(item.Files[0])
var data ProjectData
_, err := toml.Decode(content, &data)
if err != nil {
n.Error = err.Error()
return nil
}
return &data
}

View file

@ -186,6 +186,37 @@ func TestPackage(t *testing.T) {
File: "Cargo.toml",
PackageContents: "[",
},
{
Case: "Julia project",
ExpectedEnabled: true,
ExpectedString: "\uf487 0.1.0 ProjectEuler",
Name: "julia",
File: "JuliaProject.toml",
PackageContents: "name = \"ProjectEuler\"\nversion = \"0.1.0\"",
},
{
Case: "Julia project no name",
ExpectedEnabled: true,
ExpectedString: "\uf487 0.1.0",
Name: "julia",
File: "JuliaProject.toml",
PackageContents: "version = \"0.1.0\"",
},
{
Case: "Julia project no version",
ExpectedEnabled: true,
ExpectedString: "ProjectEuler",
Name: "julia",
File: "JuliaProject.toml",
PackageContents: "name = \"ProjectEuler\"",
},
{
Case: "Julia project invalid toml",
ExpectedString: "toml: line 1: unexpected end of table name (table names cannot be empty)",
Name: "julia",
File: "JuliaProject.toml",
PackageContents: "[",
},
}
for _, tc := range cases {

View file

@ -16,6 +16,7 @@ Supports:
- PHP project (`composer.json`)
- Any nuspec based project (`*.nuspec`, first file match info is displayed)
- .NET project (`*.csproj`, `*.vbproj` or `*.fsproj`, first file match info is displayed)
- Julia project (`JuliaProject.toml`, `Project.toml`)
## Sample Configuration