Fixing Widget / Scripting / Framework dependency loading.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2010-11-20 15:38:56 -08:00
parent e208860ea2
commit 53bddd53d9
25 changed files with 38 additions and 44 deletions

View File

@@ -1,3 +1,3 @@
setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SqlCe /EnabledFeatures:Profiling,Orchard.Framework,Routable,Common,Dashboard,Feeds,Orchard.PublishLater,HomePage,Contents,Navigation,Reports,Scheduling,Indexing,Settings,Localization,XmlRpc,Orchard.Users,Orchard.Roles,TinyMce,Orchard.Themes,Orchard.MultiTenancy,Orchard.Blogs,Orchard.Comments,Orchard.Modules,Orchard.Widgets,Orchard.Media,Orchard.Tags,Orchard.Experimental setup /SiteName:Profiling /AdminUsername:admin /AdminPassword:profiling-secret /DatabaseProvider:SqlCe /EnabledFeatures:Profiling,Orchard.Framework,Routable,Common,Dashboard,Feeds,Orchard.PublishLater,HomePage,Contents,Navigation,Reports,Scheduling,Indexing,Settings,Localization,XmlRpc,Orchard.Users,Orchard.Roles,TinyMce,Orchard.Themes,Orchard.MultiTenancy,Orchard.Blogs,Orchard.Comments,Orchard.Modules,Orchard.Scripting,Orchard.Widgets,Orchard.Media,Orchard.Tags,Orchard.Experimental
add profiling data add profiling data
feature disable Orchard.Experimental feature disable Orchard.Experimental

View File

@@ -13,7 +13,7 @@ namespace Orchard.Specs.Bindings {
var webApp = Binding<WebAppHosting>(); var webApp = Binding<WebAppHosting>();
webApp.GivenIHaveACleanSiteWith(TableData( webApp.GivenIHaveACleanSiteWith(TableData(
new { extension = "module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" }, new { extension = "module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" },
new { extension = "core", names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" }, new { extension = "core", names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" },
new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" })); new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));

View File

@@ -20,7 +20,7 @@ namespace Orchard.Tests.Modules.Scripting {
[SetUp] [SetUp]
public void Init() { public void Init() {
var builder = new ContainerBuilder(); var builder = new ContainerBuilder();
builder.RegisterType<ScriptingRuntime>().As<IScriptingRuntime>(); builder.RegisterType<RubyScriptingRuntime>().As<IScriptingRuntime>();
builder.RegisterType<ScriptingManager>().As<IScriptingManager>(); builder.RegisterType<ScriptingManager>().As<IScriptingManager>();
_container = builder.Build(); _container = builder.Build();
_scriptingRuntime = _container.Resolve<IScriptingRuntime>(); _scriptingRuntime = _container.Resolve<IScriptingRuntime>();

View File

@@ -2,8 +2,8 @@
using NUnit.Framework; using NUnit.Framework;
using Orchard.Mvc; using Orchard.Mvc;
using Orchard.Tests.Stubs; using Orchard.Tests.Stubs;
using Orchard.UI.Widgets;
using Orchard.Widgets.RuleEngine; using Orchard.Widgets.RuleEngine;
using Orchard.Widgets.Services;
namespace Orchard.Tests.Modules.Widgets.RuleEngine { namespace Orchard.Tests.Modules.Widgets.RuleEngine {
[TestFixture] [TestFixture]

View File

@@ -20,8 +20,6 @@ using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Features; using Orchard.Environment.Features;
using Orchard.Security; using Orchard.Security;
using Orchard.Tests.Stubs; using Orchard.Tests.Stubs;
using Orchard.Themes;
using Orchard.Themes.Models;
using Orchard.UI.Notify; using Orchard.UI.Notify;
using Orchard.Widgets.Models; using Orchard.Widgets.Models;
using Orchard.Widgets.Services; using Orchard.Widgets.Services;

View File

@@ -2,8 +2,8 @@
using Autofac; using Autofac;
using NUnit.Framework; using NUnit.Framework;
using Orchard.Scripting.Services; using Orchard.Scripting.Services;
using Orchard.UI.Widgets;
using Orchard.Widgets.RuleEngine; using Orchard.Widgets.RuleEngine;
using Orchard.Widgets.Services;
namespace Orchard.Tests.Modules.Widgets { namespace Orchard.Tests.Modules.Widgets {
[TestFixture] [TestFixture]
@@ -14,7 +14,7 @@ namespace Orchard.Tests.Modules.Widgets {
[SetUp] [SetUp]
public void Init() { public void Init() {
var builder = new ContainerBuilder(); var builder = new ContainerBuilder();
builder.RegisterType<ScriptingRuntime>().As<IScriptingRuntime>(); builder.RegisterType<RubyScriptingRuntime>().As<IScriptingRuntime>();
builder.RegisterType<ScriptingManager>().As<IScriptingManager>(); builder.RegisterType<ScriptingManager>().As<IScriptingManager>();
builder.RegisterType<AlwaysTrueRuleProvider>().As<IRuleProvider>(); builder.RegisterType<AlwaysTrueRuleProvider>().As<IRuleProvider>();
builder.RegisterType<RuleManager>().As<IRuleManager>(); builder.RegisterType<RuleManager>().As<IRuleManager>();

View File

@@ -87,8 +87,8 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\IScriptingManager.cs" /> <Compile Include="Services\IScriptingManager.cs" />
<Compile Include="Services\IScriptingRuntime.cs" /> <Compile Include="Services\IScriptingRuntime.cs" />
<Compile Include="Services\RubyScriptingRuntime.cs" />
<Compile Include="Services\ScriptingManager.cs" /> <Compile Include="Services\ScriptingManager.cs" />
<Compile Include="Services\ScriptingRuntime.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj"> <ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">

View File

@@ -9,4 +9,4 @@ namespace Orchard.Scripting.Services {
void ExecuteFile(string fileName); void ExecuteFile(string fileName);
dynamic ExecuteOperation(Func<ObjectOperations, object> invoke); dynamic ExecuteOperation(Func<ObjectOperations, object> invoke);
} }
} }

View File

@@ -6,4 +6,4 @@ namespace Orchard.Scripting.Services {
dynamic ExecuteExpression(string expression, ScriptScope scope); dynamic ExecuteExpression(string expression, ScriptScope scope);
void ExecuteFile(string fileName, ScriptScope scope); void ExecuteFile(string fileName, ScriptScope scope);
} }
} }

View File

@@ -2,11 +2,11 @@
using Microsoft.Scripting.Hosting; using Microsoft.Scripting.Hosting;
namespace Orchard.Scripting.Services { namespace Orchard.Scripting.Services {
public class ScriptingRuntime : IScriptingRuntime { public class RubyScriptingRuntime : IScriptingRuntime {
private readonly LanguageSetup _defaultLanguageSetup; private readonly LanguageSetup _defaultLanguageSetup;
private readonly ScriptRuntime _scriptingRuntime; private readonly ScriptRuntime _scriptingRuntime;
public ScriptingRuntime() { public RubyScriptingRuntime() {
_defaultLanguageSetup = Ruby.CreateRubySetup(); _defaultLanguageSetup = Ruby.CreateRubySetup();
var setup = new ScriptRuntimeSetup(); var setup = new ScriptRuntimeSetup();
@@ -14,7 +14,7 @@ namespace Orchard.Scripting.Services {
_scriptingRuntime = new ScriptRuntime(setup); _scriptingRuntime = new ScriptRuntime(setup);
} }
ScriptEngine GetDefaultEngine() { public ScriptEngine GetDefaultEngine() {
return _scriptingRuntime.GetEngineByTypeName(_defaultLanguageSetup.TypeName); return _scriptingRuntime.GetEngineByTypeName(_defaultLanguageSetup.TypeName);
} }
@@ -33,4 +33,4 @@ namespace Orchard.Scripting.Services {
engine.ExecuteFile(fileName, scope); engine.ExecuteFile(fileName, scope);
} }
} }
} }

View File

@@ -4,8 +4,8 @@ using Microsoft.Scripting.Hosting;
namespace Orchard.Scripting.Services { namespace Orchard.Scripting.Services {
public class ScriptingManager : IScriptingManager { public class ScriptingManager : IScriptingManager {
private readonly IScriptingRuntime _scriptingRuntime; private readonly IScriptingRuntime _scriptingRuntime;
private Lazy<ScriptScope> _scope; private readonly Lazy<ScriptScope> _scope;
private Lazy<ObjectOperations> _operations; private readonly Lazy<ObjectOperations> _operations;
public ScriptingManager(IScriptingRuntime scriptingRuntime) { public ScriptingManager(IScriptingRuntime scriptingRuntime) {
_scriptingRuntime = scriptingRuntime; _scriptingRuntime = scriptingRuntime;
@@ -32,6 +32,5 @@ namespace Orchard.Scripting.Services {
public void ExecuteFile(string fileName) { public void ExecuteFile(string fileName) {
_scriptingRuntime.ExecuteFile(fileName, _scope.Value); _scriptingRuntime.ExecuteFile(fileName, _scope.Value);
} }
} }
} }

View File

@@ -69,7 +69,7 @@ namespace Orchard.Setup.Services {
string[] hardcoded = { string[] hardcoded = {
// Framework // Framework
"Orchard.Framework", "Orchard.Framework",
// Core // Core
"Common", "Common",
"Containers", "Containers",
@@ -98,6 +98,7 @@ namespace Orchard.Setup.Services {
"Orchard.Tags", "Orchard.Tags",
"Orchard.Themes", "Orchard.Themes",
"Orchard.Users", "Orchard.Users",
"Orchard.Scripting",
"Orchard.Widgets", "Orchard.Widgets",
"TinyMce", "TinyMce",
@@ -108,7 +109,6 @@ namespace Orchard.Setup.Services {
context.EnabledFeatures = hardcoded; context.EnabledFeatures = hardcoded;
} }
var shellSettings = new ShellSettings(_shellSettings); var shellSettings = new ShellSettings(_shellSettings);
if (string.IsNullOrEmpty(shellSettings.DataProvider)) { if (string.IsNullOrEmpty(shellSettings.DataProvider)) {

View File

@@ -4,7 +4,6 @@ using JetBrains.Annotations;
using Orchard.ContentManagement; using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers; using Orchard.ContentManagement.Drivers;
using Orchard.Localization; using Orchard.Localization;
using Orchard.UI.Widgets;
using Orchard.Widgets.Models; using Orchard.Widgets.Models;
using Orchard.Widgets.Services; using Orchard.Widgets.Services;

View File

@@ -7,8 +7,8 @@ using Orchard.Localization;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Mvc.Filters; using Orchard.Mvc.Filters;
using Orchard.UI.Admin; using Orchard.UI.Admin;
using Orchard.UI.Widgets;
using Orchard.Widgets.Models; using Orchard.Widgets.Models;
using Orchard.Widgets.Services;
namespace Orchard.Widgets.Filters { namespace Orchard.Widgets.Filters {
public class WidgetFilter : FilterProvider, IResultFilter { public class WidgetFilter : FilterProvider, IResultFilter {

View File

@@ -9,4 +9,4 @@ Features:
Orchard.Widgets: Orchard.Widgets:
Description: An implementation of widgets. Description: An implementation of widgets.
Category: Widget Category: Widget
Dependencies: Orchard.Scripting Dependencies: Orchard.Scripting

View File

@@ -88,7 +88,10 @@
<Compile Include="RuleEngine\BuiltinRuleProvider.cs" /> <Compile Include="RuleEngine\BuiltinRuleProvider.cs" />
<Compile Include="RuleEngine\RuleManager.cs" /> <Compile Include="RuleEngine\RuleManager.cs" />
<Compile Include="RuleEngine\UrlRuleProvider.cs" /> <Compile Include="RuleEngine\UrlRuleProvider.cs" />
<Compile Include="Services\IRuleManager.cs" />
<Compile Include="Services\IRuleProvider.cs" />
<Compile Include="Services\IWidgetsService.cs" /> <Compile Include="Services\IWidgetsService.cs" />
<Compile Include="Services\RuleContext.cs" />
<Compile Include="Services\WidgetsService.cs" /> <Compile Include="Services\WidgetsService.cs" />
<Compile Include="Shapes.cs" /> <Compile Include="Shapes.cs" />
<Compile Include="ViewModels\WidgetsIndexViewModel.cs" /> <Compile Include="ViewModels\WidgetsIndexViewModel.cs" />

View File

@@ -1,6 +1,6 @@
using System; using System;
using Orchard.Security; using Orchard.Security;
using Orchard.UI.Widgets; using Orchard.Widgets.Services;
namespace Orchard.Widgets.RuleEngine { namespace Orchard.Widgets.RuleEngine {
public class AuthenticatedRuleProvider : IRuleProvider { public class AuthenticatedRuleProvider : IRuleProvider {

View File

@@ -1,5 +1,5 @@
using System; using System;
using Orchard.UI.Widgets; using Orchard.Widgets.Services;
namespace Orchard.Widgets.RuleEngine { namespace Orchard.Widgets.RuleEngine {
public class BuiltinRuleProvider : IRuleProvider { public class BuiltinRuleProvider : IRuleProvider {

View File

@@ -1,8 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Orchard.Scripting;
using Orchard.Scripting.Services; using Orchard.Scripting.Services;
using Orchard.UI.Widgets; using Orchard.Widgets.Services;
namespace Orchard.Widgets.RuleEngine { namespace Orchard.Widgets.RuleEngine {
public class RuleManager : IRuleManager { public class RuleManager : IRuleManager {
@@ -17,15 +16,15 @@ namespace Orchard.Widgets.RuleEngine {
public bool Matches(string expression) { public bool Matches(string expression) {
object execContextType = _scriptingManager.ExecuteExpression(@" object execContextType = _scriptingManager.ExecuteExpression(@"
class ExecContext class ExecContext
def execute(callbacks, text) def execute(callbacks, text)
@callbacks = callbacks; @callbacks = callbacks;
temp = instance_eval(text.to_s); temp = instance_eval(text.to_s);
@callbacks = 0; @callbacks = 0;
return temp; return temp;
end end
def method_missing(name, *args, &block) def method_missing(name, *args, &block)
@callbacks.send(name, args, &block); @callbacks.send(name, args, &block);
end end
end end
ExecContext ExecContext

View File

@@ -1,6 +1,6 @@
using System; using System;
using Orchard.Mvc; using Orchard.Mvc;
using Orchard.UI.Widgets; using Orchard.Widgets.Services;
namespace Orchard.Widgets.RuleEngine { namespace Orchard.Widgets.RuleEngine {
public class UrlRuleProvider : IRuleProvider { public class UrlRuleProvider : IRuleProvider {

View File

@@ -1,4 +1,4 @@
namespace Orchard.UI.Widgets { namespace Orchard.Widgets.Services {
public interface IRuleManager : IDependency { public interface IRuleManager : IDependency {
bool Matches(string expression); bool Matches(string expression);
} }

View File

@@ -1,4 +1,4 @@
namespace Orchard.UI.Widgets { namespace Orchard.Widgets.Services {
public interface IRuleProvider : IDependency { public interface IRuleProvider : IDependency {
void Process(RuleContext ruleContext); void Process(RuleContext ruleContext);
} }

View File

@@ -1,4 +1,4 @@
namespace Orchard.UI.Widgets { namespace Orchard.Widgets.Services {
public class RuleContext { public class RuleContext {
public string FunctionName { get; set; } public string FunctionName { get; set; }
public object[] Arguments { get; set; } public object[] Arguments { get; set; }

View File

@@ -8,7 +8,6 @@ using Autofac.Builder;
using Autofac.Configuration; using Autofac.Configuration;
using Autofac.Core; using Autofac.Core;
using Autofac.Features.Indexed; using Autofac.Features.Indexed;
using Autofac.Integration.Web.Mvc;
using Orchard.Environment.AutofacUtil.DynamicProxy2; using Orchard.Environment.AutofacUtil.DynamicProxy2;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
using Orchard.Environment.ShellBuilders.Models; using Orchard.Environment.ShellBuilders.Models;
@@ -123,4 +122,4 @@ namespace Orchard.Environment.ShellBuilders {
.WithMetadata("Feature", item.Feature); .WithMetadata("Feature", item.Feature);
} }
} }
} }

View File

@@ -180,9 +180,6 @@
<Compile Include="UI\Navigation\Pager.cs" /> <Compile Include="UI\Navigation\Pager.cs" />
<Compile Include="UI\Resources\IResourceManifestProvider.cs" /> <Compile Include="UI\Resources\IResourceManifestProvider.cs" />
<Compile Include="UI\Resources\ResourceManifestBuilder.cs" /> <Compile Include="UI\Resources\ResourceManifestBuilder.cs" />
<Compile Include="UI\Widgets\IRuleManager.cs" />
<Compile Include="UI\Widgets\IRuleProvider.cs" />
<Compile Include="UI\Widgets\RuleContext.cs" />
<Compile Include="UI\Zones\LayoutWorkContext.cs" /> <Compile Include="UI\Zones\LayoutWorkContext.cs" />
<Compile Include="UI\Zones\ZoneHoldingBehavior.cs" /> <Compile Include="UI\Zones\ZoneHoldingBehavior.cs" />
<Compile Include="Mvc\ViewEngines\ThemeAwareness\ConfiguredEnginesCache.cs" /> <Compile Include="Mvc\ViewEngines\ThemeAwareness\ConfiguredEnginesCache.cs" />