Injecting RecipeHarvester impl into the safe mode shell

Setup to call the harvester for the recipes list
SetupContext now contains the recipe for the site, which will be executed
Updated minimal,blog and cms recipe files
Added recipe description to the setup view model to keep it between posts in case of errors

--HG--
branch : recipe
This commit is contained in:
Suha Can
2011-02-12 14:57:11 -08:00
parent 578c107da3
commit e5c821dab3
11 changed files with 81 additions and 35 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Web;
@@ -23,6 +24,8 @@ using Orchard.Environment.Descriptor.Models;
using Orchard.Indexing;
using Orchard.Localization;
using Orchard.Localization.Services;
using Orchard.Recipes.Models;
using Orchard.Recipes.Services;
using Orchard.Reports.Services;
using Orchard.Security;
using Orchard.Settings;
@@ -41,6 +44,8 @@ namespace Orchard.Setup.Services {
private readonly IShellContainerFactory _shellContainerFactory;
private readonly ICompositionStrategy _compositionStrategy;
private readonly IProcessingEngine _processingEngine;
private readonly IRecipeHarvester _recipeHarvester;
private readonly IEnumerable<Recipe> _recipes;
public SetupService(
ShellSettings shellSettings,
@@ -48,13 +53,16 @@ namespace Orchard.Setup.Services {
IShellSettingsManager shellSettingsManager,
IShellContainerFactory shellContainerFactory,
ICompositionStrategy compositionStrategy,
IProcessingEngine processingEngine) {
IProcessingEngine processingEngine,
IRecipeHarvester recipeHarvester) {
_shellSettings = shellSettings;
_orchardHost = orchardHost;
_shellSettingsManager = shellSettingsManager;
_shellContainerFactory = shellContainerFactory;
_compositionStrategy = compositionStrategy;
_processingEngine = processingEngine;
_recipeHarvester = recipeHarvester;
_recipes = _recipeHarvester.HarvestRecipes("Orchard.Setup");
T = NullLocalizer.Instance;
}
@@ -64,6 +72,10 @@ namespace Orchard.Setup.Services {
return _shellSettings;
}
public IEnumerable<Recipe> Recipes() {
return _recipes;
}
public void Setup(SetupContext context) {
// The vanilla Orchard distibution has the following features enabled.
if (context.EnabledFeatures == null || context.EnabledFeatures.Count() == 0) {