Slashdot Mirror


Rubyx OS - A Testament To The Power Of Ruby

Andrew Walrond writes "Rubyx the OS is created from source by rubyx the ruby script. Got it? The same small ruby script handles all subsequent package management, customised parallel and distributed user-mode package builds, and can create a live CD. For good measure, Rubyx (the os) sports an all new init and rationalised service management system written in ....can you guess?..."

27 of 121 comments (clear)

  1. Article... by Creepy+Crawler · · Score: 4, Funny

    ---For good measure, Rubyx (the os) sports an all new init and rationalised service management system written in ....can you guess?..."

    PERL ?

    --
  2. ROS by davegaramond · · Score: 4, Informative

    FYI, there's another initiative to develop a fully Ruby-based operating system (including the kernel), though one wonder when -- if ever -- this project will deliver something usable.

    1. Re:ROS by jonadab · · Score: 3, Interesting

      > FYI, there's another initiative to develop a fully Ruby-based operating
      > system (including the kernel), though one wonder when -- if ever -- this
      > project will deliver something usable.

      The mere existence of the initiative, as anything other than a joke, increases
      my interest in Ruby a thousandfold. I've been passing on learning Ruby because
      I've been figuring it's Yet Another Language With Perl Envy, but if these
      people understand the importance of writing an operating system in a VHLL
      and throwing out all the legacy C code, then I'm going to have to pay some
      closer attention to the language they want to do it in. Maybe they've got
      something after all.

      --
      Cut that out, or I will ship you to Norilsk in a box.
  3. My thoughts on Rubyx by Anonymous Coward · · Score: 4, Funny

    I am not familiar enough with Rubyx to comment on it one way or another. But I will tell you this - if I am ever in the market for an obscure and potentially very slow object oriented scripted OS - I will certainly consider Rubyx to be in my top 20 picks.

    1. Re:My thoughts on Rubyx by the_womble · · Score: 3, Informative

      If you had actually followed the link you would know that the whole OS is not written in ruby. It is Linux with a ruby installer and package system.

  4. Logo by Steven+Reddie · · Score: 4, Funny

    Lets start an OS written entirely in Logo. Drawing buttons and such will be easy enough, but it's the scheduler that is going to take some creativity. All user apps will also be written in Logo and it will be possible to virtualise the entire OS inside a user app. Extra care must be taken to ensure process don't write over the top of each other.

  5. Re:insane by cowens · · Score: 5, Interesting


    I am a Perl user
    </disclaimer>

    It is an installer and package manager written in Ruby not an OS. The website doesn't seem to make this very clear though, so I don't blame you for being confused. It is really a Linux (or GNU/Linux if you prefer) distribution. If we were to follow this logic then Mandrake Linux would be a Perl OS and Fedora/Redhat would be a Python OS.

    When evaluated on that level it looks interesting. It seems to combine the concepts of LFS and Gentoo with stow like package managment.

  6. Um, isn't this just another Linux distro? by ivern76 · · Score: 4, Informative

    I'm not too sure how this isn't 'Rubyx, the Linux distribution with an installer/package manager written in Ruby'. If it had been written in any other language, would it still be cool?

    1. Re:Um, isn't this just another Linux distro? by popeyethesailor · · Score: 4, Funny

      Damn straight. They should have named it GNU/Glibc/XFree(C)TM/QT/KDE/Ruby-Lang/Rubyx .

    2. Re:Um, isn't this just another Linux distro? by dagbrown · · Score: 3, Informative

      Actually, there are a couple of cool things about Rubyx that make it different from a run-o'-the-mill Linux distro, and the language they're in ain't one of 'em.

      The first is that it's self-bootstrapping--you can just download the Rubyx script and use that to build an install ISO. That's pretty darned cool if you ask me.

      The other cool thing about it is that it completely eschews the entire SysV init system with one of its own, based on dependencies instead of on educated guesses by the sysadmin (read: arbitrary order) as to what order services should start up and shut down in. This lets you speed up booting by starting independent services concurrently instead of waiting for each service to start up individually.

  7. Re:So when is PerlOS coming out? by cowens · · Score: 3, Informative

    If Rubyx is an OS then it does: Mandrake. The installer is written in Perl and the package management is done with Perl. That is all Rubyx is.

    But if you want an example of extreme silliness in Perl you can look at http://freshmeat.net/projects/perlbox/ a Desktop Environment written in Perl.

  8. A little too much Fanboy vibe by Jerf · · Score: 4, Interesting

    I wasn't going to say this, but after reading a few of the comments here I've changed my mind.

    The name Ruby x conveys a little too much "Ruby fanboy" vibe. It's a Linux distribution, yet the name doesn't mention it and the website gives only cursory mention of this fact, which borders on the deceptive. I want to emphasize that I mean these things exactly as I say... a little too much fanboy vibe, borders on the deceptive. It's not irredeemably bad, but I do have to say at the moment I'm having a hard time respecting the project.

    In fact this could well hurt even the Ruby advocacy side of the project by scaring people off, thinking they'll need to know Ruby to install, when instead it looks like Yet Another Linux Distribution.

    I mean this as constructive criticism. To the project leaders, I strongly recommend that you more carefully evaluate the goals of the project, more clearly partition the "Ruby" concept from the "Linux Distribution" concept, and determine whether your goals justify the seemingly over-strong focus on Ruby. Yes, I know Ruby lovers have a bit of a persecution complex, I recognize this in myself as I like Python and see the same in the Python community, but in the long run you're going to get more real respect by building a real project on Ruby and discreetly pointing out that it runs on Ruby then by shouting out in the streets that THIS RUBY DISTRIBUTION OF RUBYX IS MADE POSSIBLE BY RUBY, THAT WONDERFUL (RUBY) LANGUAGE! (Yes, this time I'm exaggerating for dramatic effect; again I emphasize I'm not claiming the site actually sounds like this but the tone is definately there.)

  9. Re:hmm.. maybe a bit Off Topic.. but by Jerf · · Score: 3, Informative

    Consensus gestalt that I've gotten as a Python user and reading a lot of debates on this topic is that structurally, Ruby is a little more pure OO then Python, but the practical differences seem minimal, especially after the type/class unification in Python. (Ruby advocates are proud of their block syntax but I'm yet to see something I don't immediately know how to write in Python, too; the question is which fits your mind better.)

    Syntactically, Ruby is more like Perl. If you consider sigils an abomination upon the land, as I do (despite working professionally in Perl), then you'll want Python. If you consider them Larry Wall's gift to syntax, then you'll want Ruby.

    The other thing is, if you're expecting to use a library of some kind, check for availability. Python has the edge right now AFAIK but that doesn't matter unless Python has something that Ruby doesn't that you need, or vice versa; for most people my impression is that the necessary modules are there in both languages.

  10. Re:hmm.. maybe a bit Off Topic.. but by Anonymous Coward · · Score: 5, Informative

    I use Python mostly for "work", but I much prefer Ruby and try to use it whenever possible.

    If you are a theoretical guy who loves a conceptually elegant and consistent language like Smalltalk or Scheme, you'll love Ruby. Ruby is so consistent, it's really lovely.

    If you're more practical and need good documentation and extensive libraries, you'll probably be annoyed by it.

    If you like to write programs FAST but not sacrifice readability like Perl, you'll really love Ruby. For instance in Ruby, you don't have to type "self" in method argument lists the way you do in Python. Ruby is 100% object oriented inside and out. Classes are first class objects, subclasses of Module objects. There are no "old style classes" or "new style classes", no cruft held over from previous versions of the language.

    In Python, you have built-ins like "str()" which can call the __str__() method on an object. None of that kind of repetition in Ruby. Just call obj.str (or actually, obj.to_s) directly. You don't need the parens in that case.

    Ruby has "blocks" which are a nice syntactic sugar for a whole class of operations. For instance a database transaction can be implemented as a block:

    transaction { |t|
    do stuff with t
    more stuff
    }

    in Python that would be:

    t = start_transaction()
    try:
    do stuff with t
    more stuff
    finally:
    end_transaction()

    The ruby version is easier to read.

    If you want a large selection of tools and implementations, well, Ruby doesn't have too many like Python.

    Also the Ruby community is still small and friendly. The python community is turning into the Perl community, in my opinion. A little arrogant.

    Python is starting to look more and more like Ruby every revision though.

  11. Re:hmm.. maybe a bit Off Topic.. but by gavri · · Score: 3, Insightful

    If you consider sigils an abomination upon the land, as I do (despite working professionally in Perl), then you'll want Python. If you consider them Larry Wall's gift to syntax, then you'll want Ruby.

    In Ruby, Sigils indicate scope, not type! Whole different thing.

    It doesn't obfuscate the code. Makes it easier to read actually.

  12. Re:Enhanced Package Management by Deagol · · Score: 4, Interesting
    (I apologize for this lengthy off-topic post, but I had to respond to the parent's desire for concurrent multiple versions in a package system. Maybe someone with coding skill -- unlike myself -- could run with it.)

    For example, making it easy to run multiple versions of, say, gcc on the same system and switch between them at will...

    I have a home-brew system like this, and I would die of joy if something like Debian's apt or {Free,Open}BSD's ports system would integrate it.

    I actually can't take credit for it, and I really don't know if it's that unique, but the people I've introduced it to love it. And thanks, Lou, for showing it to me. It's a shame this post won't get a larger audience (then again, maybe it's a conceit to believe anyone would actually care. :)).

    Okay, here goes...

    I have on all of my machines (or "boxen", just to annoy those of you who loathe the term), a directory called /mfs -- "my file system". The philosophy is that of /opt or /usr/local: a place to install custom software without colliding with the main system tree.

    Within /mfs, there's dist, src, obj, & pkg. I place the tarballs in dist, I unpack the source into (you guessed it) src, I (sometimes) build in obj, and I install into pkg.

    My most common use is installing OpenSSH onto various platforms, so I'll use that to illustrate.

    I download the tarballs into my dist dir: tcp_wrappers_7.6.tar.gz, openssl-0.9.6l.tar.gz, zlib-1.2.1.tar.gz, & openssh-3.8p1.tar.gz.

    Next, I unpack them into src, where I usually build them, though sometimes I build them in obj.

    Sometimes, it's a matter of a simple --prefix paramater to the config script. Sometimes it takes modifying Makefiles. But usually without fail, I can shoehorn most any application into it's proper place: /mfs/pkg/package/version.

    The goal is to totally isolate the application within its own directory -- even it's own etc, tmp, var (or whatever) directories. If it's possible (never mind the convenience of making it happen), that program will never collide with another version of that program on the system: .pid files, logs, sockets - nothing.

    So when all's said and done, I now have:

    /mfs/pkg/openssh/3.8p1
    /mfs/pkg/zlib/1.2.1
    /mfs/pkg/openssl/0.9.6l
    /mfs/pkg/tcp_wrappers/7.6

    Each, of course, has all of the etc, bin, lib, include, sbin, var, tmp, and man directories the app needs to run.

    Once this structure is in place, it's pretty obvious where it leads: you can painlessly have concurrent versions of any program and/or library you could ask for. Since apps are linked to a specific library version, installing a new version of that library won't collide with the old one.

    Ever try installing a current SRPM of openssh onto an older Redhat release? It's a nightmare! The RPM requires a current version of openssl, but the KDE libraries all require openssl 0.9.5 (or some such). You just cannot get it to work.

    So you may now be thinking to yourself, "Okay, that's kinda useful. But when you have hundreds (or thousands) of apps, your PATH would be insanely long. This just won't work."

    That's a good point -- but there's a solution. Use the "lndir" command from within /mfs, to link your desired package into the root /mfs directory:

    cd /mfs && lndir pkg/openssh/3.8p1

    Now, thanks to the lndir command, you now have the directories /mfs/{bin,etc,sbin,man} populated with symbolic links to the actual programs. Now you can set your PATH, MANPATH, and even init scripts to point to the "main" /mfs directories.

    But wait, there's more! Let's say we h

  13. Re:Who the hell cares? by pyman · · Score: 3, Funny
    99.99% of the code out there is garbage and would be better written in INTERCAL.

    Seriously, where do you get your statistics from? Your arse? Thought so.

    --
    a ^= b; b ^= a; a ^= b;
  14. Re:hmm.. maybe a bit Off Topic.. but by Colonel+Panic · · Score: 4, Interesting

    Can someone explain clearly why someone who works a lot with python, why one might find it worth while to invest into learning about Ruby?

    If Python is doing everything you need it to do and you're happy with it and you're not curious, then maybe there isn't any reason for you to learn Ruby.

    However, if you have at least a little bit of intellectual curiosity, you might find it rewarding to spend an hour learning some Ruby and trying it out. I emphasize the tryinging it out part: sure the two languages have very similar capabilities, however it feels much different programming in Ruby than it does in Python. It's difficult to explain, you have to try it. I tend to think it has something to do with the fact that Ruby's built-in libs made use of iterators from the start (and it also has something to do with Ruby's blocks).

    Also, if you prefer not having syntactically significant pieces of your code be invisible then you'll probably prefer Ruby. Yes, it's that indentation-as-syntax thing in Python that kept me from going with the snake a few years back before I found Ruby. Yes, I've heard all the arguments from the Pythonistas about how your editor will just take care of things for you and how life will be so wonderful. However, I was bit by this twice within the first hour that I tried Python. One person might have his editor set to expand tabs and another might not. I haven't got time to spend several minutes trying to figure out why some code (which looks perfectly fine) doesn't work only to find that it's a tab expansion problem, "gee, the code looks identical to the code in the book?! WTF?!" - Life's too short.

  15. Re:Who the hell cares? by Colonel+Panic · · Score: 4, Insightful

    Why devote so much energy into implementing a mediocre system using ruby, of all languages, when you could spend time improving an existing system?

    How do you know it's mediocre? Have you tried it?
    Do you even understand what it does?

    Total waste of time...99.99% of the code out there is written in C -based languages (java, php, C++) for a reason...

    You could be the one that's totally wasting your time. One should choose the right language for the job at hand.

    I recently inherited a project which took six months to develop in C++. It weighed in at ~4800 lines of C++ code. Since we needed to significantly expand the scope of the project and also add a GUI _and_ since execution speed wasn't an issue, but development time _was_ an issue I decided to rewrite the code in Ruby. It took a week and came to ~1200 lines of Ruby. The resulting Ruby code is much more flexible and easier to modify and add to than the previous C++ codebase (good riddance to it). I'll gain back that week invested to do the conversion several times over as the project progresses and as the requirements (inevitably) change... and I'll keep my sanity.

    Choose the right tool for the job. If speed of execution is an issue then by all means use C/C++ (I do). However, if you need to develop code quickly then use an agile (aka scripting) language - I prefer Ruby for that role.

  16. Re:hmm.. maybe a bit Off Topic.. but by Discordantus · · Score: 3, Informative
    It has some of them. But their use is mostly discouraged... the ugliness of the $s and @@s are supposed to keep people from using them :) Also, there are many excellent constructs built in to replace them. Take Perl's regex match variables, for instance. Here is an example of a Ruby way of using regex matching, where you can collect "MatchData" objects from a match:

    (note that '#' starts a comment, and => (value) in an end-of-line comment is showing the resulting value of an expression.)

    re = /(\d+):(\d+)/ # match a time hh:mm
    md = re.match("Time: 12:34am")
    md.type #=> MatchData
    md[0] # == $& => "12:34"
    md[1] # == $1 => "12"
    md[2] # == $2 => "34"
    md.pre_match # == $` => "Time: "
    md.post_match # == $' => "am"

    You can collect as many matches as you want before you process them. There are no freaky, hard to remember variable names that you need to remember. You can still do it the Perlish way if you want to, but a lot of that stuff has been slowly made less desirable to use. I wouldn't be surprised (or upset) if they disappeared altogether in the future.

    Then again, there may be the exact same thing in Python, and you're wondering why it's special. Since I went to Ruby straight from Perl, I wouldn't know.

    (The code was pulled directly from online docs, so I'm not pretending I wrote it :)

  17. The Slashdot experience - By the Rubyx author by awalrond · · Score: 5, Interesting

    How much can you convey in 1 paragraph? Maybe I did a bad job, but I did at least expect/prime (with "can you guess") the ruby/perl/python flamefest.

    But a few people were intelligent enough to pick out the salient points, or were bothered to read the website. And then downloaded 8Gb of Rubyx overnight. (Hang the cost; It made me smile!)

    For those of you who somehow missed those salient points:

    Rubyx is 'yet another linux distro', that builds from source (like gentoo). It is _not_ an OS written in ruby.

    But it's different because...

    Rubyx can be created, with a single command, using the rubyx script.
    With a second command, you can create a bootable Rubyx CD/DVD.
    The same script handles ALL subsequent package management.

    Reread that last bit. This is one small script we are talking about, written in the ruby language.

    I wrote the new init system inside 2 days. Go figure. A complete init replacement in two days.

    Yes, I'm a fan of ruby. Its the most writable, readable scripting language I have tried. Could Rubyx have been done in another language? Surely. But, I argue, not as quickly, elegantly and maintainably.

    Have a lovely day :)

    Andrew Walrond

    1. Re:The Slashdot experience - By the Rubyx author by awalrond · · Score: 3, Interesting

      The stable version does semi-parallel startups. (Probably enough for most needs - see the script for details)

      I am testing a simple variation of the init scipt which does it properly. I'm pretty happy with it and will probably release it in rubyx version 38.

  18. Cleese by GerritHoll · · Score: 4, Informative

    At first glance, I thought this would be similar to Cleese, a Python-based operating system, but it isn't: RubyX is a distro with some stuff written in Ruby, and Cleese is an actual effort to write a kernel in Python. Not that it's progressing a lot, though... the CVS tree can be found here.

  19. So ..... by CoolCat · · Score: 4, Funny

    When will it be self aware?

  20. Re:Japanese by ladislavb · · Score: 3, Informative

    The character ("li" in Chinese) means "power" or "strength" (in both physical and spiritual senses of the word).

  21. Re:Logo OS? Try a Lisp OS by tamills · · Score: 5, Interesting

    It's been done. 20 years ago. My first serious workstation development was on a Symbolics Workstation whose OS was written in LISP. We had a windowing operating system with bit-mapped graphics, source-level debugging, suspend-substitute-and-continue code execution. Just all kinds of cool stuff. And coding in an OO LISP was the best experience. Ruby and Perl have both similar levels of joy in programming, but as LISP was my first, it will always hold a special place.

    Unfortunately it was too expensive. My workstation cost $125000. Alas...

    --

    Be careful what you wish for...

    Where your treasure is there is your heart also...

  22. Re:hmm.. maybe a bit Off Topic.. but by xteddy · · Score: 3, Informative

    The |x| is a block parameter list. Blocks are Ruby's way to emulate higher order functions.

    [ 1, 2, 3 ].each { |x| puts x }

    would print "1", "2" and "3" in three different lines.

    The block parameters are very clever, you can also put something else than only variables there. If you want to compute the sum of the products of some pairs, you could do it that way:

    a = [[1, 4], [2, 5], [3, 6]]
    sum = a.inject(0) { |s, (x, y)| s + x * y }

    The block would first be called with s = 0 and (x, y) = [1, 4], that would assign x to 1 and y to 4.

    The inject would compute
    s = 0 + 1 * 4
    s = 4 + 2 * 5
    s = 14 + 3 * 6 = 32
    by calling the block three times once for every pair in the list and adding the results in the s and returning the result s.

    The ||-syntax looks very similar to the Smalltalk syntax for local variables. Ruby is very strongly influenced by Smalltalk. The inject method name stems also from Smalltalk. You can use blocks to make sure something is done after a block of code has been executed instead of using destructors or finalizers. An example would be to close a file after reading it:

    File.open("/etc/passwd") do |f|
    puts f.read.count("\n") # => number of lines
    end # => file f is closed here

    do...end is equivalent to { } and usually used if the block is not an oneliner. Readability is actually very important in Ruby culture.

    Ruby has an exception handling that is very similar to Python's, but the keywords seem to be blatantly stolen from Eiffel's Design By Contract. The transaction example from above could also be coded that way in Ruby:

    t = start_transaction()
    begin
    do stuff with t
    more stuff
    rescue => e
    puts "Caught an exception: #{e}"
    ensure
    t.end_transaction
    end

    I don't think that Ruby has a problem wth "non-alphanumeric" characters - it uses them very wisely, actually. I remember that Python uses lots of __foo__ and """bar""" - that really makes me feel uncomfortable when I have to read Python code!