예제 #1
0
        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;
        }
예제 #2
0
        public void Init()
        {
            _compiler = new RubyViewCompiler
                        {
                            BaseClass = typeof(StubSparkView).FullName,Debug = true
                        };
            _languageFactory = new RubyLanguageFactory();

            //load assemblies
            global::IronRuby.Ruby.CreateEngine();
        }
예제 #3
0
 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;
 }
예제 #4
0
 public void InstanceReleased(RubyViewCompiler compiler, IScriptingSparkView view)
 {
 }