mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
infer course name from folder name
This commit is contained in:
@@ -15,5 +15,4 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
using YamlDotNet.Serialization;
|
|
||||||
|
|
||||||
namespace LocalModels;
|
namespace LocalModels;
|
||||||
|
|
||||||
public record LocalCourse
|
public record LocalCourse
|
||||||
@@ -8,35 +6,6 @@ public record LocalCourse
|
|||||||
public LocalCourseSettings Settings { get; set; }
|
public LocalCourseSettings Settings { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public record LocalCourseSettings
|
|
||||||
{
|
|
||||||
public IEnumerable<LocalAssignmentGroup> AssignmentGroups { get; init; } =
|
|
||||||
Enumerable.Empty<LocalAssignmentGroup>();
|
|
||||||
public string Name { get; init; } = string.Empty;
|
|
||||||
public IEnumerable<DayOfWeek> DaysOfWeek { get; init; } = Enumerable.Empty<DayOfWeek>();
|
|
||||||
public ulong? CanvasId { get; init; }
|
|
||||||
public DateTime StartDate { get; init; }
|
|
||||||
public DateTime EndDate { get; init; }
|
|
||||||
public SimpleTimeOnly DefaultDueTime { get; init; } = new SimpleTimeOnly();
|
|
||||||
|
|
||||||
public string ToYaml()
|
|
||||||
{
|
|
||||||
var serializer = new SerializerBuilder().DisableAliases().Build();
|
|
||||||
var yaml = serializer.Serialize(this);
|
|
||||||
return yaml;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LocalCourseSettings ParseYaml(string rawText)
|
|
||||||
{
|
|
||||||
var deserializer = new DeserializerBuilder()
|
|
||||||
.IgnoreUnmatchedProperties()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var settings = deserializer.Deserialize<LocalCourseSettings>(rawText);
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public record SimpleTimeOnly
|
public record SimpleTimeOnly
|
||||||
{
|
{
|
||||||
public int Hour { get; init; } = 1;
|
public int Hour { get; init; } = 1;
|
||||||
|
|||||||
34
Management/Models/Local/LocalCourseSettings.cs
Normal file
34
Management/Models/Local/LocalCourseSettings.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using YamlDotNet.Serialization;
|
||||||
|
|
||||||
|
namespace LocalModels;
|
||||||
|
|
||||||
|
public record LocalCourseSettings
|
||||||
|
{
|
||||||
|
public IEnumerable<LocalAssignmentGroup> AssignmentGroups { get; init; } =
|
||||||
|
Enumerable.Empty<LocalAssignmentGroup>();
|
||||||
|
|
||||||
|
[YamlIgnore]
|
||||||
|
public string Name { get; init; } = string.Empty;
|
||||||
|
public IEnumerable<DayOfWeek> DaysOfWeek { get; init; } = Enumerable.Empty<DayOfWeek>();
|
||||||
|
public ulong? CanvasId { get; init; }
|
||||||
|
public DateTime StartDate { get; init; }
|
||||||
|
public DateTime EndDate { get; init; }
|
||||||
|
public SimpleTimeOnly DefaultDueTime { get; init; } = new SimpleTimeOnly();
|
||||||
|
|
||||||
|
public string ToYaml()
|
||||||
|
{
|
||||||
|
var serializer = new SerializerBuilder().DisableAliases().Build();
|
||||||
|
var yaml = serializer.Serialize(this);
|
||||||
|
return yaml;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LocalCourseSettings ParseYaml(string rawText)
|
||||||
|
{
|
||||||
|
var deserializer = new DeserializerBuilder()
|
||||||
|
.IgnoreUnmatchedProperties()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var settings = deserializer.Deserialize<LocalCourseSettings>(rawText);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@ using Management.Services;
|
|||||||
|
|
||||||
public class FileConfiguration
|
public class FileConfiguration
|
||||||
{
|
{
|
||||||
|
|
||||||
public static string GetBasePath()
|
public static string GetBasePath()
|
||||||
{
|
{
|
||||||
string? storageDirectory = Environment.GetEnvironmentVariable("storageDirectory");
|
string? storageDirectory = Environment.GetEnvironmentVariable("storageDirectory");
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ public class CourseMarkdownLoader
|
|||||||
|
|
||||||
var settingsString = await File.ReadAllTextAsync(settingsPath);
|
var settingsString = await File.ReadAllTextAsync(settingsPath);
|
||||||
var settings = LocalCourseSettings.ParseYaml(settingsString);
|
var settings = LocalCourseSettings.ParseYaml(settingsString);
|
||||||
return settings;
|
|
||||||
|
var folderName = Path.GetFileName(courseDirectory);
|
||||||
|
return settings with { Name = folderName };
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<IEnumerable<LocalModule>> loadCourseModules(string courseDirectory)
|
private async Task<IEnumerable<LocalModule>> loadCourseModules(string courseDirectory)
|
||||||
|
|||||||
12
build.sh
Normal file → Executable file
12
build.sh
Normal file → Executable file
@@ -1,2 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
VERSION="1.0"
|
||||||
|
|
||||||
|
dotnet publish Management.Web/ \
|
||||||
|
--os linux \
|
||||||
|
--arch x64 \
|
||||||
|
/t:PublishContainer \
|
||||||
|
-c Release \
|
||||||
|
-p ContainerImageTags="\"$VERSION;latest\"" \
|
||||||
|
-p ContainerRepository="canvas_management"
|
||||||
|
|
||||||
|
docker image tag canvas_management:$VERSION alexmickelson/canvas_management:$VERSION
|
||||||
12
docker-compose.yml
Normal file
12
docker-compose.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
services:
|
||||||
|
canvas_manager:
|
||||||
|
image: alexmickelson/canvas_management:1.0
|
||||||
|
user: "1000:1000"
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
environment:
|
||||||
|
- storageDirectory=/app/storage
|
||||||
|
volumes:
|
||||||
|
- ./storage:/app/storage
|
||||||
Reference in New Issue
Block a user