Redmine 与 IronRuby (Windows)?

发布于 2024-08-31 05:54:30 字数 42 浏览 7 评论 0原文

有人尝试过使用 IronRuby 运行 Redmine 吗?是否可以?

Has anyone tried to run Redmine using IronRuby? Is it possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黑凤梨 2024-09-07 05:54:30

我认为目前答案是否定的...做了一些谷歌搜索我发现了各种
人们询问了一些尝试和一些提出的问题......

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 文件中不能有 %..

在我让 redmine 在 IronRuby 上运行的徒劳努力中,我发现的一件事是,语言环境 yaml 文件中的以下行:“field_done_ratio: % Done”引发了异常。如果我删除了“%”,它就起作用了(或者至少我更进一步了)。

(在这16小时后放弃了,我的最后一个障碍是访问 localhost:3000/ 时无限重定向,虽然访问 localhost:3000/login 进展顺利,但之后你什么也做不了..)

http://ironruby.codeplex.com/workitem/list/basic ?size=2147483647

I think the answer is NO at present... doing a bit of google searching I found various
people asking a few trying and some raising issues...

https://serverfault.com/questions/165539/redmine-in-ironruby

Currently, Redmine is only supported on Ruby 1.8.6 and 1.8.7 and on Ruby Enterprise Edition. There are currently efforts ongoing to have Redmine running on jRuby and Rubinius. As there are not that many core devs running windows, I would not assume that anyone actively works on IronRuby compatibility.
If you are willing to help and code needed patches, you are welcome to speak up on http://redmine.org.

Redmine, yaml files can't have % in them..

In my fruitless efforts to get redmine running on IronRuby one of the things i discovered were that the lines like these: "field_done_ratio: % Done" in the locale yaml files throwed exceptions. if i removed the "%" it worked (or at least i went one step further).

(gave up after these 16hours, my last obstacle were infinite redirection while accessing localhost:3000/, although accessing localhost:3000/login went well, but after that you couldn't do anything.. )

http://ironruby.codeplex.com/workitem/list/basic?size=2147483647

最近可好 2024-09-07 05:54:30

几个月前,我尝试让 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>

这使得 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 文件都需要用百分号围绕值进行双引号。

  field_done_ratio: "% ???????"

此外,我必须注释掉 db\migrate 文件夹中数据库设置文件中的所有索引创建和删除。

总之,Redmine 可以主要与 IronRuby、IronRack、IIS 6 和 SQL Server 2005 配合使用,但也需要进行一些修改。

I attempted to get Redmine running on IronRuby with some success a few months ago. The version of Redmine I used was 0.9.3, IronRuby version was 1.0v4, SQL Server 2005 and it was hosted from IIS 6. This was actually a lot of work to get it up and running. I had to make minor modifications to a bunch of Redmine files. I also added some files that were not present in my download like new_rails_defaults.rb. Additionally, I had to get the IronRuby source from GitHub and modify it slightly to get IronRack working.

To get IIS to work I had to redirected all traffic to .Net for processing in the Redmine IIS WebApplication I created. This was done through adding an application extension mapping to "C:\Windows\Microsoft.NET\Framework\v2.0.50727aspnet_isapi.dll"

I then redirected all traffic to IronRack in my Web.config file.

<httpHandlers>
<clear />   
<add path="*" verb="*" type="IronRuby.Rack.HttpHandlerFactory, IronRuby.Rack"/></httpHandlers>

This stopped IIS from being able to serve static files. To fix this I created the 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
    }
}

This needs to be added to the httpHandlers section as well. And for every static file type you want to it to be able to serve. An example of serving a PNG file is show below.

<httpHandlers>
<clear />
<add path="*.png" verb="*" type="StaticFileHttpHandler.StaticFileHttpHandler, StaticFileHttpHandler"/>
<add path="*" verb="*" type="IronRuby.Rack.HttpHandlerFactory, IronRuby.Rack"/></httpHandlers>

I also needed to make an images_controller.rb file to point the static files at.

# This is a place holder controller to allow for mapping static images

class ImagesController < ApplicationController
  def index
    0
  end
end

Next all *.yml files need double qoutes around values with the percent sign.

  field_done_ratio: "% ???????"

Additionally, I had to comment out all index creation and deletion in the database setup files in the db\migrate folder.

In conclusion, it is possible to get Redmine mostly working with IronRuby, IronRack, IIS 6, and SQL Server 2005 but not without some modifications.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文