Coder Social home page Coder Social logo

cake.console's People

Contributors

devlead avatar pitermarx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cake.console's Issues

make it work with dotnet-script

install dotnet-script
run dotnet script .\dotnet-script\test.csx

warn: Dotnet.Script.Core.Commands.ExecuteScriptCommand[0]
      The script C:\github\Cake.Console\.\dotnet-script\test.csx is not cacheable. For caching and optimal performance, ensure that the script only contains NuGet references with pinned/exact versions.
warn: Dotnet.Script.DependencyModel.Context.CachedRestorer[0]
      Unable to cache C:\Users\PedroMarques\AppData\Local\Temp\dotnet-script\C\github\Cake.Console\.\dotnet-script\net5.0\script.csproj. For caching and optimal performance, ensure that the script(s) references Nuget packages with a 
pinned version.
System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection, Version=5.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (0x80131621)
File name: 'Microsoft.Extensions.DependencyInjection, Version=5.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60'
 ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection, Version=5.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)
   at Cake.Console.CakeHostBuilder.BuildScriptHost[T](ICakeArguments args)
   at Cake.Console.CakeHostBuilder.BuildHost(IEnumerable`1 args)
   at Submission#0.<<Initialize>>d__0.MoveNext() in C:\github\Cake.Console\dotnet-script\test.csx:line 9
--- End of stack trace from previous location ---
   at Dotnet.Script.Core.ScriptRunner.Execute[TReturn](String dllPath, IEnumerable`1 commandLineArgs) in C:\Users\VssAdministrator\AppData\Local\Temp\tmpBFB\Dotnet.Script.Core\ScriptRunner.cs:line 110

Exclusive and a few other common Cake Arguments not supported

Both Cake scripting and Frosting use Spectre.Console and now that Cake.CLI is used that dependency already exists in the project.
This would solve #3 too.

To align with Cake maybe Frosting's settings could be a good starting point
https://github.com/cake-build/cake/blob/b8c287aea1f084be96ffca9d82587e41e8a582da/src/Cake.Frosting/Internal/Commands/DefaultCommandSettings.cs#L13-L54

internal sealed class DefaultCommandSettings : CommandSettings
    {
        [CommandOption("--target|-t <TARGET>")]
        [DefaultValue("Default")]
        [Description("Target task to invoke.")]
        public string Target { get; set; }

        [CommandOption("--working|-w <PATH>")]
        [TypeConverter(typeof(Cli.DirectoryPathConverter))]
        [Description("Sets the working directory")]
        public DirectoryPath WorkingDirectory { get; set; }

        [CommandOption("--verbosity|-v <VERBOSITY>")]
        [Description("Specifies the amount of information to be displayed.\n(Quiet, Minimal, Normal, Verbose, Diagnostic)")]
        [TypeConverter(typeof(VerbosityConverter))]
        [DefaultValue(Verbosity.Normal)]
        public Verbosity Verbosity { get; set; }

        [CommandOption("--description|--descriptions|--showdescription|--showdescriptions")]
        [Description("Shows description for each task.")]
        public bool Description { get; set; }

        [CommandOption("--tree|--showtree")]
        [Description("Shows the task dependency tree.")]
        public bool Tree { get; set; }

        [CommandOption("--dryrun|--noop|--whatif")]
        [Description("Performs a dry run.")]
        public bool DryRun { get; set; }

        [CommandOption("--exclusive|-e")]
        [Description("Executes the target task without any dependencies.")]
        public bool Exclusive { get; set; }

        [CommandOption("--version|--ver")]
        [Description("Displays version information.")]
        public bool Version { get; set; }

        [CommandOption("--info")]
        [Description("Displays additional information about Cake.")]
        public bool Info { get; set; }
    }

Frosting's default command could be used as inspiration on how Spectre.Console parsed commands are passed to Frosting
https://github.com/cake-build/cake/blob/b8c287aea1f084be96ffca9d82587e41e8a582da/src/Cake.Frosting/Internal/Commands/DefaultCommand.cs#L30

And here how it's done in Cake scripting engine
https://github.com/cake-build/cake/blob/a1893a2bba26f49e089d66beeb78421cedf6126d/src/Cake/Infrastructure/ContainerConfigurator.cs#L28

Better logging on applying SetupContextDataBehaviour

Generics could be resolved

foreach (var behaviour in provider.GetServices<IHostBuilderBehaviour>())
{
    host.Context.Debug($"Applying {behaviour.GetType().Name}");
    behaviour.Run();
}

Exepected to log SetupContextDataBehaviour instead of SetupContextDataBehaviour`1

Add example

It would be great with an example showing how to get started with Cake.Console.

Add license

Currently, the project lacks a license.

Cake itself uses MIT i.e., and most addins do, but obviously totally up to the author.

But for people to try & adopt, it's good practice to have a license in the repo.

Smarter Cmdline parsing

Currently is very naive

args.Select(a => a.Replace("-", string.Empty).Split("="))
       .ToDictionary(
          pair => pair[0],
          pair => pair.Length > 1 ? pair[1] : "true");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.