Most of the libraries are still poorly specced. I actually wrote most of
the current etc ones in order to get them passing. If you look around
though, you can find places in the lib specs that are empty files
From: Shri B. [email protected]
Sent: Sunday, April 04, 2010 10:58 AM
To: [email protected] [email protected]
Subject: Re: [Ironruby-core] Anyone interested in implementing Etc
module for Mono?
If you run ââŹĹmspec ci library\etcââŹÂ, that runs the real RubySpec specs.
irtests does run a command like ââŹĹmspec ci libââŹÂ which will run the Etc
RubySpec specs. http://wiki.github.com/ironruby/ironruby/rubyspec might
be useful to you about how these scripts work.
The RubySpecs are supposed to be working on all platforms. The specs use
checks like ââŹĹplatform_is :windowsââŹÂ or ââŹĹplatform_is_not :windowsââŹÂ to have
versions for all OSes. I am surprised that the current ones expect nil.
You can fix them to have versions of the specs that work on Unixes. You
can run the tests against MRI using ââŹĹmspec ââŹâtrââŹÂ to ensure that the spec
you add is correct.
If you can streamline the development process for Mono, that will be
great so others have an easier time in the futureââŹÂŚ
From: [email protected]
[mailto:[email protected]] On Behalf Of Ryan R.
Sent: Sunday, April 04, 2010 9:54 AM
To: [email protected]
Subject: Re: [Ironruby-core] Anyone interested in implementing Etc
module for Mono?
Iâve posted all the type fixes, but since I canât compile master, Iâm
hesitant to rebase. What should I do? Also, I still havenât gotten to
the tests. Looks like the current ones all expect nil and assume
Windows. Are those the real rubyspec specs?
Sent from my iPhone
On Apr 3, 2010, at 10:13 PM, Jim D.
<[email protected]mailto:[email protected]> wrote:
Also, to get a Int32 out of a UInt32, you should be able to use
induced_from:
a = System::UInt32.new(1)
=> 1 (UInt32)
Fixnum.induced_from(a)
=> 1
Minor thing, but it will work.
The fact that etc is a class is my bad. I was just getting enough
implemented in order to pass some specs and use libraries that expected
the nil on Windows.
JD
From:
[email protected]mailto:[email protected]
[mailto:[email protected]] On Behalf Of Tomas M.
Sent: Saturday, April 03, 2010 6:01 PM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] Anyone interested in implementing Etc
module for Mono?
That is a bug. Make it a module.
Tomas
From:
[email protected]mailto:[email protected]
[mailto:[email protected]] On Behalf Of Ryan R.
Sent: Saturday, April 03, 2010 5:02 PM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] Anyone interested in implementing Etc
module for Mono?
Quick question: The etc.rb in Libs is a class, but the implementation in
the Ruby Standard Library appears to be a module. Should I keep the
class or use the module?
Ryan R.
On Sat, Apr 3, 2010 at 4:43 PM, Tomas M.
<[email protected]mailto:[email protected]>
wrote:
Nice work.
A few suggestions:
-
You can move the file to
C:\M0\Merlin\Main\Languages\Ruby\Libs.
-
Use System::Environment::
System::Environment.OSVersion.Platform to detect the OS (see e.g.
Win32API.rb in Libs).
-
Rather than check for the platform in every method it might
be better to define the methods differently on Windows. Something like:
module Etc
platform = System::PlatformID
case System::Environment.OSVersion.Platform
when platform.Win32S, platform.WinCE, platform.Win32Windows,
platform.Win32NT:
def self.endgrent; end
def self.endpwent; end
def self.getgrent; end
ââŹÂŚ
else
load_assembly âMono.Posixâ
def self.endgrent
Mono::Unix::Native::Syscall.endgrent
end
def self.endpwent
Mono::Unix::Native::Syscall.endpwent
end
def self.getgrent
to_group(Mono::Unix::Native::Syscall.getgrent)
end
ââŹÂŚ
end
end
From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Ryan R.
Sent: Saturday, April 03, 2010 3:59 PM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] Anyone interested in implementing Etc
module for Mono?
Iâve posted an initial âcompleteâ implementation, though I have only
done basic testing. I have a couple of TODOâs remaining and some
cleanup, as well as writing actual specs. I still donât have tests
running. You can find the module here:
http://github.com/panesofglass/ironruby/blob/linux/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/Etc/IronRuby.Libraries.Etc/etc.rb
Not the prettiest thing in the world, but I just wanted to get it
working. I definitely still have work to do.
Cheers,
Ryan R.
Email: [email protected]mailto:[email protected]
LinkedIn: http://www.linkedin.com/in/ryanriley
Blog: http://wizardsofsmart.net/
Twitter: @panesofglass
Website: http://panesofglass.org/
On Sat, Apr 3, 2010 at 2:30 PM, Ryan R.
<[email protected]mailto:[email protected]> wrote:
Sure!
Mono::Unix::Native::Passwdhttp://www.go-mono.com/docs/index.aspx?link=T:Mono.Unix.Native.Passwd
and
Mono::Unix::Native::Grouphttp://www.go-mono.com/docs/index.aspx?link=T:Mono.Unix.Native.Group
that are returned from the
Mono::Unix::Native::Syscallhttp://www.go-mono.com/docs/index.aspx?link=M:Mono.Posix.Syscall.getusername(System.Int32
functions have UInt32, System.String, and System.String[]. System.String
is no biggie, and Iâm finding .to_i on a System.UInt32 is still
displayed as System.UInt32, so I suppose thatâs not an issue, either.
MRI displays Fixnum as the type, and I was trying to get the correct
types back from the functions. That leaves MRIâs Array to Monoâs
System.String[].
My current implementation is just a Ruby module wrapping calls to the
Mono functions and returning the appropriate types. Most of it is
working, though without being able to run tests easily, Iâm testing from
the command line. I still need to add conditionals to return nil if itâs
run on Windows. I suppose I also need to conditionally load the
Mono.Posix.dll if itâs on Windows, too.
Iâm about to finish the basic implementation and post to
githubhttp://github.com/panesofglass/ironruby/blob/linux/Merlin/External.LCA_RESTRICTED/Languages/IronRuby/Etc/IronRuby.Libraries.Etc/etc.rb.
(Iâve already got what I finished last night up there.) I also asked
Shri for a pairing session to make sure itâs inline with what youâre
wanting.
Cheers,
Ryan R.
Email: [email protected]mailto:[email protected]
LinkedIn: http://www.linkedin.com/in/ryanriley
Blog: http://wizardsofsmart.net/
Twitter: @panesofglass
Website: http://panesofglass.org/
On Sat, Apr 3, 2010 at 11:25 AM, Tomas M.
<[email protected]mailto:[email protected]>
wrote:
Can you give an example of where you need the conversions?
Tomas
From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Jim D.
Sent: Saturday, April 03, 2010 11:00 AM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] Anyone interested in implementing Etc
module for Mono?
No conversion for Fixnums is needed (Fixnums are ints). Arrays are
harder. I would take a look at clr_ext in
merlin/main/languages/ruby/samples. Inside that file is a to_clr_array
method
JD
From: Ryan R.
<[email protected]mailto:[email protected]>
Sent: Saturday, April 03, 2010 12:13 AM
To: [email protected]mailto:[email protected]
<[email protected]mailto:[email protected]>
Subject: Re: [Ironruby-core] Anyone interested in implementing Etc
module for Mono?
Where is documentation on converting between CLR and Ruby types? I can
get RubyStrings, but what about Fixnum and Array?
Thanks,
Ryan R.
Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core
Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core