public override ViewCompiler CreateViewCompiler(ISparkViewEngine engine, SparkViewDescriptor descriptor) { ViewCompiler viewCompiler; switch (descriptor.Language) { case LanguageType.Default: case LanguageType.Ruby: viewCompiler = new RubyViewCompiler(); break; default: return base.CreateViewCompiler(engine, descriptor); } var pageBaseType = engine.Settings.PageBaseType; if (string.IsNullOrEmpty(pageBaseType)) pageBaseType = engine.DefaultPageBaseType; viewCompiler.BaseClass = pageBaseType; viewCompiler.Descriptor = descriptor; viewCompiler.Debug = engine.Settings.Debug; viewCompiler.NullBehaviour = engine.Settings.NullBehaviour; viewCompiler.UseAssemblies = engine.Settings.UseAssemblies; viewCompiler.UseNamespaces = engine.Settings.UseNamespaces; return viewCompiler; }
public void Init() { _compiler = new RubyViewCompiler { BaseClass = typeof(StubSparkView).FullName,Debug = true }; _languageFactory = new RubyLanguageFactory(); //load assemblies global::IronRuby.Ruby.CreateEngine(); }
public void InstanceCreated(RubyViewCompiler compiler, IScriptingSparkView view) { CompiledCode compiledCode; if (!_compiledViewScripts.TryGetValue(view.GeneratedViewId, out compiledCode)) { var scriptSource = ScriptEngine.CreateScriptSourceFromString(view.ScriptSource, SourceCodeKind.File); compiledCode = scriptSource.Compile(); _compiledViewScripts.Add(view.GeneratedViewId, compiledCode); } view.CompiledCode = compiledCode; }
public void InstanceReleased(RubyViewCompiler compiler, IScriptingSparkView view) { }