I wanted to test my prototype ADO.NET database wrappers for SQLite and MySQL, so I thought I would see how far I could get in an attempt to run activerecord. Running activerecord is of course a necessary step in the path to running Rails. At this point I''m simply trying to get "require ''active_record.rb''" to work, which in turn requires activesupport. Here are some issues I''ve come across thus far: (1) Missing method File.expand_path - Adapted the implementation from Ruby.NET, along with some other unimplemented methods from File. I will check on licensing issues before posting a patch. (2) rubygems is not yet running in IronRuby - Commented out all "require ''rubygems''" in the activerecord and activesupport source, since they are not absolutely necessary (i.e. rubygems is used to grab packages not present on the local filesystem). (3) Missing method Class.method_added - This is just a ''dummy'' method that gets overridden - see patch for ModuleOps.cs (4) C:\brian\ironruby\trunk\src\IronRuby.Libraries\Builtins\Kernel.cs:611:in `InstanceEval'': instance_eval on Module or Class needs singleton support (NotImplementedError) - It seems that instance_eval has different semantics when invoked with a class or method as receiver. I haven''t yet worked out what is involved with implementing this method, so for the time being I commented out the NotImplementedError in Kernel.cs: //if (self is RubyModule) { // throw RubyExceptions.CreateNotImplementedError("instance_eval on Module or Class needs singleton support"); //} (5) :0:in `__init__'': wrong number or type of arguments for `define_method'' (ArgumentError) - Problem: current implementation of define_method does not accept Proc objects as arguments, hence the following line in activesupport-2.0.2\lib\active_support\core_ext\module\attr_accessor_with_default.rb throws an exception: define_method(sym, block_given? ? block : Proc.new { default }) - Solution: added an overload for DefineMethod that accepts a Proc object as an argument; see patch for ModuleOps.cs (6) Missing method Thread.critical - Hacked a prototype implementation - see patch for ThreadOps.cs (it''s ugly and purely for the purposes of trying to get activerecord to import :-) (7) Missing method Dir.glob - Adapted the implementation from Ruby.NET (see (1) above) (8) Missing method File.basename - Adapted the implementation from Ruby.NET (see (1) above) (9) Problem with activesupport-2.0.2\lib\active_support\core_ext\array\conversions.rb - unknown: Cannot cast from ''Microsoft.Scripting.SymbolId'' to ''Ruby.Builtins.Proc'' (ArgumentError) - This is the offending piece of code in conversions.rb: def to_param map(&:to_param).join ''/'' end I must say that I''m not familiar with the &:symbol syntax. Anyone have any suggestions here? - For the time being I have commented out this method in conversions.rb. (10) Libraries ''enumerator.so'' and ''bigdecimal.so'' not available - Solution: commented out the requires in the activesupport source for the time being (11) Problem with the Ruby library ''rational.rb'': :0:in `main'': Can''t inherit from a class without a default or code context constructor (System::NotSupportedException) - The problem is that Rational is a subclass of Numeric, which is an abstract class with no constructor: class Rational < Numeric - Solution: hacked Ruby.Builtins.Numeric so that it is no longer abstract, and has a zero-arg constructor - see patch for Numeric.cs (12) C:\brian\ironruby\trunk\src\IronRuby.Libraries\Builtins\Kernel.cs:804:in `Require'': Expression transformation not implemented: MemberAssignmentExpression (System::NotImplementedException) - The problem is in the Ruby library date/format.rb, although I haven''t narrowed it down further than that. - Solution: commented out all "require ''date''" for the time being (13) Problem with the Ruby library delegate.rb: Class.new not supported (e.g. no zero-arg constructor for "Class") This is as far as I have got at this point - hopefully someone might find all this useful. - Brian -------------- next part -------------- A non-text attachment was scrubbed... Name: ModuleOps.cs.patch Type: application/octet-stream Size: 2860 bytes Desc: not available Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080419/d41e8633/attachment.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Numeric.cs.patch Type: application/octet-stream Size: 504 bytes Desc: not available Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080419/d41e8633/attachment-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: ThreadOps.cs.patch Type: application/octet-stream Size: 645 bytes Desc: not available Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080419/d41e8633/attachment-0002.obj
Brian Blackwell:> I wanted to test my prototype ADO.NET database wrappers for SQLite and > MySQL, so I thought I would see how far I could get in an attempt to > run activerecord. Running activerecord is of course a necessary step in > the path to running Rails. At this point I''m simply trying to get > "require ''active_record.rb''" to work, which in turn requires > activesupport. Here are some issues I''ve come across thus far: > > ... awesome list of observations elided ...Thanks for doing this work, Brian! This will give me a bunch of things to look at around the core libs this weekend. -John
I submitted an implementation of File.expand_path a while ago but it hasn''t been comitted yet. If your implementation works better go for it. I need it for some things I''m doing with IronRuby too. -Jayme On Fri, Apr 18, 2008 at 5:56 PM, John Lam (IRONRUBY) <jflam at microsoft.com> wrote:> Brian Blackwell: > > > I wanted to test my prototype ADO.NET <http://ado.net/> database > wrappers for SQLite and > > MySQL, so I thought I would see how far I could get in an attempt to > > run activerecord. Running activerecord is of course a necessary step in > > the path to running Rails. At this point I''m simply trying to get > > "require ''active_record.rb''" to work, which in turn requires > > activesupport. Here are some issues I''ve come across thus far: > > > > ... awesome list of observations elided ... > > Thanks for doing this work, Brian! This will give me a bunch of things to > look at around the core libs this weekend. > > -John > > _______________________________________________ > 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/20080418/6fd5404a/attachment.html
Sorry about the delay. It''s in the queue. Once i get my shelveset past the checkin troll i''ll be going through the backlog of patches. - John Sent from my phone ________________________________ From: Jayme <jayme.edwards at gmail.com> Sent: Friday, April 18, 2008 5:13 PM To: ironruby-core at rubyforge.org <ironruby-core at rubyforge.org> Subject: Re: [Ironruby-core] Running activerecord I submitted an implementation of File.expand_path a while ago but it hasn''t been comitted yet. If your implementation works better go for it. I need it for some things I''m doing with IronRuby too. -Jayme On Fri, Apr 18, 2008 at 5:56 PM, John Lam (IRONRUBY) <jflam at microsoft.com<mailto:jflam at microsoft.com>> wrote: Brian Blackwell:> I wanted to test my prototype ADO.NET<http://ado.net/> database wrappers for SQLite and > MySQL, so I thought I would see how far I could get in an attempt to > run activerecord. Running activerecord is of course a necessary step in > the path to running Rails. At this point I''m simply trying to get > "require ''active_record.rb''" to work, which in turn requires > activesupport. Here are some issues I''ve come across thus far: > > ... awesome list of observations elided ...Thanks for doing this work, Brian! This will give me a bunch of things to look at around the core libs this weekend. -John _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org<mailto: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/20080418/dc8c670b/attachment.html
On Fri, 18 Apr 2008 15:56:32 -0700, "John Lam (IRONRUBY)" <jflam at microsoft.com> said:> > Thanks for doing this work, Brian! This will give me a bunch of things to > look at around the core libs this weekend.Thanks John! I have encountered some further issues trying to run activerecord which I will detail in a moment, but firstly I''ve worked out what is going on with issue (9) in my previous email:> (9) Problem with > activesupport-2.0.2\lib\active_support\core_ext\array\conversions.rb > - unknown: Cannot cast from ''Microsoft.Scripting.SymbolId'' to > ''Ruby.Builtins.Proc'' > (ArgumentError) > - This is the offending piece of code in conversions.rb: > > def to_param > map(&:to_param).join ''/'' > endThe & operator should call to_proc on the object, but IronRuby is currently not doing so - I have filed a bug report on RubyForge. Symbol.to_proc is defined in activesupport in order to support the above piece of syntactic sugar. "&:some_symbol" is simply shorthand for "Proc.new { |a| a.some_symbol }", so as a temporary workaround, any such occurrences in activesupport can be replaced with the latter expression. Here are some new issues that I have encountered with activesupport/activerecord: (1) Missing library stringio - As a workaround, I copied the pure Ruby implementation from YAML (this should be in C:\ruby\lib\ruby\1.8\yaml\stringio.rb in the MRI distribution). (2) Problem with active_support/core_ext/logger.rb :0:in `define_around_helper'': wrong number or type of arguments for `module_eval'' (ArgumentError) - There is currently no implementation of module_eval that accepts a string parameter. As a workaround, I rewrote logger.rb so that it passes a block to module_eval (see attached logger.rb). John has mentioned that the eval methods should be coming soon, which would be very helpful indeed... (3) Problem with active_support/core_ext/module/attr_internal :0:in `main'': undefined local variable or method `attr_internal_naming_format='' for Module:Class (NoMethodError) - The same problem as (2): activesupport defines a method mattr_accessor which calls module_eval with a string parameter. As a workaround, I manually defined the accessor attr_internal_naming_format in attr_internal.rb (see attachment) (4) Missing method Regexp.quote - active_support\core_ext\pathname.rb requires the Ruby library pathname, which in turn calls Regexp.quote. - Workaround: commented out "require ''pathname''" (5) Problem with active_support/core_ext/string/iterators.rb - Logical operators in method arguments won''t parse - the following line is the culprit: loop { yield(scanner.scan(char) || break) } - I have filed a bug report in RubyForge. Wayne Kelly has confirmed that this is a parser bug (incorrect grammar) - see http://rubyforge.org/tracker/index.php?func=detail&aid=19672&group_id=4359&atid=16798 - As a workaround, I rewrote the above line as: loop do s = scanner.scan(char) if !s break end yield(s) end - We are also missing library ''strscan.so'' - but StringScanner is built into IronRuby, so as a workaround, I changed the first line to: require ''strscan'' unless defined?(StringScanner) More activesupport/activerecord observations should be coming soon. I will add them to Wayne''s TowardsRails Wiki page at some point. -Brian -------------- next part -------------- A non-text attachment was scrubbed... Name: attr_internal.rb Type: application/x-ruby Size: 1193 bytes Desc: not available Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080425/91c5fb1c/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: logger.rb Type: application/x-ruby Size: 875 bytes Desc: not available Url : http://rubyforge.org/pipermail/ironruby-core/attachments/20080425/91c5fb1c/attachment-0001.bin
Hey Brian - can you share your prototype ADO.NET wrappers for SQLite? We''re at the point where we need a DB to boot Rails. Thanks, -John -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Brian Blackwell Sent: Friday, April 18, 2008 1:46 PM To: ironruby-core at rubyforge.org Subject: [Ironruby-core] Running activerecord I wanted to test my prototype ADO.NET database wrappers for SQLite and MySQL, so I thought I would see how far I could get in an attempt to run activerecord. Running activerecord is of course a necessary step in the path to running Rails. At this point I''m simply trying to get "require ''active_record.rb''" to work, which in turn requires activesupport. Here are some issues I''ve come across thus far:
Hi John, No worries - see the attached zip file which contains the Ruby SQLite3 driver with a couple of minor modifications (in particular the modified database.rb loads the ADO.NET wrapper instead of the native driver). The ADO.NET wrapper itself can be found in the directory ''sqlite3\driver\ironruby''. Although it is still very much a prototype, I have been able to get a simple activerecord use case up and running (with a few workarounds for remaining IronRuby bugs) which creates tables and performs queries. The required SQLite3 ADO.NET DLL can be found at http://sqlite.phxsoftware.com. Cheers, Brian On Wed, 21 May 2008 15:30:38 -0700, "John Lam (IRONRUBY)" <jflam at microsoft.com> said:> Hey Brian - can you share your prototype ADO.NET wrappers for SQLite? > We''re at the point where we need a DB to boot Rails. > > Thanks, > -John > > > -----Original Message----- > From: ironruby-core-bounces at rubyforge.org > [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Brian Blackwell > Sent: Friday, April 18, 2008 1:46 PM > To: ironruby-core at rubyforge.org > Subject: [Ironruby-core] Running activerecord > > I wanted to test my prototype ADO.NET database wrappers for SQLite and > MySQL, so I thought I would see how far I could get in an attempt to run > activerecord. Running activerecord is of course a necessary step in the > path to running Rails. At this point I''m simply trying to get "require > ''active_record.rb''" to work, which in turn requires activesupport. Here > are some issues I''ve come across thus far: > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core-------------- next part -------------- A non-text attachment was scrubbed... Name: sqlite3-ironruby-20080521.zip Type: application/zip Size: 34482 bytes Desc: not available URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20080522/ffd77617/attachment-0001.zip>
Brian Blackwell:> No worries - see the attached zip file which contains the Ruby SQLite3 > driver with a couple of minor modifications (in particular the > modified database.rb loads the ADO.NET wrapper instead of the native driver). > The ADO.NET wrapper itself can be found in the directory > ''sqlite3\driver\ironruby''. Although it is still very much a prototype, > I have been able to get a simple activerecord use case up and running > (with a few workarounds for remaining IronRuby bugs) which creates > tables and performs queries. The required SQLite3 ADO.NET DLL can be > found at http://sqlite.phxsoftware.com.Cool. Thanks! -John