Permalink
Browse files

Updated to MVC 1.0 from jimmy's repo

  • Loading branch information...
2 parents 95de883 + 14e19c4 commit 8ed06faec1de978ef21e29d9a055660337536567 @casualjim casualjim committed Mar 15, 2009
@@ -30,8 +30,7 @@ protected override void EstablishContext()
.WhenToldTo(factory => factory.CreateController(_requestContext, _controllerName))
.Throw(new InvalidOperationException());
-
- _rubyEngine.WhenToldTo(eng => eng.LoadController(_requestContext, _controllerName)).Return(new RubyController());
+ _rubyEngine.WhenToldTo(eng => eng.LoadController(_requestContext, _controllerName)).Return(Dependency<RubyController>());
}
@@ -46,22 +46,18 @@
<OutputPath>bin\Release_Signed\</OutputPath>
</PropertyGroup>
<ItemGroup>
- <Reference Include="IronRuby, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Reference Include="IronRuby, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\IronRuby.dll</HintPath>
+ <HintPath>..\..\..\Users\jimmysch\dev\ironrubymvc\dependencies\IronRuby.dll</HintPath>
</Reference>
- <Reference Include="IronRuby.Libraries, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Reference Include="Microsoft.Scripting, Version=0.9.5.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\IronRuby.Libraries.dll</HintPath>
+ <HintPath>..\..\..\Users\jimmysch\dev\ironrubymvc\dependencies\Microsoft.Scripting.dll</HintPath>
</Reference>
- <Reference Include="Microsoft.Scripting, Version=1.0.0.5000, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Reference Include="Microsoft.Scripting.Core, Version=0.9.5.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\Microsoft.Scripting.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.Scripting.Core, Version=1.0.0.5000, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\dependencies\Microsoft.Scripting.Core.dll</HintPath>
- <Aliases>DLRCore</Aliases>
+ <HintPath>..\..\..\Users\jimmysch\dev\ironrubymvc\dependencies\Microsoft.Scripting.Core.dll</HintPath>
+ <Aliases>dlr</Aliases>
</Reference>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Moq, Version=2.6.1014.1, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
@@ -3,7 +3,6 @@
using System;
using System.IO;
using System.Web.Hosting;
-using Microsoft.Scripting;
#endregion
View
@@ -1,4 +1,3 @@
-
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Web.Mvc.IronRuby", "IronRubyMvc\System.Web.Mvc.IronRuby.csproj", "{46333EBB-C1FF-4E28-B48E-CB3D5BB70CDB}"
@@ -51,3 +50,4 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+
@@ -75,12 +75,12 @@ def before_action(name, method_name=nil, &b)
impl = create_from_name(method_name) if method_name.is_a?(Symbol) or method_name.is_a?(String)
filter(name, RubyProcActionFilter.new(impl || b, nil))
end
-
+
def after_action(name, method_name=nil, &b)
impl = create_from_name(method_name) if method_name.is_a?(Symbol) or method_name.is_a?(String)
filter(name, RubyProcActionFilter.new(nil, impl || b))
end
-
+
def around_action(name, options={}, &b)
options[:before] ||= b if block_given?
options[:after] ||= b if block_given?
@@ -116,8 +116,8 @@ def around_result(name, method_name=nil, options={}, &b)
options[:after] ||= create_from_name(options[:after]) if options[:after].is_a?(Symbol) or options[:after].is_a?(String)
filter(name, RubyProcResultFilter.new(options[:before], options[:after]))
end
-
- def filter(name, options=nil)
+
+ def filter(name, options=nil)
@action_filters ||= {}
klass = nil
klass = name.new if name.is_a? Class
@@ -128,16 +128,16 @@ def filter(name, options=nil)
@action_filters[name.to_sym] ||= []
@action_filters[name.to_sym] << klass
end
-
+
def action_filters
@action_filters ||= {}
@action_filters
end
private
- def create_from_name(name)
- lambda {|context| context.controller.send(name.to_sym, context) }
- end
+ def create_from_name(name)
+ lambda {|context| context.controller.send(name.to_sym, context) }
+ end
end
@@ -169,7 +169,7 @@ def self.included(base)
base.extend(ClassMethods)
end
end
-
+
module Selectors
module ClassMethods
@@ -178,12 +178,12 @@ def action_method(name, options={}, &b)
@action_methods ||= []
options[:action] = b if block_given?
options[:action] ||= name.to_sym #class.instance_method(name.to_sym)
- @action_selectors << { :name => name.to_sym, :options => options }
+ @action_methods << { :name => name.to_sym, :options => options }
end
- def action_selectors
- @action_selectors ||= []
- @action_selectors
+ def action_methods
+ @action_methods ||= []
+ @action_methods
end
end
@@ -125,6 +125,16 @@ public RubyController ConfigureController(RubyClass rubyClass, RequestContext re
return controller;
}
+ public string GetMethodName(object receiver, string message)
+ {
+ var methodNames = Operations.GetMemberNames(receiver);
+
+ if (methodNames.Contains(message.Pascalize())) return message.Pascalize();
+ if (methodNames.Contains(message.Underscore())) return message.Underscore();
+
+ return message;
+ }
+
/// <summary>
/// Calls the method.
/// </summary>
@@ -137,7 +147,6 @@ public object CallMethod(object receiver, string message, params object[] args)
return Operations.InvokeMember(receiver, GetMethodName(receiver, message), args);
}
-
/// <summary>
/// Determines whether the specified controller as the action.
/// </summary>
@@ -217,16 +226,6 @@ public void LoadAssemblies(params Type[] assemblies)
#endregion
- private string GetMethodName(object receiver, string message)
- {
- var methodNames = Operations.GetMemberNames(receiver);
-
- if (methodNames.Contains(message.Pascalize())) return message.Pascalize();
- if (methodNames.Contains(message.Underscore())) return message.Underscore();
-
- // really? we got here.. that must be some pretty funky naming.
- return message;
- }
private void Initialize()
{
@@ -320,7 +319,6 @@ private static void IntializeMvc(IRubyEngine engine)
private static RubyEngine InitializeIronRuby(IPathProvider vpp, Func<string, StreamContentProvider> contentProviderFactory)
{
var rubySetup = Ruby.CreateRubySetup();
-
var runtimeSetup = new ScriptRuntimeSetup();
runtimeSetup.LanguageSetups.Add(rubySetup);
runtimeSetup.DebugMode = true;
@@ -337,4 +335,4 @@ private static void ProcessRubyRoutes(RubyEngine engine, IPathProvider vpp, stri
engine.RequireRubyFile(routesPath, ReaderType.File);
}
}
-}
+}
@@ -9,6 +9,7 @@ namespace System.Web.Mvc.IronRuby.Core
public class RubyMvcApplication : HttpApplication
{
+
protected void Application_Start(object sender, EventArgs e)
{
RubyEngine.InitializeIronRubyMvc(new VirtualPathProvider(), "~/routes.rb");
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -147,6 +147,7 @@
<CodeAnalysisDictionary Include="CustomDictionary.xml" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -1,4 +1,4 @@
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -163,6 +163,7 @@
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -1,33 +1,33 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ProjectExtensions>
- <VisualStudio>
- <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
- <WebProjectProperties>
- <StartPageUrl>
- </StartPageUrl>
- <StartAction>CurrentPage</StartAction>
- <AspNetDebugging>True</AspNetDebugging>
- <SilverlightDebugging>False</SilverlightDebugging>
- <NativeDebugging>False</NativeDebugging>
- <SQLDebugging>False</SQLDebugging>
- <PublishCopyOption>RunFiles</PublishCopyOption>
- <PublishTargetLocation>
- </PublishTargetLocation>
- <PublishDeleteAllFiles>False</PublishDeleteAllFiles>
- <PublishCopyAppData>True</PublishCopyAppData>
- <ExternalProgram>
- </ExternalProgram>
- <StartExternalURL>
- </StartExternalURL>
- <StartCmdLineArguments>
- </StartCmdLineArguments>
- <StartWorkingDirectory>
- </StartWorkingDirectory>
- <EnableENC>False</EnableENC>
- <AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
- <EnableWcfTestClientForSVC>False</EnableWcfTestClientForSVC>
- </WebProjectProperties>
- </FlavorProperties>
- </VisualStudio>
- </ProjectExtensions>
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
+ <WebProjectProperties>
+ <StartPageUrl>
+ </StartPageUrl>
+ <StartAction>CurrentPage</StartAction>
+ <AspNetDebugging>True</AspNetDebugging>
+ <SilverlightDebugging>False</SilverlightDebugging>
+ <NativeDebugging>False</NativeDebugging>
+ <SQLDebugging>False</SQLDebugging>
+ <PublishCopyOption>RunFiles</PublishCopyOption>
+ <PublishTargetLocation>
+ </PublishTargetLocation>
+ <PublishDeleteAllFiles>False</PublishDeleteAllFiles>
+ <PublishCopyAppData>True</PublishCopyAppData>
+ <ExternalProgram>
+ </ExternalProgram>
+ <StartExternalURL>
+ </StartExternalURL>
+ <StartCmdLineArguments>
+ </StartCmdLineArguments>
+ <StartWorkingDirectory>
+ </StartWorkingDirectory>
+ <EnableENC>False</EnableENC>
+ <AlwaysStartWebServerOnDebug>True</AlwaysStartWebServerOnDebug>
+ <EnableWcfTestClientForSVC>False</EnableWcfTestClientForSVC>
+ </WebProjectProperties>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
</Project>
Oops, something went wrong.

0 comments on commit 8ed06fa

Please sign in to comment.