Windows 7 Phone + Ironruby!

In this post I just gonna go through how to get windows 7 phone up and running with ironruby, most are taken from Tomas Matousek but I had to make some customization for it to work!

Step1

Installing the SDK

first of all you have to download the Windows phone 7 developer tools and install those, will take awhile.

Step2

Installing ruby

IronRuby 1.1.2 Installer

and then the binarys from the same URL

step3

Creating the Project

at the moment windows 7 phone need a C# project from were it executes the ruby code, so you have to,

File => New => New Project => Silverlight for Windows phone => Windows Phone Application

remember those binarys from Step 2, now we have to add references to those by,

In solution explorer right click on the reference folder and choose add reference

A dialog window pop up and there you will browse to “IronRuby 1.1.2 Binaries\Windows Phone 7\”
you can add all at once.

Dialog
step4

Creating MainPage.rb

add text file to your project root directory and name it MainPage.rb.
then you have to right click on the MainPage.rb select properties file
set the attribute “Build Action” => “Embedded resource”

step5

configure the enviroment

The constructor of the MainPage.xaml.cs file should look like this ->
contructor_code

On 3rd line from down

Stream codeFile =
execAssembly.GetManifestResourceStream("WindowsPhoneApplication3.MainPage.rb");

replace “WindowsPhoneApplication3”.MainPage.rb to whatever your namespace is for your project.

the reason from step 4 for is to make the GetManifestResourceStream() to return a valid stream, elsewise when we create the Streamreader from the line below it will throw a somethingNullException 🙂

step 6

Sample ruby code

In MainPage.rb:

Posted in Uncategorized | 2 Comments

using RSPEC Ubuntu, missing headers

If you get a error like

checking for libxml/parser.h… no

or

checking for libxslt/parser.h… no

and for ubuntu you solve this by running:

sudo apt-get install libxml2-dev

sudo apt-get install libxslt-dev

This solves most problem, if you have missing headers for other gems installing the -dev och the package mostly solves it!

Posted in Uncategorized | 1 Comment