This commit is contained in:
Paul Schneider 2026-02-14 16:54:27 +00:00
commit 45514010f2
3505 changed files with 154 additions and 523 deletions

View file

@ -1,15 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
namespace Yavsc.ApiControllers
{
public class BugReport {
[Required,YaStringLength(1024)]
public string ApiKey { get ; set; }
[Required,YaStringLength(512)]
public string Component { get ; set; }
[Required][YaStringLength(10240)]
public string ExceptionObjectJson { get ; set; }
}
}

View file

@ -1,51 +0,0 @@
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
namespace Yavsc.Abstract.IT {
public class CiBuildSettings
{
/// <summary>
/// The global process environment variables
/// </summary>
/// <value></value>
[JsonProperty("env")]
public string[] Environment { get; set; }
/// <summary>
/// The required building command.
/// </summary>
/// <value></value>
[Required]
[JsonPropertyAttribute("build")]
public CommandPipe Build { get; set; }
/// <summary>
/// A preparing command.
/// It is optional, but when specified,
/// must end ok in order to launch the build.
/// </summary>
/// <value></value>
[JsonPropertyAttribute("prepare")]
public CommandPipe Prepare { get; set; }
/// <summary>
/// A post-production command,
/// for an example, some publishing,
/// push in prod env ...
/// only fired on successful build.
/// </summary>
/// <value></value>
[JsonPropertyAttribute("post_build")]
public CommandPipe PostBuild { get; set; }
/// <summary>
/// Additional emails, as dest of notifications
/// </summary>
/// <value></value>
[JsonPropertyAttribute("emails")]
public string[] Emails { get; set; }
}
}

View file

@ -1,98 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Yavsc.Abstract.IT
{
public class CharArray : List<char>, IEnumerable<char>, IList<char>
{
public CharArray (char [] charArray) : base (charArray)
{
}
public CharArray (IList<char> word): base(word) {
}
public CharArray (IEnumerable<char> word): base(word) {
}
public IList<char> Aggregate(char other)
{
this.Add(other);
return this;
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
public class CodeFromChars : List<CharArray>, ICode<char>
{
public void AddLetter(IEnumerable<char> letter)
{
var candide = new CharArray(letter);
// TODO build new denied letters: compute the automate
// and check it is determinised
// Automate a = new Automate();
Add(candide);
}
public bool Validate()
{
// this is a n*n task
throw new NotImplementedException();
}
IEnumerator<IEnumerable<char>> IEnumerable<IEnumerable<char>>.GetEnumerator()
{
return GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
private class Automate
{
int State { get; set; }
Dictionary<int, Dictionary<int,int>> Transitions { get; set; }
CodeFromChars Code { get; set; }
void Compute(CharArray chars)
{
if (!Code.Contains(chars)) {
State = -1;
return;
}
if (!Transitions.ContainsKey(State)) {
State = -2;
return;
}
var states = Transitions[State];
int letter = Code.IndexOf(chars);
if (!states.ContainsKey(letter))
{
State = -3;
return;
}
State = states[letter];
}
}
}
}

View file

@ -1,42 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using Newtonsoft.Json;
namespace Yavsc.Abstract.IT
{
/// <summary>
/// A command specification (a system command),
/// in order to reference some trusted server-side process
/// </summary>
public class Command
{
[Required]
[JsonPropertyAttribute("path")]
public string Path { get; set; }
[JsonPropertyAttribute("args")]
public string[] Args { get; set; }
/// <summary>
/// Specific variables for this process
/// </summary>
/// <value></value>
[JsonPropertyAttribute("env")]
public string[] Environment { get; set; }
public virtual Process Start(string workingDir=null, bool redirectInput=false, bool redirectOutput=false)
{
var procStart = new ProcessStartInfo(Path, string.Join(" ",Args));
procStart.WorkingDirectory = workingDir;
procStart.UseShellExecute = false;
procStart.RedirectStandardInput = true;
procStart.RedirectStandardOutput = true;
procStart.RedirectStandardError = false;
return Process.Start(procStart);
}
}
}

View file

@ -1,63 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Yavsc.Abstract.IT
{
public class CommandPipe
{
[JsonPropertyAttribute("pipe")]
public Command[] Pipe { get; set; }
[JsonPropertyAttribute("working_dir")]
public string WorkingDir { get; set; }
public virtual int Run()
{
Queue<Process> runQueue = new Queue<Process>();
Queue<Task> joints = new Queue<Task>();
if (Pipe.Length == 0) return -1;
if (Pipe.Length == 1)
{
Process singlecmd = Pipe[0].Start();
singlecmd.WaitForExit();
return singlecmd.ExitCode;
}
Command cmd = Pipe[0];
Process newProcess = cmd.Start(WorkingDir, false, true);
Process latest = newProcess;
Task ending = Task.Run(() => { latest.WaitForExit(); });
for (int i = 1; i < Pipe.Length; i++)
{
joints.Enqueue(ending);
cmd = Pipe[i];
bool isNotLast = i < Pipe.Length;
newProcess = cmd.Start(WorkingDir, true, isNotLast);
var jt = Task.Run(async () =>
{
while (!latest.HasExited && !newProcess.HasExited)
{
string line = await latest.StandardOutput.ReadLineAsync();
if (line != null)
await newProcess.StandardInput.WriteLineAsync(line);
}
});
joints.Enqueue(jt);
latest = newProcess;
runQueue.Enqueue(latest);
}
while (runQueue.Count > 0)
(latest = runQueue.Dequeue()).WaitForExit();
return latest.ExitCode;
}
}
}

View file

@ -1,20 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Attributes.Validation;
namespace Yavsc.Models.IT.Evolution
{
public class Feature
{
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
[YaStringLength(256)]
public string ShortName { get; set; }
[YaStringLength(10*1024)]
public string Description { get; set; }
public FeatureStatus Status { get; set; }
}
}

View file

@ -1,18 +0,0 @@
namespace Yavsc.Models.IT.Evolution
{
/// <summary>
/// A Feature status
/// <c>Ko</c>: A Bug has just been discovered
/// <c>InSane</c>: This feature is not correctly integrating its ecosystem
/// <c>Obsolete</c>: This will be replaced in a short future, or yet has been replaced
/// with a better solution.
/// <c>Ok</c> : nothing to say
/// </summary>
public enum FeatureStatus: int
{
Requested,
Accepted,
Rejected,
Implemented
}
}

View file

@ -1,31 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Yavsc.Attributes.Validation;
using Yavsc.Models.IT.Evolution;
namespace Yavsc.Models.IT.Fixing
{
public partial class Bug
{
[Key,DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
[ForeignKey("FeatureId")]
public virtual Feature False { get; set; }
public long? FeatureId { get; set; }
[YaStringLength(240, MinimumLength=4 ,
ErrorMessageResourceType=typeof(Yavsc.Models.IT.Fixing.Bug),
ErrorMessageResourceName="TitleSizeError")]
public string Title { get; set; }
[YaStringLength(10240,
ErrorMessageResourceType=typeof(Yavsc.Models.IT.Fixing.Bug),
ErrorMessageResourceName="DescSizeError")]
public string Description { get; set; }
public BugStatus Status { get; set; }
}
}

View file

@ -1,17 +0,0 @@
namespace Yavsc.Models.IT.Fixing
{
/// <summary>
/// Bug status:
/// * Inserted -> Confirmed|FeatureRequest|Feature|Rejected
/// * Confirmed -> Fixed
/// * FeatureRequest -> Implemented
/// </summary>
public enum BugStatus : int
{
Inserted,
Confirmed,
Rejected,
Feature,
Fixed
}
}

View file

@ -1,24 +0,0 @@
using System.Collections.Generic;
namespace Yavsc.Abstract.IT
{
// un code est, parmis les ensembles de suites de signes,
// ceux qui n'ont qu'une seule suite de suites pouvant représenter toute suite de suite de signes
public interface ICode<TSign> : IEnumerable<IEnumerable<TSign>>
{
/// <summary>
/// Checks false that a letter list combinaison correspond to another one
/// </summary>
/// <returns></returns>
bool Validate();
/// <summary>
/// Defines a new letter in this code,
/// as an enumerable of <c>TLetter</c>
/// </summary>
/// <param name="letter"></param>
/// <returns></returns>
void AddLetter(IEnumerable<TSign> letter);
}
}

View file

@ -1,14 +0,0 @@
using System.Collections.Generic;
namespace Yavsc.Abstract.IT
{
public interface IProject
{
long Id { get; set ; }
string OwnerId { get; set; }
string Name { get; set; }
string Version { get; set; }
IEnumerable<string> GetConfigurations();
}
}