Exemplo n.º 1
0
        private static void IntializeMvc(IPathProvider pathProvider, IRubyEngine engine)
        {
            var factory = new RubyControllerFactory(pathProvider, ControllerBuilder.Current.GetControllerFactory(), engine);

            ControllerBuilder.Current.SetControllerFactory(factory);
            ViewEngines.Engines.Add(new RubyViewEngine(engine));
        }
Exemplo n.º 2
0
        protected void Application_Start(object sender, EventArgs e)
        {
            var pathProvider = new VirtualPathProvider();

            RubyEngine = Core.RubyEngine.InitializeIronRubyMvc(pathProvider, "~/routes.rb");
            OnStart();
        }
Exemplo n.º 3
0
 internal void InternalInitialize(ControllerConfiguration config)
 {
     Initialize(config.Context);
     _engine        = config.Engine;
     ControllerName = config.RubyClass.Name.Replace("Controller", string.Empty);
     RubyType       = config.RubyClass;
     Binders        = RubyModelBinders.Binders;
 }
Exemplo n.º 4
0
        protected override void EstablishContext()
        {
            _rubyEngine        = Dependency <IRubyEngine>();
            _controllerFactory = Dependency <IControllerFactory>();
            _pathProvider      = Dependency <IPathProvider>();

            _controller = Dependency <RubyController>();
        }
Exemplo n.º 5
0
        protected override void EstablishContext()
        {
            base.EstablishContext();


            _pathProvider = Dependency <IPathProvider>();
            _pathProvider.WhenToldTo(pp => pp.ApplicationPhysicalPath).Return(Environment.CurrentDirectory);

            _rubyEngine = new RubyEngine(_scriptRuntime, _pathProvider);
        }
Exemplo n.º 6
0
        private static void ProcessRubyRoutes(IRubyEngine engine, IPathProvider vpp, string routesPath)
        {
            if (!vpp.FileExists(routesPath))
            {
                return;
            }
            var routeCollection = new RubyRoutes(RouteTable.Routes);

            engine.DefineReadOnlyGlobalVariable("routes", routeCollection);
            engine.RequireRubyFile(routesPath, ReaderType.File);
        }
Exemplo n.º 7
0
        public RubyViewEngine(IRubyEngine rubyEngine)
        {
            _rubyEngine = rubyEngine;
            PartialViewLocationFormats = new[]
            {
                "~/Views/{1}/_{0}.html.erb",
                "~/Views/Shared/_{0}.html.erb"
            };

            ViewLocationFormats = new[]
            {
                "~/Views/{1}/{0}.html.erb",
                "~/Views/Shared/{0}.html.erb",
            };

            MasterLocationFormats = new[]
            {
                "~/Views/{1}/{0}.html.erb",
                "~/Views/Shared/{0}.html.erb"
            };
        }
Exemplo n.º 8
0
        public RubyViewEngine(IRubyEngine rubyEngine)
        {
            _rubyEngine = rubyEngine;
            PartialViewLocationFormats = new[]
                                             {
                                                 "~/Views/{1}/_{0}.html.erb",
                                                 "~/Views/Shared/_{0}.html.erb"
                                             };

            ViewLocationFormats = new[]
                                      {
                                          "~/Views/{1}/{0}.html.erb",
                                          "~/Views/Shared/{0}.html.erb",
                                      };

            MasterLocationFormats = new[]
                                        {
                                            "~/Views/{1}/{0}.html.erb",
                                            "~/Views/Shared/{0}.html.erb"
                                        };
        }
Exemplo n.º 9
0
        private bool InitializeRubyEngine(HttpApplication context)
        {
            var rubyMvcApp = context as RubyMvcApplication;

            if (rubyMvcApp.IsNull())
            {
                return(false);
            }

            if (rubyMvcApp.RubyEngine.IsNull())
            {
                rubyMvcApp.RubyEngine = RubyEngine.InitializeIronRubyMvc(new VirtualPathProvider(), "~/routes.rb");
            }

            if (_rubyEngine.IsNull())
            {
                _rubyEngine = rubyMvcApp.RubyEngine;
            }

            return(true);
        }
Exemplo n.º 10
0
 public RubyActionDescriptor(string actionName, ControllerDescriptor controllerDescriptor, IRubyEngine engine)
 {
     RubyEngine            = engine;
     _actionName           = actionName;
     _controllerDescriptor = controllerDescriptor;
 }
Exemplo n.º 11
0
 public RubyActionDescriptor(string actionName, ControllerDescriptor controllerDescriptor, IRubyEngine engine)
 {
     RubyEngine = engine;
     _actionName = actionName;
     _controllerDescriptor = controllerDescriptor;
 }
Exemplo n.º 12
0
 public RubyControllerFactory(IPathProvider pathProvider, IControllerFactory innerFactory, IRubyEngine engine)
     : base(pathProvider, innerFactory, engine)
 {
     _engine = engine;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RubyControllerActionInvoker"/> class.
 /// </summary>
 /// <param name="controllerName">Name of the controller.</param>
 /// <param name="engine">The engine.</param>
 public RubyControllerActionInvoker(string controllerName, IRubyEngine engine)
 {
     ControllerName = controllerName;
     RubyEngine     = engine;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RubyControllerActionInvoker"/> class.
 /// </summary>
 /// <param name="controllerName">Name of the controller.</param>
 /// <param name="engine">The engine.</param>
 public RubyControllerActionInvoker(string controllerName, IRubyEngine engine)
 {
     ControllerName = controllerName;
     RubyEngine = engine;
 }
Exemplo n.º 15
0
 protected void Application_Start(object sender, EventArgs e)
 {
     var pathProvider = new VirtualPathProvider();
     RubyEngine = Core.RubyEngine.InitializeIronRubyMvc(pathProvider, "~/routes.rb");
     OnStart();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="RubyControllerDescriptor"/> class.
 /// </summary>
 /// <param name="rubyClass">The ruby class.</param>
 /// <param name="engine">The engine.</param>
 public RubyControllerDescriptor(RubyClass rubyClass, IRubyEngine engine)
 {
     _engine = engine;
     RubyControllerClass = rubyClass;
     _selector = new RubyActionMethodSelector(engine, rubyClass);
 }
Exemplo n.º 17
0
 internal void InternalInitialize(ControllerConfiguration config)
 {
     Initialize(config.Context);
     _engine = config.Engine;
     ControllerName = config.RubyClass.Name.Replace("Controller", string.Empty);
     RubyType = config.RubyClass;
     Binders = RubyModelBinders.Binders;
 }
 public RubyModuleLoaderPlugin(IKernel kernel, IRubyEngine engine)
 {
     _engine = engine;
     Kernel = kernel;
 }
Exemplo n.º 19
0
 public RubyView(IRubyEngine rubyEngine, string viewContents, RubyView master)
 {
     _rubyEngine = rubyEngine;
     _master = master;
     _contents = viewContents;
 }
Exemplo n.º 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RubyControllerDescriptor"/> class.
 /// </summary>
 /// <param name="rubyClass">The ruby class.</param>
 /// <param name="engine">The engine.</param>
 public RubyControllerDescriptor(RubyClass rubyClass, IRubyEngine engine)
 {
     _engine             = engine;
     RubyControllerClass = rubyClass;
     _selector           = new RubyActionMethodSelector(engine, rubyClass);
 }
Exemplo n.º 21
0
 internal RubyControllerFactory(IPathProvider pathProvider, IControllerFactory innerFactory, IRubyEngine engine)
 {
     _pathProvider = pathProvider;
     _innerFactory = innerFactory;
     _engine = engine;
 }
Exemplo n.º 22
0
 public RubyModule(IRubyEngine engine, string scriptPath)
 {
     _engine = engine;
     _scriptPath = scriptPath;
 }
Exemplo n.º 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RubyControllerDescriptor"/> class.
 /// </summary>
 /// <param name="rubyClass">The ruby class.</param>
 /// <param name="engine">The engine.</param>
 public RubyControllerDescriptor(RubyClass rubyClass, IRubyEngine engine)
     : base(engine, new RubyActionMethodSelector(engine, rubyClass))
 {
     RubyControllerClass = rubyClass;
 }
Exemplo n.º 24
0
 public RubyView(IRubyEngine rubyEngine, string viewContents, RubyView master)
 {
     _rubyEngine = rubyEngine;
     _master     = master;
     _contents   = viewContents;
 }
Exemplo n.º 25
0
 internal RubyControllerFactory(IPathProvider pathProvider, IControllerFactory innerFactory, IRubyEngine engine)
 {
     _pathProvider = pathProvider;
     _innerFactory = innerFactory;
     _engine       = engine;
 }
Exemplo n.º 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RubyActionMethodSelector"/> class.
 /// </summary>
 /// <param name="rubyEngine">The ruby engine.</param>
 /// <param name="rubyClass">The ruby class.</param>
 public RubyActionMethodSelector(IRubyEngine rubyEngine, RubyClass rubyClass)
 {
     ControllerClass = rubyClass;
     _rubyEngine     = rubyEngine;
 }
Exemplo n.º 27
0
 public RubyModule(IRubyEngine engine, string scriptPath)
 {
     _engine     = engine;
     _scriptPath = scriptPath;
 }
Exemplo n.º 28
0
        private bool InitializeRubyEngine(HttpApplication context)
        {
            var rubyMvcApp = context as RubyMvcApplication;
            if(rubyMvcApp.IsNull()) return false;

            if(rubyMvcApp.RubyEngine.IsNull())
                rubyMvcApp.RubyEngine = RubyEngine.InitializeIronRubyMvc(new VirtualPathProvider(), "~/routes.rb");

            if (_rubyEngine.IsNull())
                _rubyEngine = rubyMvcApp.RubyEngine;

            return true;
        }
Exemplo n.º 29
0
 public RubyModuleLoaderPlugin(IKernel kernel, IRubyEngine engine)
 {
     _engine = engine;
     Kernel  = kernel;
 }