有没有人尝试过用IronRuby运行Redmine?有可能吗?
发布于 2010-12-17 20:01:58
我认为目前答案是否定的.我在谷歌上搜索了一下,发现不同的人问了一些尝试,也提出了一些问题……
https://serverfault.com/questions/165539/redmine-in-ironruby
目前,Redmine仅在Ruby 1.8.6和1.8.7以及Ruby企业版上受支持。目前正在努力让Redmine在jRuby和Rubinius上运行。由于运行IronRuby的核心开发人员并不多,所以我不认为会有人积极研究windows兼容性。如果您愿意提供帮助并编写所需的补丁,欢迎在http://redmine.org上畅所欲言。
Redmine,yaml文件中不能有%..
在我徒劳无功地让redmine在IronRuby上运行的过程中,我发现yaml文件中像这样的代码行"field_done_ratio:% Done“抛出了异常。如果我去掉了"%“,它就起作用了(或者至少我走了一步)。
(16个小时后放弃了,我的最后一个障碍是访问localhost:3000/时的无限重定向,虽然访问localhost:3000/login进行得很好,但是之后你什么也做不了.)
http://ironruby.codeplex.com/workitem/list/basic?size=2147483647
发布于 2011-03-12 21:20:06
几个月前,我试图让Redmine在IronRuby上运行,并取得了一些成功。我使用的Redmine版本是0.9.3,IronRuby版本是1.0v4,SQL Server2005是从IIS6托管的。我不得不对一堆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>这使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
}
}这也需要添加到httpHandlers部分。对于你想要的每种静态文件类型,它都能提供服务。提供PNG文件的示例如下所示。
<httpHandlers>
<clear />
<add path="*.png" verb="*" type="StaticFileHttpHandler.StaticFileHttpHandler, StaticFileHttpHandler"/>
<add path="*" verb="*" type="IronRuby.Rack.HttpHandlerFactory, IronRuby.Rack"/></httpHandlers>我还需要创建一个images_controller.rb文件来指向静态文件。
# This is a place holder controller to allow for mapping static images
class ImagesController < ApplicationController
def index
0
end
end接下来,所有*.yml文件都需要对带有百分号的值进行双qoutes。
field_done_ratio: "% ???????"此外,我必须注释掉db\migrate文件夹中数据库设置文件中的所有索引创建和删除操作。
总之,可以让Redmine主要与IronRuby、IronRack、IIS6和SQL Server2005一起工作,但不能不做一些修改。
https://stackoverflow.com/questions/2783706
复制相似问题