domgreen

The Geek Will Inherit the Earth

  • Automating Cloud Deployment using Rake

    • 27 Apr 2011
    • 0 Responses
    •  views
    • Azure Deployment Rake Ruby Windows Azure
    • Edit
    • Delete
    • Tags
    • Autopost

    After a previous post where I discussed the benefits of using existing tools over creating your own build tasks I have been able to reproduce exactly the same deployment script working in Rake as I had previously shown in MSBuild using the Windows Azure Tools to control the deployment and initialization of instances in the public and local cloud environments.

    When deploying to the public cloud the only thing that I have changed in the scenario is to add a line to use the CSPack tool rather than relying on the MSBuild tasks supplied with the Windows Azure SDK to create the cloud package for my application.

    The full Rake build, deployment and initialization script is below, showing that we can use all the same tools and concepts independent of the build engine. This script relies heavily on calling out to the command line with the exec method that I have created to pass in the command line arguments.

     

    • Tweet
  • Pumping Iron – Ruby & .NET testing

    • 8 Feb 2010
    • 0 Responses
    •  views
    • IronRuby Ruby RubyMine Test
    • Edit
    • Delete
    • Tags
    • Autopost

    After being inspired by Ben Hall’s “Testing C# and ASP.NET using Ruby” session at DDD8, I decided to give Ruby testing a go.

    This article shows the basics of how to get started, for the added cool-ness of BDD and Cucumber check out Bens slides from the talk.

    What do I need?

    IronRuby

    IronRuby is Ruby for the .NET platform build on the DLR which allows you to use the Ruby language to interact with your existing .NET code.

    RubyMine

    RubyMine is a very cool IDE for developing Ruby applications that Ben used in his DDD demo, there are many other Ruby IDEs available including TextMate for the Mac and RadRails for Eclipse.

    Now that we have all the none .NET pre-reqs downloaded and installed we can get to business.

    Create Application Under Test

    First things first, lets set up a skeleton application in Visual Studio that we will test. Here I just created a blank class library called IronRubyMine with the Person class within it. Build this code so that we have a dll in the bin/Debug directory.

    Setting up RubyMine for IronRuby

    Within RubyMine I have then created a project in the same directory as my sln file for C# application, this will generate all your Ruby classes in the same location as your .NET app.

    Once we have the Ruby solution we need to do a few tweaks to get it to work smoothly with .NET. Start off by adding the IronRuby SDK for use with the project (File – Settings – Ruby SDK – Add SDK…) and browse to the location of your IronRuby install and the ir.exe file.

    Media_httpdomgreencom_ehdeg

    Now RubyMine is using the IronRuby SDK we need to make another minor tweak to the Run/Debug configuration the files in the project. You will need to alter the Ruby Arguments to:

    -e STDOUT.sync=true;STDERR.sync=true;load($0)

    Media_httpdomgreencom_cxgwg

    There are a number of discussions on the RubyMine forums how to best do this, but I have found that this alteration is the easiest and most straight forward way to get it all working.

    Red – Create Failing Test

    With our environments set up we create a simple test that fails before we write the code that we want and make the test pass.

    The second line pulls in the .NET dll that we created in our app allowing IronRuby to call any classes and methods that we create in our C# code. This is then used further down to create a Person object.

    On running this test we will get a red light as we haven't yet implemented the C# code to go alongside the test.

    Media_httpdomgreencom_ryyco
     

    Green – Make Tests Pass

    Now we can go back to Visual Studio and create a Person constructor that will take in a name, hopefully making our tests go green.

    Media_httpdomgreencom_urfej

    Once we have the code in place, build the application to ensure that the dll is updated and our IronRuby code is using the latest implementation.

    Now jump back into RubyMine and re-run the tests.

    Media_httpdomgreencom_ghpgd
     

    Refactor…

    You get the picture, with all our tests now passing we can do any refactoring needed and then go on to create more tests.

    With this simple implementation in place we can build on this to implement more advanced techniques described in Bens presentation.

    • Tweet
  • About

    By day a virtual warrior, hunched over a keyboard cranking out line after line of code at Huddle, living the East London tech dream at Silicon Roundabout. We are an Enterprise collaboration tool that will revolutionise how your company collaborates, shares and operates, we are taking the fight to Microsoft SharePoint, we are David and we're taking on Goliath.

    However, by night this pasty geek escapes his keyboard and monitor with the attempt to get fit. I train at one of the greatest gyms in London, Thames CrossFit. CrossFit is not like other gyms its a lifestyle, and as the guys at Thames say you must be prepared to work hard.

    I also run with the great Run Dem Crew a Shoreditch based running family who run the mean streets of London by night. RDC is a mecca for runners, and creatives alike.

    With all this training its bound to get hard, its bound to be tough but its certainly worth it when you achieve something great and make friends along the way.

    So remember, "Pain is temporary but victory is forever".

    77063 Views
  • Archive

    • 2011 (13)
      • June (2)
      • May (5)
      • April (6)
    • 2010 (3)
      • April (1)
      • January (2)

    Get Updates

    Subscribe via RSS
    TwitterBuzz