Tru*_*an1 9 iis-7 ironruby ruby-on-rails redmine
有没有人试图使用IronRuby运行Redmine?可能吗?
小智 5
我认为现在的答案是否定的......做一些谷歌搜索我发现各种各样的人要求一些尝试和一些提出问题......
https://serverfault.com/questions/165539/redmine-in-ironruby
目前,Redmine仅支持Ruby 1.8.6和1.8.7以及Ruby Enterprise Edition.目前正在努力让Redmine在jRuby和Rubinius上运行.由于没有那么多核心开发人员运行Windows,我不认为任何人都积极参与IronRuby的兼容性.如果您愿意帮助并编写所需的补丁,欢迎您在http://redmine.org上发表意见.
Redmine,yaml文件中不能包含%..
在我使用IronRuby运行redmine的徒劳无功的努力中,我发现的一件事就是这样的行:locale yaml文件中的"field_done_ratio:%Done"抛出异常.如果我删除"%"它工作(或至少我更进一步).
(放弃这16小时后,我的最后一个障碍是无限重定向,同时访问localhost:3000 /,虽然访问localhost:3000 /登录进展顺利,但之后你无能为力......)
http://ironruby.codeplex.com/workitem/list/basic?size=2147483647
几个月前,我尝试让Redmine在IronRuby上运行并取得了一些成功.我使用的Redmine版本是0.9.3,IronRuby版本是1.0v4,SQL Server 2005,它是从IIS 6托管的.这实际上是很多工作来启动和运行.我不得不对一堆Redmine文件进行微小的修改.我还添加了一些我的下载中没有的文件,如new_rails_defaults.rb.另外,我必须从GitHub获取IronRuby源并稍微修改它以使IronRack工作.
为了让IIS工作,我不得不将所有流量重定向到.Net,以便在我创建的Redmine IIS WebApplication中进行处理.这是通过将应用程序扩展映射添加到"C:\ Windows\Microsoft.NET\Framework\v2.0.50727aspnet_isapi.dll"来完成的
然后,我将所有流量重定向到我的Web.config文件中的IronRack.
<httpHandlers>
<clear />
<add path="*" verb="*" type="IronRuby.Rack.HttpHandlerFactory, IronRuby.Rack"/></httpHandlers>
Run Code Online (Sandbox Code Playgroud)
这阻止了IIS能够提供静态文件.为了解决这个问题,我创建了StaticFileHttpHandler.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
namespace StaticFileHttpHandler
{
public class StaticFileHttpHandler : IHttpHandler
{
#region IHttpHandler Members
public bool IsReusable
{
get
{
return true;
}
}
public void ProcessRequest(HttpContext context)
{
string staticFileUrl = context.Request.Url.LocalPath.Replace(@"/", @"\");
string staticFilePath = context.Server.MapPath(@"~\..\..\");
string defaultStaticFilePathForRemapping = @"\Redmine\public";
string defaultRootDirectoryForRemapping = @"\Redmine";
bool remapImage = !string.IsNullOrWhiteSpace(context.Request.QueryString.ToString());
if (staticFilePath.EndsWith(@"\"))
{
staticFilePath = staticFilePath.Substring(0, staticFilePath.Length - 1);
}
if (remapImage)
{
staticFilePath += (defaultStaticFilePathForRemapping + staticFileUrl.Replace(defaultRootDirectoryForRemapping, ""));
}
else
{
staticFilePath += staticFileUrl;
}
if (File.Exists(staticFilePath))
{
context.Response.ContentType = GetMimeType(staticFilePath);
context.Response.TransmitFile(staticFilePath);
}
else
{
context.Response.ContentType = "text/plain";
context.Response.Write("The File Does Not Exist!!! File: " + staticFilePath);
}
context.Response.Flush();
context.ApplicationInstance.CompleteRequest();
}
// Found Here: http://kseesharp.blogspot.com/2008/04/c-get-mimetype-from-file-name.html
private string GetMimeType(string fileName)
{
string mimeType = "application/unknown";
string ext = System.IO.Path.GetExtension(fileName).ToLower();
Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext);
if (regKey != null && regKey.GetValue("Content Type") != null)
{
mimeType = regKey.GetValue("Content Type").ToString();
}
return mimeType;
}
#endregion
}
}
Run Code Online (Sandbox Code Playgroud)
这也需要添加到httpHandlers部分.对于您希望它能够提供的每种静态文件类型.提供PNG文件的示例如下所示.
<httpHandlers>
<clear />
<add path="*.png" verb="*" type="StaticFileHttpHandler.StaticFileHttpHandler, StaticFileHttpHandler"/>
<add path="*" verb="*" type="IronRuby.Rack.HttpHandlerFactory, IronRuby.Rack"/></httpHandlers>
Run Code Online (Sandbox Code Playgroud)
我还需要创建一个images_controller.rb文件来指向静态文件.
# This is a place holder controller to allow for mapping static images
class ImagesController < ApplicationController
def index
0
end
end
Run Code Online (Sandbox Code Playgroud)
接下来,所有*.yml文件都需要使用百分号围绕值进行双重qoutes.
field_done_ratio: "% ???????"
Run Code Online (Sandbox Code Playgroud)
另外,我必须在db\migrate文件夹中的数据库设置文件中注释掉所有索引的创建和删除.
总之,有可能让Redmine主要使用IronRuby,IronRack,IIS 6和SQL Server 2005,但不是没有一些修改.
归档时间: |
|
查看次数: |
882 次 |
最近记录: |