[Ironruby-core] Looking for Examples

Ivan Porto Carrero ivan at flanders.co.nz
Wed Aug 27 11:11:24 EDT 2008


The thing with gems is that it's going to be quite tricky.. some of the very
useful ones (hpricot for example) depend on C-extensions and then they need
to be ported first to .NET.

At this moment i would try to include them in a lib folder or something and
then require them when I load my script. (read what merb does ;)) because
manually installing doesn't work yet either at least not when I tried that
this morning. At this moment i wouldn't use IronRuby for anything that has
to go into production, that being said there most of the time there are
alternatives in the .NET world and you can just leverage those.

Out of curiosity which libraries did you want to use?

Cheers
Ivan



On Wed, Aug 27, 2008 at 4:55 PM, Glen Cooper <glen at glenc.net> wrote:

> Thanks for the response.  So let me ask you this.  If you were to start
> building a project and wanted to leverage existing libraries out there,
> would you manually install them to your iron ruby install directory?  Or
> just add them into a gems folder in your project - like what merb does with
> frozen gems?
>
> Regards,
> Glen Cooper
> (425) 802-6627
> www.glenc.net
>
> On Aug 27, 2008, at 12:42 AM, Ivan Porto Carrero wrote:
>
> As far as I know you can't use gems yet in IronRuby and that's also why
> there is no example with unit tests etc. It can't be done atm.
> IronRuby has a minispec framework built in but that isn't as fully featured
> as rspec for example.
> Basically building stuff with IronRuby is the same as with Ruby only now
> you can use everything from .NET too.
>
> » ir -D
> IronRuby 1.0.0.0 on .NET 2.0.50727.3053
> Copyright (c) Microsoft Corporation. All rights reserved.
>
> Note that local variables do not work today in the console.
> As a workaround, use globals instead (eg $x = 42 instead of x = 42).
>
> >>> require 'rubygems'
> => true
> >>> require 'pathname2'
> C:\tools\IronRuby\build\debug\..\..\lib\ruby\site_ruby\1.8\rubygems/custom_require.rb:31:in
> `require': no such file
> oad -- pathname2 (LoadError)
>         from
> c:\tools\IronRuby\src\microsoft.scripting.core\actions\matchcaller.generated.cs:35:in
> `Call3'
>         from
> c:\tools\IronRuby\src\microsoft.scripting.core\actions\callsite.cs:275:in
> `UpdateAndExecute'
>         from
> c:\tools\IronRuby\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:45:in
> `Update3'
>         from :0
>         from
> c:\tools\IronRuby\src\microsoft.scripting.core\actions\matchcaller.generated.cs:35:in
> `Call3'
>         from
> c:\tools\IronRuby\src\microsoft.scripting.core\actions\callsite.cs:275:in
> `UpdateAndExecute'
>         from
> c:\tools\IronRuby\src\microsoft.scripting.core\actions\updatedelegates.generated.cs:45:in
> `Update3'
>         from :0
>
> >>>
>
> If you're looking for the "Ruby way" of doing things then there are plenty
> of libraries and ruby projects that you can study, for me personally there
> is not much difference between programming against either. If you already
> know .NET it's just a matter of getting the hang of Ruby like where and when
> to use metaprogramming, embracing hashes etc. For example:
>
> class Member
>
>    attr_accessor :name, :age, :marital_status, :children
>
>    def initialize(options)
>        options.each do |key, value|
>            instance_variable_set "@#{key}", value
>        end
>    end
>
> end
>
> member = Member.new :name => "Joe Schmoe", :age => 27, :marital_status =>
> :married, :children => 2.1
> puts member.name
>
> Or you can take existing .NET classes and extend them
>
> module StringExtensions
>
>      def to_uri
>          System::Uri.new self
>      end
>
> end
>
> require 'mscorlib'
>
> class System::String
>    include StringExtensions
> end
>
> or
>
> System::String.include StringExtensions
>
>
> Check out ironruby-contrib on github that should hold at least 2 projects
> that go further than 'hello world'.
> http://github.com/ironruby/ironruby-contrib/
>
>
> Cheers
> Ivan
>
>
>
> On Wed, Aug 27, 2008 at 3:44 AM, Glen Cooper <glen at glenc.net> wrote:
>
>> I'm wondering if anyone can point me to some good example projects using
>> IronRuby.  Specifically I'm looking for libraries and projects using some of
>> the things we take for granted with regular ruby development - rake, gems,
>> rspec, etc.  I'm starting a project of my own and since there isn't a lot of
>> documentation out there yet I figure looking at other projects is the best
>> way to see how it's done.
>>
>> I'm not looking for projects that just use small pieces of IronRuby - I
>> really want to see how someone would build a library or end-to-end solution
>> leveraging gems, rake tasks, and unit testing in IronRuby.
>>
>> Thanks!
>>
>> Glen Cooper
>> (425) 802-6627
>> www.glenc.net
>>
>> _______________________________________________
>> Ironruby-core mailing list
>> Ironruby-core at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/ironruby-core
>>
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
>
> _______________________________________________
> Ironruby-core mailing list
> Ironruby-core at rubyforge.org
> http://rubyforge.org/mailman/listinfo/ironruby-core
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080827/afdcb783/attachment-0001.html>


More information about the Ironruby-core mailing list