Wordpress Port

Discussion in 'Ruby' started by hjast, Dec 7, 2009.

  1. hjast

    hjast Guest

    Has there any been an effort to make a ruby Wordpress port? I am a
    rails and ruby guy, and now have to do a blog in Wordpress. PHP is an
    ugly langauge and I wish I could use ruby for extending and looking at
    the architecture. Since Wordpress is open source we could just
    straight port a lot of the code from wordpress as it is. Someone could
    even make a parser which makes php extensions or themes compatible.

    I guess in general, this is a question about the lack of CMS's in
    ruby. THe general comments usually are, why have a cms when we can
    make it in rails so much fast? I agree with the point that Rails is
    quite mature and robust to handle making any type of site very
    quickly. There is one problem, this is contingent on knowing Ruby on
    Rails. To help further Ruby's cause perhaps people should come to
    together to port a few proper CMS's or at least add some sort of
    hjast, Dec 7, 2009
    1. Advertisements

  2. Well there are some well-known Ruby CMSeseses.

    Have you looked at Radiant CMS? http://radiantcms.org/
    Rick DeNatale

    Blog: http://talklikeaduck.denhaven2.com/
    Twitter: http://twitter.com/RickDeNatale
    WWR: http://www.workingwithrails.com/person/9021-rick-denatale
    LinkedIn: http://www.linkedin.com/in/rickdenatale
    Rick DeNatale, Dec 7, 2009
    1. Advertisements

  3. [Note: parts of this message were removed to make it a legal post.]

    And if you're looking for a Rails-based blog platform, there's Mephisto:

    Wordpress is enormous. Porting would be non-trivial.

    Jason Roelofs, Dec 7, 2009

  4. No, It sounds like hjast wants to check out phuby on phails. The video
    from RubyConf2009 should be up soon -- the session you need to see is:

    21-Nov-09 15:05
    "Worst. Ideas. Ever."
    Aaron Patterson and Ryan Davis

    Really, if I tries to tell you much more about it, the effect would be

    For now, you'd have to settle for this:


    Rob Biedenharn http://agileconsultingllc.com
    Rob Biedenharn, Dec 7, 2009
  5. If you're wanting a way to work with Wordpress, the PHP app -- for example,
    writing a Wordpress plugin in Ruby -- I don't think there really is one,
    though that's not entirely a bad idea. Just mostly a bad idea.

    If you're looking for an actual port of Wordpress, and I think this is what
    you want...
    Well, code written in one language doesn't always translate directly into
    another language. I'm guessing the word press architecture isn't a good fit --
    you could probably do something better starting from scratch in Ruby, which is
    why someone pointed you to Mephisto.
    Well, probably not. You might be able to build a bridge (as the Phuby guy was
    jokingly suggesting), but short of that, no you couldn't. Keep in mind that a
    PHP extension or theme is still PHP code, not Ruby code. Translating one
    language directly into another, even when it works, usually leads to fairly
    ugly code.
    I don't agree with that, and I think a lot of the Merb people were thinking
    about ways to improve that situation, especially by stealing ideas from

    And I definitely think Wordpress is not a good choice for a CMS.
    Drupal would be a much better choice.
    David Masover, Dec 7, 2009
  6. [...]

    JRuby and Quercus, maybe? :)

    Seriously, I'm not even sure it's that bad of an idea. Writing Java in
    Ruby certainly works well; why shouldn't writing PHP in Ruby?

    Of course, that's only if you're stuck with Wordpress to begin with. I
    agree that something like Mephisto is probably a better choice.

    Marnen Laibow-Koser
    Marnen Laibow-Koser, Dec 7, 2009
  7. hjast

    pharrington Guest

    Well, JRuby is Ruby running under the JVM, which I wouldn't quite call
    "writing Java in Ruby." The JVM has alot going for it: fantastic
    performance, rich set of libraries, everything runs it, threads that
    run in parallel, etc. I don't see any of those benefits for trying to
    get Ruby interoperability with PHP.
    pharrington, Dec 7, 2009
  8. In particular, there isn't any sort of PHP VM that we could meaningfully
    target. We'd be compiling Ruby to PHP, at best. JRuby doesn't compile Ruby to
    Java, it compiles Ruby to JVM bytecode.

    The rest of this is true, also:
    The "rich set of libraries" is the only benefit I can see for PHP, and I'm
    very skeptical -- not just of quantity, but of quality.
    David Masover, Dec 8, 2009
  9. Have you looked at the typo blog[1], I am not really familiar with
    wordpress so can't comment on how typo compares, but it does support
    themes, plugins and internationalization. Customizing or extending typo
    would probably be easier then trying to port wordpress to ruby.


    1. http://wiki.github.com/fdv/typo/
    Edward Middleton, Dec 8, 2009
  10. hjast

    Ryan Davis Guest

    as long as you take care not to enter its event horizon, you'll be fine.
    Ryan Davis, Dec 8, 2009
  11. If you're running a Rails app or something in JRuby, I'd agree with you.
    However, I was thinking of something along the lines of the app I'm
    currently developing with Swing and Monkeybars, where almost every Ruby
    class has at least one call to a Java class, and often more. That
    really does start to feel like writing Java in Ruby.

    I do understand the conceptual difference between Java and JVM bytecode,
    Everything runs it, every host has it...

    ...but seriously, it was more of a devil's advocate question.

    Marnen Laibow-Koser

    But to
    Marnen Laibow-Koser, Dec 8, 2009
  12. Well, there are a couple of PHP compilers, as well as Quercus...
    Yes, I know.
    Is this skepticism based on anything other than being a Smug Ruby Weenie
    [TM]? I spent about 4 happy, productive years as a PHP developer, and
    enjoyed working both with the language and the many good libraries.

    Of course, everything's done to higher standards in the Ruby community.
    But that's because Ruby's so good, not because PHP's so bad.

    Marnen Laibow-Koser
    Marnen Laibow-Koser, Dec 8, 2009
  13. The current master branch is getting better. It runs on rails 2.3.x and
    I am working on a ruby 1.9 support.


    1. Or wasn't when I deployed it ;) http://blog.vortorus.net/
    Edward Middleton, Dec 8, 2009
  14. Ah, point taken. So we could use the JVM after all.
    No, not really...

    Well, ok, there are a few complaints.

    First of all, PHP had object-orientedness tacked on after the fact. Now, this
    can be done well, and it can be done poorly. In PHP's case, it was done poorly
    -- I'd almost rather not use them at all.

    By contrast, Perl implemented OO rather well, and it did so _after_ modules
    were implemented. Indeed, Perl libraries were already well-namespaced and easy
    to transform into something object-oriented -- and I found CPAN to be of
    consistently high quality, especially the documentation.

    Second, just look at the number of global functions in PHP. I'm not talking
    about the ones you'll write yourself, but the ones that are built into the
    language. Even Perl is better about this, and Javascript certainly is.

    And there's the inconsistency, and layers of cruft from Really Bad decisions.
    Stuff like mysql_escape_quotes. Or is it escape_quotes_mysql? Or maybe
    mysql_really_escape_quotes? I always forget, and using the wrong one will
    either corrupt my data or leave me open to SQL injection -- nevertheless, I
    must use it on every single database operation.

    Even Rails supports the idea of placeholder values (when you need to touch SQL
    at all), and this is commonplace at the database API in Perl -- the idea of
    prepared statements comes to mind. This is a much easier habit to maintain --
    and more efficient, too.

    So the language itself doesn't lend itself to particularly high quality in the
    first place.

    I mean, think of the design of it, too. The syntax alone, the fact that every
    file is essentially already a template -- this was never intended to be a
    general-purpose language. It was intended to be a template language. It
    doesn't even make a very good template language -- Haml is better, even if you
    don't consider the fact that it's tied to Ruby.

    Add to that, one of the problems PHP shares with Ruby is its low barrier of
    entry, being perceived as an "easy" language -- only PHP seems to have this to
    a greater degree. People who learn Ruby and Rails are at least trying to learn
    to program. People who learn PHP usually start as designers, who learn a bit
    of HTML and CSS, and need a tiny bit of server-side logic in their HTML page,
    so they learn a bit of PHP or paste a bit of code in...

    For that matter, I'd guess the better developers would see that there are
    better languages, and would migrate away from PHP, in the long run.

    Now, this is all circumstantial evidence. It's possible there's a large, well-
    organized community of quality PHP software. Maybe things have changed since I
    last used it.

    But I've also been on two language rants in the past two days, and I should
    Good for you. Hey, I've seen Drupal. I was amazed -- there are things I
    strongly dislike about it, but here was object-orientation, modules, mixins,
    all kinds of good stuff. Sure, it was completely hacked together, and not at
    all supported by the standard, but it was decent.

    This would be the main argument for creating some sort of Ruby bindings --
    because then we could write Drupal plugins in Ruby.

    But it would end in tears. As I said, Drupal (at least, last I checked) hacks
    these things together. I'm fairly sure it doesn't even use PHP's own object-
    orientedness, as it predates that, and certainly predates its widespread
    adoption -- thus, while PHP and Ruby both support objects, you'd have to write
    Drupal-specific bindings to get any meaningful objects relating to Drupal
    Ruby, and Perl, and Python, are so good? ...and Erlang, and io?

    In fact, the only language I can think of in this niche that I dislike more
    than PHP is Visual Basic.
    David Masover, Dec 8, 2009
  15. hjast

    James Britt Guest

    I've been building up a fairly complex site using Radiant, and it's
    really sweet.

    Better to write and/or improve extensions for Radiant than porting
    something from PHP with dubious architecture.

    James Britt

    www.jamesbritt.com - Playing with Better Toys
    www.ruby-doc.org - Ruby Help & Documentation
    www.rubystuff.com - The Ruby Store for Ruby Stuff
    www.neurogami.com - Smart application development
    James Britt, Dec 8, 2009
  16. [Warning: no Ruby content whatsoever.]

    True. I've used very little of PHP's OO. I was really an OO skeptic
    until about the same time I started using Rails.
    Generally so. But Perl is awful for writing Web applications.
    I'm not sure I understand your point. PHP was obviously designed
    primarily as a procedural language, so it's sort of appropriate for
    there to be lots of global functions.
    No. There are far better DB libraries than the built-in ones.
    And possible in PHP. Everything I ever did in PHP used the Pear DB or
    MDB2 library, both of which support prepared statements. I learned that
    trick back in my ColdFusion days, and wouldn't have given it up in PHP.
    WTF? Just because the standard DB library has problems, you make this
    sweeping conclusion? Isn't that kind of like concluding that Ruby sucks
    because TMail and REXML are awkward?
    Yeah, PHP started as a template language, and it shows. But you don't
    have to use it that way. It's possible -- and recommended -- to write
    entire PHP files without any HTML in them. It looks more or less like
    Perl. It's not going against the spirit of the language at all.
    You could say the same about JavaScript -- people learn to write a line
    or two at a time, so they never really learn to use the language. Both
    JavaScript and PHP are pretty good languages if you allow them to be
    rather than considering them extensions of HTML.
    That's what happened to me -- but it wasn't PHP's language features that
    did it. It was the fact that TDD was more feasible in Rails than in any
    PHP framework I could find.
    There is. Maybe not enough, but there is. (MediaWiki, for example, as
    well as any PEAR library I've ever used...)
    Maybe you never really learned what you could do with it -- as witness
    your ignorance of DB library options.
    That must have been Drupal 6. Drupal 5 was horrible -- basically
    reinventing OO in a fragile procedural way.
    Drupal 6 was a complete rewrite, and I believe it does use PHP OO.
    VB is brain-dead. PHP is not, at least if you don't try to use its OO
    features to any great extent.

    I'm sorry, but it's obvious that you don't know what you're talking
    about with respect to PHP.

    Marnen Laibow-Koser
    Marnen Laibow-Koser, Dec 8, 2009
  17. Nice disclaimer!
    How so?

    Because I'd definitely disagree here. I think Perl is generally useful -- and
    I think Ruby is also generally useful. I just think Ruby is prettier and much
    easier to work with than Perl.
    Even supposing it was... Erlang is designed as a pseudo-functional language,
    and it still has the concept of namespaces. I realize PHP has namespaces, but
    I wasn't seeing them actually used, and there's still a bunch of cruft that
    seems to be from before PHP realized namespaces were a good idea.
    I'll grant this point -- I guess it had to be solved at some point.
    I actually kind of like TMail, though REXML has been improved on.

    No, the point is that in a default PHP setup, there's tons of this stuff.
    Again, from the global function count alone... It wouldn't be so bad if there
    was some kind of convention to them, but there isn't.

    There was a much better thought out rant against PHP, by a Perl guy, who made
    this point very well:


    To summarize it:

    - Arguments and return values are extremely inconsistent. That's with
    standard PHP libraries.
    - PHP has separate functions for case insensitive operations -- and these are
    inconsistently named. (Contrast to Ruby, where I can add /i to a regex, or I
    can just downcase the string.)
    - Continuing on that theme, functions are inconsistently named.
    - Scoping. Seriously.
    - Too many functions.

    Wow, I'd forgotten most of the reasons I hate PHP!

    For what it's worth, though, the "modularity" section may not apply -- PEAR
    may have solved that.

    He updates it for php5 here:


    This didn't really fix anything in the above list, but added classes, so he
    criticizes the PHP object model. But then, you agreed that the object model
    wasn't that good, so I won't care.

    It did, however, add exceptions. But since they were added after the fact,
    they're probably about as useful as they are in Perl. In Ruby, nothing (except
    ActiveRecord, apparently) ever just returns an error, it raises an exception
    if something's wrong. This means no silent errors. Noisy errors are a Good

    In Perl, while there is a strange way to deal with exceptions, nothing uses
    them. Perl objects tend to return a false value when something goes wrong.
    I realize this. My point is that many of the design decisions of a template
    language -- very simple syntax, just sprinkle some global functions, the
    assumption that no one will ever write anything huge in this -- all of this
    leaves a lot to be desired when you want to use it for something else.

    Perl started out as a report language, but it's at least extracted the
    "format" concept into a separate module.

    To make it even more perverse, even PHP people tend to use other template
    languages (like Liquid) instead of PHP, to do their templating in PHP. This is
    profoundly ironic to me. I suppose next thing you know, Liquid will become
    Turing-complete, people will be writing Liquid apps, and we'll need a
    safe/better template language for Liquid?
    Oh, I agree. And just because some people learn Rails because it's easy, and
    never bother to learn Ruby the language, isn't really a point against Ruby or
    Rails. But then...

    Javascript is a FAR better language than PHP.

    Javascript has first-class functions (which are also closures), a decent
    object system including prototypal inheritance, and the unification of objects
    and hashes (combined with that prototypal inheritance) means you can build
    your own inheritance system, or use classical inheritance...

    It could almost be called multi-paradigm.

    Frankly, the only reason I use Ruby instead of Javascript (where I do) is I
    like Ruby syntax better, and Ruby actually has bindings to native stuff I can
    use (there's no Javascript filesystem API that I know of). I mean, with v8,
    Javascript is even _faster_ than Ruby.

    So, scratch the surface of Javascript, and it becomes a truly elegant
    language. A lisp in disguise.

    Scratch the surface of PHP, and it's... more PHP. The next step in the
    evolution of a PHP coder is probably to learn another language.
    Now look at BDD, and at rspec. Or maybe rake.

    Can you imagine building anything like that in PHP?
    Probably -- I was mostly working with Wordpress and Drupal.
    It actually might have been Drupal 5.
    Yeah, so it would've been Drupal 5 that I was using.
    Or its reflection. Or the features it doesn't have...
    I have a feeling I should be glad of that.

    But just a quick test to see if it's worth learning more again:

    Does PHP have closures yet? Or even anonymous functions?

    I'll give you this: Languages evolve. It's possible I don't know what I'm
    talking about. It's possible the tnx.nl guy no longer knows what he's talking
    about. It's possible that PHP will one day evolve into a beautiful language,
    or at least a decent one, leaving me only able to grumble about syntax and
    snipe at the <? at the top of each file.

    On the other hand, from what I _do_ know of PHP, I can still name four or five
    better languages off the top of my head. Why would we want to evolve PHP into
    a good language when we have so many good languages already?
    David Masover, Dec 8, 2009
  18. First of all, PHP had object-orientedness tacked on after the fact. Now, this
    Are you talking about PHP4 or PHP5 there?
    Now that's funny.
    No, you must not.
    PHP has that support too, what's the problem?
    You can write Fortran in any language.

    That's BS. I can argue there are plenty designers starting with RoR as the
    first server side code that cannot tell Ruby from Rails.
    They sure did.

    Rimantas Liubertas, Dec 8, 2009
  19. It was PHP5, when I was doing this, but it was also a long time ago.
    How so?
    The question isn't whether you can or can't -- you can write Lisp or Ruby in
    any language, too. It's Turing-complete, and you can always write a

    The question is, what does the language encourage? Is it easy to write good
    code, and hard to write bad code, or vice versa? Is there syntactic sugar for
    good habits, and syntactic vinegar for bad ones?

    Compare any of these to C. You probably could write a web app in C. You
    probably could be about as efficient with it. You could be disciplined enough
    to never do pointer arithmetic, to never make assumptions about pointer size
    (and thus be 64-bit clean), to always use exactly the appropriate methods to
    operate on a data structure, and to maintain a consistent naming convention.
    You could commit to always using a proper string structure, rather than using
    null-terminated arrays of bytes.

    After all, Ruby itself is written in C, and I'm guessing PHP is, also.
    If you did it in C++, you could even fake some decent-looking syntax.

    The question is, first, do you really want to spend the months of development
    needed to make this easy in C? And second, wouldn't you rather have a language
    that makes this stuff easy, and makes it hard for you to accidentally use an
    uninitialized pointer, or make a buffer overflow?

    Think about that for a moment. In languages like Ruby and PHP, a buffer
    overflow is actually not possible. You might get it in a third-party library
    written in another language (like C), but you can't do it yourself. But in C,
    it's not only possible, it's a very easy mistake to make, and a hard one to
    I'd agree with you. The question is, how much of each is happening?

    And, in particular, I see this happening in PHP with _designers_. I don't see
    nearly as much of that happening in Ruby -- they at least acknowledge that
    they're going to be _developers_, even if it's their first language.
    David Masover, Dec 8, 2009
  20. hjast

    Seebs Guest

    This is hardly necessary. Pointer arithmetic can certainly be done safely.
    I'm not sold on this. I don't think I've had any buffer overflows in my
    code in years. It's pretty easy -- if I'm about to use a buffer, I make
    sure I know what I'm using it for and that I cap any copies and/or report
    failure if there's not enough space.

    I agree that it requires actual effort, as opposed to being implicit.

    FWIW, I hate PHP. I had to learn it once, and I still have to think about
    bleach any time I have to think about it. The killer for me was discovering
    that there was a thing like a function pointer which could be used only
    for user-defined functions, not built-in functions.

    Seebs, Dec 8, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.