Renaming a module/theme step attribute from name to packageId.

--HG--
branch : dev
This commit is contained in:
Suha Can
2011-03-24 14:50:04 -07:00
parent c3bfa268dd
commit 517a040f78
5 changed files with 20 additions and 20 deletions

View File

@@ -80,7 +80,7 @@ Features:
ModuleRecipeHandler moduleRecipeHandler = _container.Resolve<ModuleRecipeHandler>();
RecipeContext recipeContext = new RecipeContext { RecipeStep = new RecipeStep { Name = "Module", Step = new XElement("SuperWiki") } };
recipeContext.RecipeStep.Step.Add(new XAttribute("name", "SuperWiki"));
recipeContext.RecipeStep.Step.Add(new XAttribute("packageId", "SuperWiki"));
recipeContext.RecipeStep.Step.Add(new XAttribute("repository", "test"));
IFeatureManager featureManager = _container.Resolve<IFeatureManager>();

View File

@@ -85,7 +85,7 @@ Features:
ThemeRecipeHandler themeRecipeHandler = _container.Resolve<ThemeRecipeHandler>();
RecipeContext recipeContext = new RecipeContext { RecipeStep = new RecipeStep { Name = "Theme", Step = new XElement("SuperWiki") } };
recipeContext.RecipeStep.Step.Add(new XAttribute("name", "SuperWiki"));
recipeContext.RecipeStep.Step.Add(new XAttribute("packageId", "SuperWiki"));
recipeContext.RecipeStep.Step.Add(new XAttribute("repository", "test"));
IFeatureManager featureManager = _container.Resolve<IFeatureManager>();

View File

@@ -10,7 +10,7 @@
</Recipe>
<!-- Steps -->
<Module name="module1" repository="somerepo" version="1.1" />
<Module packageId="module1" repository="somerepo" version="1.1" />
<Feature disable="f1, f2" enable="f3,f4" />
@@ -37,7 +37,7 @@
<Migration features="f2,f4"/>
<Theme name="theme1" repository="somerepo" />
<Theme packageId="theme1" repository="somerepo" />
<Custom1 attr1="value1" />
<Custom2 attr2="value2" />

View File

@@ -39,17 +39,17 @@ namespace Orchard.Recipes.RecipeHandlers {
public Localizer T { get; set; }
ILogger Logger { get; set; }
// <Module name="module1" [repository="somerepo"] version="1.1" />
// <Module packageId="module1" [repository="somerepo"] version="1.1" />
// install modules from feed.
public void ExecuteRecipeStep(RecipeContext recipeContext) {
if (!String.Equals(recipeContext.RecipeStep.Name, "Module", StringComparison.OrdinalIgnoreCase)) {
return;
}
string name = null, version = null, repository = null;
string packageId = null, version = null, repository = null;
foreach (var attribute in recipeContext.RecipeStep.Step.Attributes()) {
if (String.Equals(attribute.Name.LocalName, "name", StringComparison.OrdinalIgnoreCase)) {
name = attribute.Value;
if (String.Equals(attribute.Name.LocalName, "packageId", StringComparison.OrdinalIgnoreCase)) {
packageId = attribute.Value;
}
else if (String.Equals(attribute.Name.LocalName, "version", StringComparison.OrdinalIgnoreCase)) {
version = attribute.Value;
@@ -62,8 +62,8 @@ namespace Orchard.Recipes.RecipeHandlers {
}
}
if (name == null) {
throw new InvalidOperationException("Name is required in a Module declaration in a recipe file.");
if (packageId == null) {
throw new InvalidOperationException("PackageId is required in a Module declaration in a recipe file.");
}
// download and install module from the orchard feed or a custom feed if repository is specified.
@@ -79,7 +79,7 @@ namespace Orchard.Recipes.RecipeHandlers {
var packagingEntry = _packagingSourceManager.GetExtensionList(packagingSource,
packages => packages.Where(package =>
package.PackageType.Equals(DefaultExtensionTypes.Module) &&
package.Id.Equals(name, StringComparison.OrdinalIgnoreCase) &&
package.Id.Equals(packageId, StringComparison.OrdinalIgnoreCase) &&
(!enforceVersion || package.Version.Equals(version, StringComparison.OrdinalIgnoreCase))))
.FirstOrDefault();
@@ -98,7 +98,7 @@ namespace Orchard.Recipes.RecipeHandlers {
}
if (!installed) {
throw new InvalidOperationException(string.Format("Module {0} was not found in the specified location.", name));
throw new InvalidOperationException(string.Format("Module {0} was not found in the specified location.", packageId));
}
recipeContext.Executed = true;

View File

@@ -39,7 +39,7 @@ namespace Orchard.Recipes.RecipeHandlers {
public Localizer T { get; set; }
ILogger Logger { get; set; }
// <Theme name="theme1" repository="somethemerepo" version="1.1" enable="true" current="true" />
// <Theme packageId="theme1" repository="somethemerepo" version="1.1" enable="true" current="true" />
// install themes from feed.
public void ExecuteRecipeStep(RecipeContext recipeContext) {
if (!String.Equals(recipeContext.RecipeStep.Name, "Theme", StringComparison.OrdinalIgnoreCase)) {
@@ -47,7 +47,7 @@ namespace Orchard.Recipes.RecipeHandlers {
}
bool enable = false, current = false;
string name = null, version = null, repository = null;
string packageId = null, version = null, repository = null;
foreach (var attribute in recipeContext.RecipeStep.Step.Attributes()) {
if (String.Equals(attribute.Name.LocalName, "enable", StringComparison.OrdinalIgnoreCase)) {
@@ -56,8 +56,8 @@ namespace Orchard.Recipes.RecipeHandlers {
else if (String.Equals(attribute.Name.LocalName, "current", StringComparison.OrdinalIgnoreCase)) {
current = Boolean.Parse(attribute.Value);
}
else if (String.Equals(attribute.Name.LocalName, "name", StringComparison.OrdinalIgnoreCase)) {
name = attribute.Value;
else if (String.Equals(attribute.Name.LocalName, "packageId", StringComparison.OrdinalIgnoreCase)) {
packageId = attribute.Value;
}
else if (String.Equals(attribute.Name.LocalName, "version", StringComparison.OrdinalIgnoreCase)) {
version = attribute.Value;
@@ -70,8 +70,8 @@ namespace Orchard.Recipes.RecipeHandlers {
}
}
if (name == null) {
throw new InvalidOperationException("Name is required in a Theme declaration in a recipe file.");
if (packageId == null) {
throw new InvalidOperationException("PackageId is required in a Theme declaration in a recipe file.");
}
// download and install theme from the orchard feed or a custom feed if repository is specified.
@@ -87,7 +87,7 @@ namespace Orchard.Recipes.RecipeHandlers {
var packagingEntry = _packagingSourceManager.GetExtensionList(packagingSource,
packages => packages.Where(package =>
package.PackageType.Equals(DefaultExtensionTypes.Theme) &&
package.Id.Equals(name, StringComparison.OrdinalIgnoreCase) &&
package.Id.Equals(packageId, StringComparison.OrdinalIgnoreCase) &&
(!enforceVersion || package.Version.Equals(version, StringComparison.OrdinalIgnoreCase))))
.FirstOrDefault();
@@ -106,7 +106,7 @@ namespace Orchard.Recipes.RecipeHandlers {
}
if (!installed) {
throw new InvalidOperationException(string.Format("Theme {0} was not found in the specified location.", name));
throw new InvalidOperationException(string.Format("Theme {0} was not found in the specified location.", packageId));
}
recipeContext.Executed = true;