Changeset 243

Show
Ignore:
Timestamp:
11/19/08 22:43:30 (2 months ago)
Author:
louis.dejardin
Message:

Making test project for fwk specific ruby library. Trying to duck punch helper extension methods.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/ironruby/spark.build

    r234 r243  
    157157                                <include name="aspnetmvc/*.*" /> 
    158158                                <include name="ironpython/*.*" /> 
     159                                <include name="ironruby/*.*" /> 
    159160                                <include name="mvccontrib/*.*" /> 
    160161                                <include name="castle/*.*" /> 
  • branches/ironruby/src/CommonAssemblyInfo.cs

    r234 r243  
    66// <auto-generated> 
    77//     This code was generated by a tool. 
    8 //     Runtime Version:2.0.50727.3506 
     8//     Runtime Version:2.0.50727.1434 
    99// 
    1010//     Changes to this file may cause incorrect behavior and will be lost if 
  • branches/ironruby/src/Samples/AspNetMvc/IronRubyViews/IronRubyViews.csproj.user

    r238 r243  
    11<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
     2  <PropertyGroup> 
     3    <ProjectView>ShowAllFiles</ProjectView> 
     4  </PropertyGroup> 
    25  <ProjectExtensions> 
    36    <VisualStudio> 
  • branches/ironruby/src/Samples/AspNetMvc/IronRubyViews/Views/Home/Index.spark

    r238 r243  
    1111</p> 
    1212 
     13#require 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 
     14#$htmlExtensionMethods={ 
     15#:ActionLink=>System::Web::Mvc::Html::LinkExtensions, 
     16#:action_link=>System::Web::Mvc::Html::LinkExtensions, 
     17#:RouteLink=>System::Web::Mvc::Html::LinkExtensions, 
     18#:route_link=>System::Web::Mvc::Html::LinkExtensions, 
     19#:text_box=>System::Web::Mvc::Html::InputExtensions, 
     20#:TextBox=>System::Web::Mvc::Html::InputExtensions, 
     21#:password=>System::Web::Mvc::Html::InputExtensions, 
     22#:Password=>System::Web::Mvc::Html::InputExtensions} 
     23#def html.method_missing(name, *parameters) 
     24# extensionObject = $htmlExtensionMethods[name] 
     25# if (extensionObject != nil) 
     26#   extensionObject.send(name, self, *parameters) 
     27# else 
     28#   System::Web::Mvc::HtmlHelper.send(name, *parameters) 
     29# end 
     30#end 
     31<!--#def html.action_link(*parameters) 
     32# System::Web::Mvc::Html::LinkExtensions.ActionLink(self, *parameters) 
     33#end 
     34#def html.route_link(*parameters) 
     35# System::Web::Mvc::Html::LinkExtensions.RouteLink(self, *parameters) 
     36#end--> 
     37 
     38 
     39#x=url.action("View", "Home") 
     40<ol> 
     41  <li>${url.action('View', 'Home')}</li> 
     42  <li>${html.ActionLink("hello", '1', '2')}</li> 
     43  <li>${html.action_link("hello", '1', '2')}</li> 
     44  <li>${html.ActionLink("world", '3')}</li> 
     45  <li>${html.TextBox("height", "a billion feet")}</li> 
     46  <li>${html.text_box("height", "a billion feet")}</li> 
     47  <li>${html.Password("width", "a hundred miles")}</li> 
     48  <li>${html.password("width", "a hundred miles")}</li> 
     49</ol> 
     50 
     51#le = System::Web::Mvc::Html::LinkExtensions 
     52${le} 
     53<ul> 
     54  <li each="m in le.public_methods">${m}</li> 
     55</ul> 
     56<p>ActionLink ${le.method_defined?('ActionLink')}</p> 
     57<p>action_link ${le.method_defined?('action_link')}</p> 
    1358 
    1459<!--#@title = "Products - " + @title--> 
     
    1661  <li each="prod in @products" style="background:#ddeeff;?{prodIndex%2==0}"> 
    1762    ${prodIndex+1} 
    18     #x=html.action_link(prod.Name, "View", "Home") 
    19     ${Html.ActionLink(prod.Name, "View", "Home")} 
    20     <!--${prodIsFirst?'First':''} 
    21     ${prodIsLast?'Last':''}--> 
     63    <a href="${url.action('View', 'Home')}">${h(prod.Name)}</a> 
     64    ${prodIsFirst && 'First' || ''} 
     65    ${prodIsLast && 'Last' || ''} 
    2266  </li> 
    2367</ul> 
  • branches/ironruby/src/Spark.IronRuby/Compiler/Ruby/ChunkVisitors/GeneratedCodeVisitor.cs

    r238 r243  
    3838            _source.WriteLine("begin"); 
    3939            _source.Indent++; 
    40             _source.Write("output_write_adapter ").WriteLine(chunk.Code); 
     40            _source.Write("output_write_adapter(").Write(chunk.Code).WriteLine(")"); 
    4141            _source.Indent--; 
    4242            _source.WriteLine("rescue"); 
     
    4444            { 
    4545                _source.Indent++; 
    46                 _source.Write("output_write_adapter \"${").Write(EscapeStringContents(chunk.Code)).WriteLine("}\""); 
     46                _source.Write("output_write_adapter \"${").Write(EscapeStringContents(chunk.Code)).WriteLine(" => \"+$!+\"}\""); 
    4747                _source.Indent--; 
    4848            } 
  • branches/ironruby/src/Spark.IronRuby/Compiler/Ruby/RubyViewCompiler.cs

    r238 r243  
    1010    public class RubyViewCompiler:ViewCompiler 
    1111    { 
     12        public string ScriptHeader { get; set; } 
     13 
     14 
    1215        public override void CompileView(IEnumerable<IList<Chunk>> viewTemplates, IEnumerable<IList<Chunk>> allResources) 
    1316        { 
     
    2326            var script = new SourceWriter(); 
    2427            var globals = new Dictionary<string, object>(); 
     28 
     29            script.WriteLine(ScriptHeader); 
    2530 
    2631            script.WriteLine("class<<view"); 
  • branches/ironruby/src/Spark.Web.Mvc.Ruby

    • Property svn:ignore changed from
      bin
      obj
      to
      bin
      obj
      *.user
  • branches/ironruby/src/Spark.Web.Mvc.Ruby/RubyLanguageFactoryWithExtensions.cs

    r238 r243  
    33using Spark.Compiler; 
    44using Spark.IronRuby; 
     5using Spark.IronRuby.Compiler.Ruby; 
    56 
    67[assembly: ExtensionType(typeof(HtmlHelper), typeof(System.Web.Mvc.Html.FormExtensions))] 
     
    1920    { 
    2021        private bool _initialized; 
     22        private string _scriptHeader; 
    2123 
    2224        public override ViewCompiler CreateViewCompiler(ISparkViewEngine engine, SparkViewDescriptor descriptor) 
    2325        { 
    2426            Initialize(); 
    25             return base.CreateViewCompiler(engine, descriptor); 
     27            var viewCompiler = base.CreateViewCompiler(engine, descriptor); 
     28            if (viewCompiler is RubyViewCompiler) 
     29            { 
     30                ((RubyViewCompiler) viewCompiler).ScriptHeader = _scriptHeader; 
     31            } 
     32            return viewCompiler; 
    2633        } 
    2734 
     
    3643                    return; 
    3744 
    38                 _initialized = true; 
    39  
    4045                // need to load the assembly into the runtime domain 
    4146                // before any scripts are created in order for the extension 
     
    4348                RubyEngineManager.ScriptEngine.Runtime.LoadAssembly( 
    4449                    typeof (RubyLanguageFactoryWithExtensions).Assembly); 
     50 
     51                _scriptHeader = @" 
     52view_html = view.html 
     53def view_html.method_missing(name, *parameters) 
     54 extensionObject = $htmlExtensionMethods[name] 
     55 if (extensionObject != nil) 
     56   extensionObject.send(name, self, *parameters) 
     57 else 
     58   System::Web::Mvc::HtmlHelper.send(name, *parameters) 
     59 end 
     60end"; 
     61 
     62                _initialized = true; 
    4563            } 
    4664        } 
  • branches/ironruby/src/Spark.sln

    r238 r243  
    3737EndProject 
    3838Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spark.Web.Mvc.Ruby", "Spark.Web.Mvc.Ruby\Spark.Web.Mvc.Ruby.csproj", "{92D6EEC2-FFE5-48E5-BFE1-D5C6D2F48D90}" 
     39EndProject 
     40Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spark.Web.Mvc.Ruby.Tests", "Spark.Web.Mvc.Ruby.Tests\Spark.Web.Mvc.Ruby.Tests.csproj", "{AE1175DE-6388-472B-92EB-907A1C45E541}" 
    3941EndProject 
    4042Global 
     
    104106                {92D6EEC2-FFE5-48E5-BFE1-D5C6D2F48D90}.Release|Any CPU.ActiveCfg = Release|Any CPU 
    105107                {92D6EEC2-FFE5-48E5-BFE1-D5C6D2F48D90}.Release|Any CPU.Build.0 = Release|Any CPU 
     108                {AE1175DE-6388-472B-92EB-907A1C45E541}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 
     109                {AE1175DE-6388-472B-92EB-907A1C45E541}.Debug|Any CPU.Build.0 = Debug|Any CPU 
     110                {AE1175DE-6388-472B-92EB-907A1C45E541}.Release|Any CPU.ActiveCfg = Release|Any CPU 
     111                {AE1175DE-6388-472B-92EB-907A1C45E541}.Release|Any CPU.Build.0 = Release|Any CPU 
    106112        EndGlobalSection 
    107113        GlobalSection(SolutionProperties) = preSolution 
     
    124130                {92156FC5-8ECF-4A52-B4CA-AE060DCAAD18} = {F4E1F2B2-2BA6-4EFC-8082-ADBC14ECC179} 
    125131                {92D6EEC2-FFE5-48E5-BFE1-D5C6D2F48D90} = {F4E1F2B2-2BA6-4EFC-8082-ADBC14ECC179} 
     132                {AE1175DE-6388-472B-92EB-907A1C45E541} = {F4E1F2B2-2BA6-4EFC-8082-ADBC14ECC179} 
    126133        EndGlobalSection 
    127134EndGlobal