Renamed MicroForge to MycroForge
This commit is contained in:
parent
8fed922cfe
commit
7e249e12c4
@ -1,34 +1,34 @@
|
||||
# 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.).
|
||||
#
|
||||
# For more help, visit the .dockerignore file reference guide at
|
||||
# https://docs.docker.com/go/build-context-dockerignore/
|
||||
|
||||
**/.DS_Store
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
|
||||
**/venv
|
||||
# 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.).
|
||||
#
|
||||
# For more help, visit the .dockerignore file reference guide at
|
||||
# https://docs.docker.com/go/build-context-dockerignore/
|
||||
|
||||
**/.DS_Store
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/bin
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
|
||||
**/venv
|
||||
|
64
Dockerfile
64
Dockerfile
@ -1,32 +1,32 @@
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
|
||||
COPY . /source
|
||||
WORKDIR /source/MicroForge.CLI
|
||||
ARG TARGETARCH
|
||||
# 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
|
||||
# work in .NET 6.0.
|
||||
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
|
||||
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
|
||||
RUN apt update -y && \
|
||||
apt upgrade -y && \
|
||||
apt install -y git && \
|
||||
apt install -y bash && \
|
||||
apt install -y python3 && \
|
||||
apt install -y python3-pip && \
|
||||
apt install -y python3-venv
|
||||
|
||||
# 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,
|
||||
# which should be pretty doable, but it's a concern for later.
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
WORKDIR /app
|
||||
COPY --from=build /app .
|
||||
|
||||
WORKDIR /project
|
||||
COPY MicroForge.CLI/scripts /scripts
|
||||
USER root
|
||||
|
||||
ENTRYPOINT ["dotnet", "/app/MicroForge.CLI.dll"] CMD ["-?"]
|
||||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
|
||||
COPY . /source
|
||||
WORKDIR /source/MycroForge.CLI
|
||||
ARG TARGETARCH
|
||||
# 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
|
||||
# work in .NET 6.0.
|
||||
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \
|
||||
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
|
||||
RUN apt update -y && \
|
||||
apt upgrade -y && \
|
||||
apt install -y git && \
|
||||
apt install -y bash && \
|
||||
apt install -y python3 && \
|
||||
apt install -y python3-pip && \
|
||||
apt install -y python3-venv
|
||||
|
||||
# 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,
|
||||
# which should be pretty doable, but it's a concern for later.
|
||||
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
WORKDIR /app
|
||||
COPY --from=build /app .
|
||||
|
||||
WORKDIR /project
|
||||
COPY MycroForge.CLI/scripts /scripts
|
||||
USER root
|
||||
|
||||
ENTRYPOINT ["dotnet", "/app/MycroForge.CLI.dll"] CMD ["-?"]
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
dotnet pack -v d
|
||||
|
||||
dotnet tool update --global --add-source ./nupkg MicroForge.CLI -v d
|
@ -1,4 +1,4 @@
|
||||
namespace MicroForge.CLI;
|
||||
namespace MycroForge.CLI;
|
||||
|
||||
public class ArgsContext
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using MicroForge.CLI.Exceptions;
|
||||
using MycroForge.CLI.Exceptions;
|
||||
|
||||
namespace MicroForge.CLI;
|
||||
namespace MycroForge.CLI;
|
||||
|
||||
public static class Bash
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using MicroForge.Parsing;
|
||||
using MycroForge.Parsing;
|
||||
|
||||
namespace MicroForge.CLI.CodeGen;
|
||||
namespace MycroForge.CLI.CodeGen;
|
||||
|
||||
public class OrmEnvInitializer : PythonSourceModifier
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using MicroForge.Parsing;
|
||||
using MycroForge.Parsing;
|
||||
|
||||
namespace MicroForge.CLI.CodeGen;
|
||||
namespace MycroForge.CLI.CodeGen;
|
||||
|
||||
public class OrmEnvUpdater : PythonSourceModifier
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using Antlr4.Runtime;
|
||||
using MicroForge.Parsing;
|
||||
using MycroForge.Parsing;
|
||||
|
||||
namespace MicroForge.CLI.CodeGen;
|
||||
namespace MycroForge.CLI.CodeGen;
|
||||
|
||||
public abstract class PythonSourceModifier : PythonParserBaseVisitor<object?>
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.CommandLine;
|
||||
|
||||
namespace MicroForge.CLI.Commands.Interfaces;
|
||||
namespace MycroForge.CLI.Commands.Interfaces;
|
||||
|
||||
public interface ISubCommandOf<T> where T : Command
|
||||
{
|
@ -1,10 +1,10 @@
|
||||
using System.CommandLine;
|
||||
using MicroForge.CLI.Commands.Interfaces;
|
||||
using MicroForge.CLI.Features;
|
||||
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 partial class Add
|
||||
{
|
@ -1,10 +1,10 @@
|
||||
using System.CommandLine;
|
||||
using MicroForge.CLI.Commands.Interfaces;
|
||||
using MicroForge.CLI.Features;
|
||||
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 partial class Add
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
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) :
|
||||
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")
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
using System.CommandLine;
|
||||
using Humanizer;
|
||||
using MicroForge.CLI.CodeGen;
|
||||
using MicroForge.CLI.Commands.Interfaces;
|
||||
using MycroForge.CLI.CodeGen;
|
||||
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
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
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
|
||||
{
|
@ -1,10 +1,10 @@
|
||||
using System.CommandLine;
|
||||
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
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
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) :
|
||||
base("generate", "Generate a project item")
|
@ -1,13 +1,13 @@
|
||||
using System.CommandLine;
|
||||
using MicroForge.CLI.Commands.Interfaces;
|
||||
using MicroForge.CLI.Features;
|
||||
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
|
||||
|
@ -1,11 +1,11 @@
|
||||
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 =
|
||||
new(name: "packages", description: "The names of the packages to install");
|
@ -1,9 +1,9 @@
|
||||
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
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
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
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
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) :
|
||||
base("migrations", "Manage your migrations")
|
@ -1,11 +1,11 @@
|
||||
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.")
|
||||
{
|
@ -1,11 +1,11 @@
|
||||
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 =
|
||||
new(name: "packages", description: "The names of the packages to uninstall");
|
17
MycroForge.CLI/Commands/MycroForge.cs
Normal file
17
MycroForge.CLI/Commands/MycroForge.cs
Normal 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);
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace MicroForge.CLI.Exceptions;
|
||||
namespace MycroForge.CLI.Exceptions;
|
||||
|
||||
public class BashException : Exception
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace MicroForge.CLI.Extensions;
|
||||
namespace MycroForge.CLI.Extensions;
|
||||
|
||||
public static class ObjectStreamExtensions
|
||||
{
|
46
MycroForge.CLI/Extensions/ServiceCollectionExtensions.cs
Normal file
46
MycroForge.CLI/Extensions/ServiceCollectionExtensions.cs
Normal 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;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace MicroForge.CLI.Features;
|
||||
namespace MycroForge.CLI.Features;
|
||||
|
||||
public sealed class Api : IFeature
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace MicroForge.CLI.Features;
|
||||
namespace MycroForge.CLI.Features;
|
||||
|
||||
|
||||
public interface IFeature
|
@ -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
|
||||
{
|
@ -11,7 +11,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MicroForge.Parsing\MicroForge.Parsing.csproj" />
|
||||
<ProjectReference Include="..\MycroForge.Parsing\MycroForge.Parsing.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -30,8 +30,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="MicroForge.Parsing">
|
||||
<HintPath>bin\Debug\net8.0\MicroForge.Parsing.dll</HintPath>
|
||||
<Reference Include="MycroForge.Parsing">
|
||||
<HintPath>bin\Debug\net8.0\MycroForge.Parsing.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
@ -1,11 +1,10 @@
|
||||
using System.CommandLine;
|
||||
using MicroForge.CLI;
|
||||
using MicroForge.CLI.CodeGen;
|
||||
using MicroForge.CLI.Exceptions;
|
||||
using MicroForge.CLI.Extensions;
|
||||
using MycroForge.CLI;
|
||||
using MycroForge.CLI.CodeGen;
|
||||
using MycroForge.CLI.Exceptions;
|
||||
using MycroForge.CLI.Extensions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using RootCommand = MicroForge.CLI.Commands.MicroForge;
|
||||
|
||||
using var host = Host
|
||||
.CreateDefaultBuilder()
|
||||
@ -21,7 +20,7 @@ try
|
||||
{
|
||||
var ctx = host.Services.GetRequiredService<ProjectContext>();
|
||||
await ctx.LoadConfig();
|
||||
await host.Services.GetRequiredService<RootCommand>().InvokeAsync(args);
|
||||
await host.Services.GetRequiredService<MycroForge.CLI.Commands.MycroForge>().InvokeAsync(args);
|
||||
await ctx.SaveConfig();
|
||||
}
|
||||
catch
|
@ -1,4 +1,4 @@
|
||||
namespace MicroForge.CLI;
|
||||
namespace MycroForge.CLI;
|
||||
|
||||
public class ProjectConfig
|
||||
{
|
@ -1,7 +1,7 @@
|
||||
using System.Text.Json;
|
||||
using MicroForge.CLI.Extensions;
|
||||
using MycroForge.CLI.Extensions;
|
||||
|
||||
namespace MicroForge.CLI;
|
||||
namespace MycroForge.CLI;
|
||||
|
||||
public class ProjectContext
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace MicroForge.CLI;
|
||||
namespace MycroForge.CLI;
|
||||
|
||||
public static class Shared
|
||||
{
|
5
MycroForge.CLI/scripts/publish.sh
Normal file
5
MycroForge.CLI/scripts/publish.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
dotnet pack -v d
|
||||
|
||||
dotnet tool update --global --add-source ./nupkg MycroForge.CLI -v d
|
@ -28,7 +28,7 @@ THE SOFTWARE.
|
||||
using Antlr4.Runtime;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace MicroForge.Parsing;
|
||||
namespace MycroForge.Parsing;
|
||||
|
||||
public abstract class PythonLexerBase : Lexer
|
||||
{
|
@ -1,6 +1,6 @@
|
||||
using Antlr4.Runtime;
|
||||
|
||||
namespace MicroForge.Parsing;
|
||||
namespace MycroForge.Parsing;
|
||||
|
||||
public abstract class PythonParserBase : Parser
|
||||
{
|
@ -1,8 +1,8 @@
|
||||
|
||||
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
|
||||
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
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
@ -1,46 +1,46 @@
|
||||
### Building and running your application
|
||||
|
||||
When you're ready, start your application by running:
|
||||
`docker compose up --build`.
|
||||
|
||||
Your application will be available at http://localhost:8080.
|
||||
|
||||
### Deploying your application to the cloud
|
||||
|
||||
First, build your image, e.g.: `docker build -t myapp .`.
|
||||
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),
|
||||
you'll want to build the image for that platform, e.g.:
|
||||
`docker build --platform=linux/amd64 -t 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/)
|
||||
docs for more detail on building and pushing.
|
||||
|
||||
### References
|
||||
* [Docker's .NET guide](https://docs.docker.com/language/dotnet/)
|
||||
* The [dotnet-docker](https://github.com/dotnet/dotnet-docker/tree/main/samples)
|
||||
repository has many relevant samples and docs.
|
||||
|
||||
### Dependencies
|
||||
|
||||
bash (/usr/bin/bash)
|
||||
|
||||
Python 3.10.2 (/usr/bin/python3)
|
||||
- python3-pip
|
||||
- python3-venv
|
||||
|
||||
pkg-config (sudo apt update && sudo apt install pkg-config)
|
||||
|
||||
### Notes
|
||||
|
||||
Try Running NuGet restore when ANTLR doesn't generate Lexer or Parser
|
||||
|
||||
### TODO
|
||||
- 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?
|
||||
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?
|
||||
- Make it so that `Bash.ExecuteAsync` can run "directly" in the calling terminal also.
|
||||
### Building and running your application
|
||||
|
||||
When you're ready, start your application by running:
|
||||
`docker compose up --build`.
|
||||
|
||||
Your application will be available at http://localhost:8080.
|
||||
|
||||
### Deploying your application to the cloud
|
||||
|
||||
First, build your image, e.g.: `docker build -t myapp .`.
|
||||
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),
|
||||
you'll want to build the image for that platform, e.g.:
|
||||
`docker build --platform=linux/amd64 -t 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/)
|
||||
docs for more detail on building and pushing.
|
||||
|
||||
### References
|
||||
* [Docker's .NET guide](https://docs.docker.com/language/dotnet/)
|
||||
* The [dotnet-docker](https://github.com/dotnet/dotnet-docker/tree/main/samples)
|
||||
repository has many relevant samples and docs.
|
||||
|
||||
### Dependencies
|
||||
|
||||
bash (/usr/bin/bash)
|
||||
|
||||
Python 3.10.2 (/usr/bin/python3)
|
||||
- python3-pip
|
||||
- python3-venv
|
||||
|
||||
pkg-config (sudo apt update && sudo apt install pkg-config)
|
||||
|
||||
### Notes
|
||||
|
||||
Try Running NuGet restore when ANTLR doesn't generate Lexer or Parser
|
||||
|
||||
### TODO
|
||||
- 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?
|
||||
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?
|
||||
- Make it so that `Bash.ExecuteAsync` can run "directly" in the calling terminal also.
|
||||
- This will improve the usability of the "m4g run" command.
|
Loading…
Reference in New Issue
Block a user