diff --git a/RELEASE.md b/RELEASE.md index 5759b45c9..707f3f0e2 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,5 +1,7 @@ # 1.0.0-alpha.20 +- Split `DefaultFeatures.Commands` into `DefaultFeatures.BuildCommands`, `DefaultFeatures.HostingCommands`, and `DefaultFeatures.CustomCommands` for finer control. +- Renamed `DefaultsToAdd` to `DefaultFeatures`. - Adds a new `ThrowException` module that can be used to throw exceptions based on a config value. - Renames `BuildCommand` to `PipelinesCommand`. - Refactors default commands by renaming `build` to `pipelines` and accepting pipelines to execute as an argument (moving the root path to an option). diff --git a/src/core/Statiq.App/Bootstrapper/Bootstrapper.cs b/src/core/Statiq.App/Bootstrapper/Bootstrapper.cs index 9d2675ac0..463d0346c 100644 --- a/src/core/Statiq.App/Bootstrapper/Bootstrapper.cs +++ b/src/core/Statiq.App/Bootstrapper/Bootstrapper.cs @@ -119,7 +119,7 @@ public async Task RunAsync() /// /// /// Use this method when you want to fully customize the bootstrapper and engine. - /// Otherwise use on of the overloads to + /// Otherwise use on of the overloads to /// create an initialize a bootstrapper with an initial set of default configurations. /// /// The command line arguments. @@ -131,12 +131,12 @@ public async Task RunAsync() /// shortcodes, and assembly scanning. /// /// The command line arguments. - /// The default configurations to add to the bootstrapper. + /// The default configurations to add to the bootstrapper. /// The bootstrapper. - public static IBootstrapper CreateDefault(string[] args, DefaultsToAdd defaultsToAdd = DefaultsToAdd.All) => - Create(args).AddDefaults(defaultsToAdd); + public static IBootstrapper CreateDefault(string[] args, DefaultFeatures features = DefaultFeatures.All) => + Create(args).AddDefaults(features); - public static IBootstrapper CreateDefaultWithout(string[] args, DefaultsToAdd withoutDefaults) => - Create(args).AddDefaultsWithout(withoutDefaults); + public static IBootstrapper CreateDefaultWithout(string[] args, DefaultFeatures features) => + Create(args).AddDefaultsWithout(features); } } diff --git a/src/core/Statiq.App/Bootstrapper/DefaultsToAdd.cs b/src/core/Statiq.App/Bootstrapper/DefaultFeatures.cs similarity index 61% rename from src/core/Statiq.App/Bootstrapper/DefaultsToAdd.cs rename to src/core/Statiq.App/Bootstrapper/DefaultFeatures.cs index 07bb38fb3..50e054df9 100644 --- a/src/core/Statiq.App/Bootstrapper/DefaultsToAdd.cs +++ b/src/core/Statiq.App/Bootstrapper/DefaultFeatures.cs @@ -3,7 +3,7 @@ namespace Statiq.App { [Flags] - public enum DefaultsToAdd + public enum DefaultFeatures { None = 0, BootstrapperConfigurators = 1 << 0, @@ -11,17 +11,21 @@ public enum DefaultsToAdd Settings = 1 << 2, EnvironmentVariables = 1 << 3, ConfigurationFiles = 1 << 4, - Commands = 1 << 5, - Shortcodes = 1 << 6, - Namespaces = 1 << 7, - Pipelines = 1 << 8, + BuildCommands = 1 << 5, + HostingCommands = 1 << 6, + CustomCommands = 1 << 7, + Shortcodes = 1 << 8, + Namespaces = 1 << 9, + Pipelines = 1 << 10, All = BootstrapperConfigurators | Logging | Settings | EnvironmentVariables | ConfigurationFiles - | Commands + | BuildCommands + | HostingCommands + | CustomCommands | Shortcodes | Namespaces | Pipelines diff --git a/src/core/Statiq.App/Bootstrapper/IBootstrapper.DefaultDefaults.cs b/src/core/Statiq.App/Bootstrapper/IBootstrapper.DefaultDefaults.cs index 04b0a80c1..4b2703049 100644 --- a/src/core/Statiq.App/Bootstrapper/IBootstrapper.DefaultDefaults.cs +++ b/src/core/Statiq.App/Bootstrapper/IBootstrapper.DefaultDefaults.cs @@ -15,49 +15,57 @@ namespace Statiq.App { public partial interface IBootstrapper { - public IBootstrapper AddDefaults(DefaultsToAdd defaultsToAdd = DefaultsToAdd.All) + public IBootstrapper AddDefaults(DefaultFeatures features = DefaultFeatures.All) { - if (defaultsToAdd.HasFlag(DefaultsToAdd.BootstrapperConfigurators)) + if (features.HasFlag(DefaultFeatures.BootstrapperConfigurators)) { AddBootstrapperConfigurators(); } - if (defaultsToAdd.HasFlag(DefaultsToAdd.Logging)) + if (features.HasFlag(DefaultFeatures.Logging)) { AddDefaultLogging(); } - if (defaultsToAdd.HasFlag(DefaultsToAdd.Settings)) + if (features.HasFlag(DefaultFeatures.Settings)) { AddDefaultSettings(); } - if (defaultsToAdd.HasFlag(DefaultsToAdd.EnvironmentVariables)) + if (features.HasFlag(DefaultFeatures.EnvironmentVariables)) { AddEnvironmentVariables(); } - if (defaultsToAdd.HasFlag(DefaultsToAdd.ConfigurationFiles)) + if (features.HasFlag(DefaultFeatures.ConfigurationFiles)) { AddDefaultConfigurationFiles(); } - if (defaultsToAdd.HasFlag(DefaultsToAdd.Commands)) + if (features.HasFlag(DefaultFeatures.BuildCommands)) { - AddDefaultCommands(); + AddBuildCommands(); } - if (defaultsToAdd.HasFlag(DefaultsToAdd.Shortcodes)) + if (features.HasFlag(DefaultFeatures.HostingCommands)) + { + AddHostingCommands(); + } + if (features.HasFlag(DefaultFeatures.CustomCommands)) + { + AddCustomCommands(); + } + if (features.HasFlag(DefaultFeatures.Shortcodes)) { AddDefaultShortcodes(); } - if (defaultsToAdd.HasFlag(DefaultsToAdd.Namespaces)) + if (features.HasFlag(DefaultFeatures.Namespaces)) { AddDefaultNamespaces(); } - if (defaultsToAdd.HasFlag(DefaultsToAdd.Pipelines)) + if (features.HasFlag(DefaultFeatures.Pipelines)) { AddDefaultPipelines(); } return this; } - public IBootstrapper AddDefaultsWithout(DefaultsToAdd withoutDefaults) => - AddDefaults(DefaultsToAdd.All & ~withoutDefaults); + public IBootstrapper AddDefaultsWithout(DefaultFeatures withoutFeatures) => + AddDefaults(DefaultFeatures.All & ~withoutFeatures); public IBootstrapper AddBootstrapperConfigurators() { @@ -100,13 +108,24 @@ public IBootstrapper AddDefaultConfigurationFiles() => .AddJsonFile("appsettings.json", true) .AddJsonFile("statiq.json", true)); - public IBootstrapper AddDefaultCommands() + public IBootstrapper AddBuildCommands() { SetDefaultCommand>(); AddCommand>(); - AddCommand(); AddCommand(); + AddCommands(); + return this; + } + + public IBootstrapper AddHostingCommands() + { + AddCommand(); AddCommand(); + return this; + } + + public IBootstrapper AddCustomCommands() + { AddCommands(); return this; } diff --git a/src/core/Statiq.Hosting/Statiq.Hosting.csproj b/src/core/Statiq.Hosting/Statiq.Hosting.csproj index d8a04ed2d..74df13b4e 100644 --- a/src/core/Statiq.Hosting/Statiq.Hosting.csproj +++ b/src/core/Statiq.Hosting/Statiq.Hosting.csproj @@ -28,4 +28,7 @@ + + + \ No newline at end of file