just ram

stuff I should remember

Building FubuMVC with a portable version of rake

To build FubuMVC you need to install ruby, rake etc. Unfortunately for me the firewall at work will not allow me to get the rake gem (I’ve downloaded gems before using the HTTP_PROXY setting before but no luck this time). Any hoose I remember reading Stephen Balkum post on packaging up Rake as an executable.  I followed Stephens guide and created a portable rake package which got around my firewall problem but FubuMVC required another gem rubyzip to allow a build.

Adding another gem

Luckily using Stephen’s guide its really easy to add extra gems, you just need to have them installed before you build your exe. So we follow the first part of the process outlined in Stephen’s guide then do the following:

NOTE: In this case we need rubyzip but it could be any old gem.

  • Download rubyzip and extract to contents to c:\rubywork\zip

  • To install rubyzip, at a command prompt in c:\rubywork\zip, run ..\ruby\bin\ruby install.rb

  • Download zlib and extract the zlib1.dll to C:\rubywork\ruby\lib\ruby\1.8\i386-mswin32

  • Rename zlib1.dll to zlib.dll (rubyzip required this extra dll other gems may not)

Now continue part two of the process from Stephen’s guide to compile your very own allinoneruby.exe which includes, rake and rubyzip.

You should now have allinoneruby.exe and rake.rb file.

Building FubuMVC

We can now drop these files into to the FubuMVC project under the build support folder:

image

We need a helper batch file in the root folder of FubuMVC called rake.bat which contains:

@.\build_support\allinoneruby.exe .\build_support\rake.rb %*

This will be called when we run the build.

Run the build already

Drop to the command prompt and cd into the FubuMVC project root and simply type build. You should get something like:

image

Download

Don’t want to go through all that? You can download my version of portable rake [here](http://cid-d7d57b78b0ddedf5.skydrive.live.com/self.aspx/.Public/blog/portable rake/portablerake.zip) (_I don’t think I’m breaking any licensing agreements here, this is all open source software. If I am let me know and I’ll remove the link)

DISCLAIMER: I offer no guarantees I can only confirm this works on my machine!

One final note

I’ve used this method to build some of the other open source projects out there which use rake (all the __cool kids_ seem to be using rake_) and so far I’ve not had any problems. This could be pretty frictionless way to introduce rake to a team of .net developers who don’t want the overhead of installing ruby on their machines. Just add it to a tools folder check it in to source control they’ll never know!

Comments