Has anyone tried to run Redmine using IronRuby? Is it possible?
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With