Renamed MicroForge to MycroForge

This commit is contained in:
Donné Napo 2024-04-22 09:56:39 +02:00
parent 8fed922cfe
commit 7e249e12c4
46 changed files with 265 additions and 266 deletions

View File

@ -1,34 +1,34 @@
# Include any files or directories that you don't want to be copied to your # Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.). # container here (e.g., local build artifacts, temporary files, etc.).
# #
# For more help, visit the .dockerignore file reference guide at # For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/ # https://docs.docker.com/go/build-context-dockerignore/
**/.DS_Store **/.DS_Store
**/.classpath **/.classpath
**/.dockerignore **/.dockerignore
**/.env **/.env
**/.git **/.git
**/.gitignore **/.gitignore
**/.project **/.project
**/.settings **/.settings
**/.toolstarget **/.toolstarget
**/.vs **/.vs
**/.vscode **/.vscode
**/*.*proj.user **/*.*proj.user
**/*.dbmdl **/*.dbmdl
**/*.jfm **/*.jfm
**/bin **/bin
**/charts **/charts
**/docker-compose* **/docker-compose*
**/compose* **/compose*
**/Dockerfile* **/Dockerfile*
**/node_modules **/node_modules
**/npm-debug.log **/npm-debug.log
**/obj **/obj
**/secrets.dev.yaml **/secrets.dev.yaml
**/values.dev.yaml **/values.dev.yaml
LICENSE LICENSE
README.md README.md
**/venv **/venv

View File

@ -1,32 +1,32 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
COPY . /source COPY . /source
WORKDIR /source/MicroForge.CLI WORKDIR /source/MycroForge.CLI
ARG TARGETARCH ARG TARGETARCH
# Leverage a cache mount to /root/.nuget/packages so that subsequent builds don't have to re-download packages. # Leverage a cache mount to /root/.nuget/packages so that subsequent builds don't have to re-download packages.
# If TARGETARCH is "amd64", replace it with "x64" - "x64" is .NET's canonical name for this and "amd64" doesn't # If TARGETARCH is "amd64", replace it with "x64" - "x64" is .NET's canonical name for this and "amd64" doesn't
# work in .NET 6.0. # work in .NET 6.0.
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \ RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
dotnet publish -a ${TARGETARCH/amd64/x64} --use-current-runtime --self-contained false -o /app dotnet publish -a ${TARGETARCH/amd64/x64} --use-current-runtime --self-contained false -o /app
FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS final FROM mcr.microsoft.com/dotnet/aspnet:8.0-bookworm-slim AS final
RUN apt update -y && \ RUN apt update -y && \
apt upgrade -y && \ apt upgrade -y && \
apt install -y git && \ apt install -y git && \
apt install -y bash && \ apt install -y bash && \
apt install -y python3 && \ apt install -y python3 && \
apt install -y python3-pip && \ apt install -y python3-pip && \
apt install -y python3-venv apt install -y python3-venv
# The Docker approach doesn't work for now, because the venv setup depends on absolute paths. # The Docker approach doesn't work for now, because the venv setup depends on absolute paths.
# This means that the would need to recreate the full path to the actual working directory in the Docker container, # This means that the would need to recreate the full path to the actual working directory in the Docker container,
# which should be pretty doable, but it's a concern for later. # which should be pretty doable, but it's a concern for later.
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
WORKDIR /app WORKDIR /app
COPY --from=build /app . COPY --from=build /app .
WORKDIR /project WORKDIR /project
COPY MicroForge.CLI/scripts /scripts COPY MycroForge.CLI/scripts /scripts
USER root USER root
ENTRYPOINT ["dotnet", "/app/MicroForge.CLI.dll"] CMD ["-?"] ENTRYPOINT ["dotnet", "/app/MycroForge.CLI.dll"] CMD ["-?"]

View File

@ -1,17 +0,0 @@
using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands;
public partial class MicroForge : RootCommand
{
public override string Name => "m4g";
public MicroForge(IEnumerable<ISubCommandOf<MicroForge>> commands) : base("The MicroForge CLI tool.")
{
commands
.Cast<Command>()
.ToList()
.ForEach(AddCommand);
}
}

View File

@ -1,46 +0,0 @@
using MicroForge.CLI.Commands.Interfaces;
using MicroForge.CLI.Features;
using Microsoft.Extensions.DependencyInjection;
namespace MicroForge.CLI.Extensions;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddServices(this IServiceCollection services, string[] args)
{
services.AddScoped<ArgsContext>(_ => new ArgsContext { Args = args });
services.AddScoped<ProjectContext>();
services.AddScoped<IFeature, Api>();
services.AddScoped<IFeature, Orm>();
return services;
}
public static IServiceCollection AddCommands(this IServiceCollection services)
{
// Register "m4g"
services.AddScoped<Commands.MicroForge>();
services.AddScoped<ISubCommandOf<Commands.MicroForge>, Commands.MicroForge.Init>();
services.AddScoped<ISubCommandOf<Commands.MicroForge>, Commands.MicroForge.Run>();
services.AddScoped<ISubCommandOf<Commands.MicroForge>, Commands.MicroForge.Install>();
services.AddScoped<ISubCommandOf<Commands.MicroForge>, Commands.MicroForge.Uninstall>();
// Register "m4g add"
services.AddScoped<ISubCommandOf<Commands.MicroForge>, Commands.MicroForge.Add>();
services.AddScoped<ISubCommandOf<Commands.MicroForge.Add>, Commands.MicroForge.Add.Api>();
services.AddScoped<ISubCommandOf<Commands.MicroForge.Add>, Commands.MicroForge.Add.Orm>();
// Register "m4g generate"
services.AddScoped<ISubCommandOf<Commands.MicroForge>, Commands.MicroForge.Generate>();
services.AddScoped<ISubCommandOf<Commands.MicroForge.Generate>, Commands.MicroForge.Generate.Entity>();
services.AddScoped<ISubCommandOf<Commands.MicroForge.Generate>, Commands.MicroForge.Generate.Router>();
services.AddScoped<ISubCommandOf<Commands.MicroForge.Generate>, Commands.MicroForge.Generate.Migration>();
// Register "m4g migrations"
services.AddScoped<ISubCommandOf<Commands.MicroForge>, Commands.MicroForge.Migrations>();
services.AddScoped<ISubCommandOf<Commands.MicroForge.Migrations>, Commands.MicroForge.Migrations.Apply>();
services.AddScoped<ISubCommandOf<Commands.MicroForge.Migrations>, Commands.MicroForge.Migrations.Rollback>();
return services;
}
}

View File

@ -1,5 +0,0 @@
#!/usr/bin/bash
dotnet pack -v d
dotnet tool update --global --add-source ./nupkg MicroForge.CLI -v d

View File

@ -1,4 +1,4 @@
namespace MicroForge.CLI; namespace MycroForge.CLI;
public class ArgsContext public class ArgsContext
{ {

View File

@ -1,8 +1,8 @@
using System.Diagnostics; using System.Diagnostics;
using System.Text; using System.Text;
using MicroForge.CLI.Exceptions; using MycroForge.CLI.Exceptions;
namespace MicroForge.CLI; namespace MycroForge.CLI;
public static class Bash public static class Bash
{ {

View File

@ -1,6 +1,6 @@
using MicroForge.Parsing; using MycroForge.Parsing;
namespace MicroForge.CLI.CodeGen; namespace MycroForge.CLI.CodeGen;
public class OrmEnvInitializer : PythonSourceModifier public class OrmEnvInitializer : PythonSourceModifier
{ {

View File

@ -1,6 +1,6 @@
using MicroForge.Parsing; using MycroForge.Parsing;
namespace MicroForge.CLI.CodeGen; namespace MycroForge.CLI.CodeGen;
public class OrmEnvUpdater : PythonSourceModifier public class OrmEnvUpdater : PythonSourceModifier
{ {

View File

@ -1,7 +1,7 @@
using Antlr4.Runtime; using Antlr4.Runtime;
using MicroForge.Parsing; using MycroForge.Parsing;
namespace MicroForge.CLI.CodeGen; namespace MycroForge.CLI.CodeGen;
public abstract class PythonSourceModifier : PythonParserBaseVisitor<object?> public abstract class PythonSourceModifier : PythonParserBaseVisitor<object?>
{ {

View File

@ -1,6 +1,6 @@
using System.CommandLine; using System.CommandLine;
namespace MicroForge.CLI.Commands.Interfaces; namespace MycroForge.CLI.Commands.Interfaces;
public interface ISubCommandOf<T> where T : Command public interface ISubCommandOf<T> where T : Command
{ {

View File

@ -1,10 +1,10 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
using MicroForge.CLI.Features; using MycroForge.CLI.Features;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public partial class Add public partial class Add
{ {

View File

@ -1,10 +1,10 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
using MicroForge.CLI.Features; using MycroForge.CLI.Features;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public partial class Add public partial class Add
{ {

View File

@ -1,11 +1,11 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public new partial class Add : Command, ISubCommandOf<MicroForge> public new partial class Add : Command, ISubCommandOf<MycroForge>
{ {
public Add(IEnumerable<ISubCommandOf<Add>> subCommands) : public Add(IEnumerable<ISubCommandOf<Add>> subCommands) :
base("add", "Add a predefined feature to your project") base("add", "Add a predefined feature to your project")
@ -15,7 +15,7 @@ public partial class MicroForge
} }
} }
public class Run : Command, ISubCommandOf<MicroForge> public class Run : Command, ISubCommandOf<MycroForge>
{ {
public Run() : base("run", "Run your app") public Run() : base("run", "Run your app")
{ {

View File

@ -1,11 +1,11 @@
using System.CommandLine; using System.CommandLine;
using Humanizer; using Humanizer;
using MicroForge.CLI.CodeGen; using MycroForge.CLI.CodeGen;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public partial class Generate public partial class Generate
{ {

View File

@ -1,9 +1,9 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public partial class Generate public partial class Generate
{ {

View File

@ -1,10 +1,10 @@
using System.CommandLine; using System.CommandLine;
using Humanizer; using Humanizer;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public partial class Generate public partial class Generate
{ {

View File

@ -1,11 +1,11 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public partial class Generate : Command, ISubCommandOf<MicroForge> public partial class Generate : Command, ISubCommandOf<MycroForge>
{ {
public Generate(IEnumerable<ISubCommandOf<Generate>> subCommands) : public Generate(IEnumerable<ISubCommandOf<Generate>> subCommands) :
base("generate", "Generate a project item") base("generate", "Generate a project item")

View File

@ -1,13 +1,13 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces;
using MicroForge.CLI.Features;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using MycroForge.CLI.Commands.Interfaces;
using MycroForge.CLI.Features;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public class Init : Command, ISubCommandOf<MicroForge> public class Init : Command, ISubCommandOf<MycroForge>
{ {
#region GitIgnore #region GitIgnore

View File

@ -1,11 +1,11 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public class Install : Command, ISubCommandOf<MicroForge> public class Install : Command, ISubCommandOf<MycroForge>
{ {
private static readonly Argument<IEnumerable<string>> PackagesArgument = private static readonly Argument<IEnumerable<string>> PackagesArgument =
new(name: "packages", description: "The names of the packages to install"); new(name: "packages", description: "The names of the packages to install");

View File

@ -1,9 +1,9 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public partial class Migrations public partial class Migrations
{ {

View File

@ -1,9 +1,9 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public partial class Migrations public partial class Migrations
{ {

View File

@ -1,11 +1,11 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public partial class Migrations : Command, ISubCommandOf<MicroForge> public partial class Migrations : Command, ISubCommandOf<MycroForge>
{ {
public Migrations(IEnumerable<ISubCommandOf<Migrations>> subCommands) : public Migrations(IEnumerable<ISubCommandOf<Migrations>> subCommands) :
base("migrations", "Manage your migrations") base("migrations", "Manage your migrations")

View File

@ -1,11 +1,11 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public class Rewrite : Command, ISubCommandOf<MicroForge> public class Rewrite : Command, ISubCommandOf<MycroForge>
{ {
public Rewrite() : base("rewrite", "Test a python source rewriter.") public Rewrite() : base("rewrite", "Test a python source rewriter.")
{ {

View File

@ -1,11 +1,11 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI.Commands.Interfaces; using MycroForge.CLI.Commands.Interfaces;
namespace MicroForge.CLI.Commands; namespace MycroForge.CLI.Commands;
public partial class MicroForge public partial class MycroForge
{ {
public class Uninstall : Command, ISubCommandOf<MicroForge> public class Uninstall : Command, ISubCommandOf<MycroForge>
{ {
private static readonly Argument<IEnumerable<string>> PackagesArgument = private static readonly Argument<IEnumerable<string>> PackagesArgument =
new(name: "packages", description: "The names of the packages to uninstall"); new(name: "packages", description: "The names of the packages to uninstall");

View File

@ -0,0 +1,17 @@
using System.CommandLine;
using MycroForge.CLI.Commands.Interfaces;
namespace MycroForge.CLI.Commands;
public partial class MycroForge : RootCommand
{
public override string Name => "m4g";
public MycroForge(IEnumerable<ISubCommandOf<MycroForge>> commands) : base("The MycroForge CLI tool.")
{
commands
.Cast<Command>()
.ToList()
.ForEach(AddCommand);
}
}

View File

@ -1,4 +1,4 @@
namespace MicroForge.CLI.Exceptions; namespace MycroForge.CLI.Exceptions;
public class BashException : Exception public class BashException : Exception
{ {

View File

@ -1,6 +1,6 @@
using System.Text.Json; using System.Text.Json;
namespace MicroForge.CLI.Extensions; namespace MycroForge.CLI.Extensions;
public static class ObjectStreamExtensions public static class ObjectStreamExtensions
{ {

View File

@ -0,0 +1,46 @@
using Microsoft.Extensions.DependencyInjection;
using MycroForge.CLI.Commands.Interfaces;
using MycroForge.CLI.Features;
namespace MycroForge.CLI.Extensions;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddServices(this IServiceCollection services, string[] args)
{
services.AddScoped<ArgsContext>(_ => new ArgsContext { Args = args });
services.AddScoped<ProjectContext>();
services.AddScoped<IFeature, Api>();
services.AddScoped<IFeature, Orm>();
return services;
}
public static IServiceCollection AddCommands(this IServiceCollection services)
{
// Register "m4g"
services.AddScoped<Commands.MycroForge>();
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Init>();
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Run>();
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Install>();
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Uninstall>();
// Register "m4g add"
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Add>();
services.AddScoped<ISubCommandOf<Commands.MycroForge.Add>, Commands.MycroForge.Add.Api>();
services.AddScoped<ISubCommandOf<Commands.MycroForge.Add>, Commands.MycroForge.Add.Orm>();
// Register "m4g generate"
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Generate>();
services.AddScoped<ISubCommandOf<Commands.MycroForge.Generate>, Commands.MycroForge.Generate.Entity>();
services.AddScoped<ISubCommandOf<Commands.MycroForge.Generate>, Commands.MycroForge.Generate.Router>();
services.AddScoped<ISubCommandOf<Commands.MycroForge.Generate>, Commands.MycroForge.Generate.Migration>();
// Register "m4g migrations"
services.AddScoped<ISubCommandOf<Commands.MycroForge>, Commands.MycroForge.Migrations>();
services.AddScoped<ISubCommandOf<Commands.MycroForge.Migrations>, Commands.MycroForge.Migrations.Apply>();
services.AddScoped<ISubCommandOf<Commands.MycroForge.Migrations>, Commands.MycroForge.Migrations.Rollback>();
return services;
}
}

View File

@ -1,4 +1,4 @@
namespace MicroForge.CLI.Features; namespace MycroForge.CLI.Features;
public sealed class Api : IFeature public sealed class Api : IFeature
{ {

View File

@ -1,4 +1,4 @@
namespace MicroForge.CLI.Features; namespace MycroForge.CLI.Features;
public interface IFeature public interface IFeature

View File

@ -1,6 +1,6 @@
using MicroForge.CLI.CodeGen; using MycroForge.CLI.CodeGen;
namespace MicroForge.CLI.Features; namespace MycroForge.CLI.Features;
public sealed class Orm : IFeature public sealed class Orm : IFeature
{ {

View File

@ -11,7 +11,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\MicroForge.Parsing\MicroForge.Parsing.csproj" /> <ProjectReference Include="..\MycroForge.Parsing\MycroForge.Parsing.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -30,8 +30,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="MicroForge.Parsing"> <Reference Include="MycroForge.Parsing">
<HintPath>bin\Debug\net8.0\MicroForge.Parsing.dll</HintPath> <HintPath>bin\Debug\net8.0\MycroForge.Parsing.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

View File

@ -1,11 +1,10 @@
using System.CommandLine; using System.CommandLine;
using MicroForge.CLI; using MycroForge.CLI;
using MicroForge.CLI.CodeGen; using MycroForge.CLI.CodeGen;
using MicroForge.CLI.Exceptions; using MycroForge.CLI.Exceptions;
using MicroForge.CLI.Extensions; using MycroForge.CLI.Extensions;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using RootCommand = MicroForge.CLI.Commands.MicroForge;
using var host = Host using var host = Host
.CreateDefaultBuilder() .CreateDefaultBuilder()
@ -21,7 +20,7 @@ try
{ {
var ctx = host.Services.GetRequiredService<ProjectContext>(); var ctx = host.Services.GetRequiredService<ProjectContext>();
await ctx.LoadConfig(); await ctx.LoadConfig();
await host.Services.GetRequiredService<RootCommand>().InvokeAsync(args); await host.Services.GetRequiredService<MycroForge.CLI.Commands.MycroForge>().InvokeAsync(args);
await ctx.SaveConfig(); await ctx.SaveConfig();
} }
catch catch

View File

@ -1,4 +1,4 @@
namespace MicroForge.CLI; namespace MycroForge.CLI;
public class ProjectConfig public class ProjectConfig
{ {

View File

@ -1,7 +1,7 @@
using System.Text.Json; using System.Text.Json;
using MicroForge.CLI.Extensions; using MycroForge.CLI.Extensions;
namespace MicroForge.CLI; namespace MycroForge.CLI;
public class ProjectContext public class ProjectContext
{ {

View File

@ -1,6 +1,6 @@
using System.Text.Json; using System.Text.Json;
namespace MicroForge.CLI; namespace MycroForge.CLI;
public static class Shared public static class Shared
{ {

View File

@ -0,0 +1,5 @@
#!/usr/bin/bash
dotnet pack -v d
dotnet tool update --global --add-source ./nupkg MycroForge.CLI -v d

View File

@ -28,7 +28,7 @@ THE SOFTWARE.
using Antlr4.Runtime; using Antlr4.Runtime;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace MicroForge.Parsing; namespace MycroForge.Parsing;
public abstract class PythonLexerBase : Lexer public abstract class PythonLexerBase : Lexer
{ {

View File

@ -1,6 +1,6 @@
using Antlr4.Runtime; using Antlr4.Runtime;
namespace MicroForge.Parsing; namespace MycroForge.Parsing;
public abstract class PythonParserBase : Parser public abstract class PythonParserBase : Parser
{ {

View File

@ -1,8 +1,8 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroForge.CLI", "MicroForge.CLI\MicroForge.CLI.csproj", "{27EFB015-AFC3-4046-8D9A-DD5C5D3B35E0}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MycroForge.CLI", "MycroForge.CLI\MycroForge.CLI.csproj", "{27EFB015-AFC3-4046-8D9A-DD5C5D3B35E0}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroForge.Parsing", "MicroForge.Parsing\MicroForge.Parsing.csproj", "{D697CEFD-7CF7-4680-82FC-F84B08F81635}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MycroForge.Parsing", "MycroForge.Parsing\MycroForge.Parsing.csproj", "{D697CEFD-7CF7-4680-82FC-F84B08F81635}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -1,46 +1,46 @@
### Building and running your application ### Building and running your application
When you're ready, start your application by running: When you're ready, start your application by running:
`docker compose up --build`. `docker compose up --build`.
Your application will be available at http://localhost:8080. Your application will be available at http://localhost:8080.
### Deploying your application to the cloud ### Deploying your application to the cloud
First, build your image, e.g.: `docker build -t myapp .`. First, build your image, e.g.: `docker build -t myapp .`.
If your cloud uses a different CPU architecture than your development If your cloud uses a different CPU architecture than your development
machine (e.g., you are on a Mac M1 and your cloud provider is amd64), machine (e.g., you are on a Mac M1 and your cloud provider is amd64),
you'll want to build the image for that platform, e.g.: you'll want to build the image for that platform, e.g.:
`docker build --platform=linux/amd64 -t myapp .`. `docker build --platform=linux/amd64 -t myapp .`.
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. Then, push it to your registry, e.g. `docker push myregistry.com/myapp`.
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/)
docs for more detail on building and pushing. docs for more detail on building and pushing.
### References ### References
* [Docker's .NET guide](https://docs.docker.com/language/dotnet/) * [Docker's .NET guide](https://docs.docker.com/language/dotnet/)
* The [dotnet-docker](https://github.com/dotnet/dotnet-docker/tree/main/samples) * The [dotnet-docker](https://github.com/dotnet/dotnet-docker/tree/main/samples)
repository has many relevant samples and docs. repository has many relevant samples and docs.
### Dependencies ### Dependencies
bash (/usr/bin/bash) bash (/usr/bin/bash)
Python 3.10.2 (/usr/bin/python3) Python 3.10.2 (/usr/bin/python3)
- python3-pip - python3-pip
- python3-venv - python3-venv
pkg-config (sudo apt update && sudo apt install pkg-config) pkg-config (sudo apt update && sudo apt install pkg-config)
### Notes ### Notes
Try Running NuGet restore when ANTLR doesn't generate Lexer or Parser Try Running NuGet restore when ANTLR doesn't generate Lexer or Parser
### TODO ### TODO
- Make entrypoint, i.e. main.py, customizable or fixed? - Make entrypoint, i.e. main.py, customizable or fixed?
- Figure out why BashException cannot be caught, can it be due to the differences in scoping? - Figure out why BashException cannot be caught, can it be due to the differences in scoping?
Because the `Bash` class is static and the services calling `Bash.ExecuteAsync` are in the container. Because the `Bash` class is static and the services calling `Bash.ExecuteAsync` are in the container.
Maybe this in combination with the async nature of the whole thing? Maybe this in combination with the async nature of the whole thing?
- Make it so that `Bash.ExecuteAsync` can run "directly" in the calling terminal also. - Make it so that `Bash.ExecuteAsync` can run "directly" in the calling terminal also.
- This will improve the usability of the "m4g run" command. - This will improve the usability of the "m4g run" command.