Archive for the ‘Ruby’ Category

  • Fixing Console (and Other) Colors in Aptana Studio 3

    Date: 2011.04.16 | Category: Development, Rails, Ruby, Tech Stuff | Response: 1

    One thing that’s both cool and quite annoying at the same time about Aptana Studio 3 is the themes system.

    Clearly, Aptana have been looking at editors like Textmate and fallen in love with the brightly colored and bold texts on a black background, and have tried to implement that in Aptana Studio 3.

    The fact of the matter though, is that it just doesn’t work very well. To being with, Eclipse which Aptana Studio is based on, isn’t very text-on-black friendly – you can’t properly style the UI elements in Eclipse themselves, so you end up at best with a halfway-there result where non-text editor elements crave your attention being far too bright. Secondly, the theming isn’t properly carried through (yet?), so while there are themes that look fairly good with regards to editing Ruby, you’ll find that HTML, CSS, Javascript, and more are poorly themed, often leaving you with mostly uncolored markup.

    While I do like Textmate’s dark style theme, I just don’t like the idea when it’s attempted to be implemented in Aptana (Eclipse). So I’ve switched to the “Aptana Studio 2.x” theme which is text-on-white and has more styling of non-ruby code, too. The problem then becomes that your terminal windows (for firing off console commands, gitting, raking and such) become text-on-white, too. And not just that, the text colors aren’t changed to accommodate the white backgrounds, either – so you get 100% on white, which is pretty much impossible to read. And adding insult to injury, there aren’t any apparent way to change the terminal and console colors using the theme editor.

    Except, there is. You just have to add the tokens yourself. For fixing the terminal colors, so that you can have text-on-black terminals in a text-on-white theme, you just need to add some tokens to the list. You add a new token by clicking the small [+] button beneath the list of styling elements when in Preferences > Aptana > Themes:

    Screenshot of the Aptana Studio themes preferences section

    As you can see, I’ve already added the tokens, they’re the ones starting with “ansi.”:

    ansi.black
    ansi.white
    ansi.gray
    ansi.magenta
    ansi.cyan
    ansi.yellow
    ansi.blue
    ansi.green
    ansi.red

     

    The full list of available tokens that can be added when missing – if you want to also add missing styles for other (markup) languages – can be found here, on the Current Theme Scopes page on the Appcelerator wiki. One thing that’s not mentioned on that page is that there’s a sort of hierarchy defined for the languages, where broadly defined tokens, such as constant.other.symbol (which isn’t even mentioned, btw.) is used where language-specific variants, such as constant.other.symbol.ruby, are missing. This makes it easier to create more generic cross-language directives using fewer keywords :)

  • Ruby 1.9.2 on Ubuntu/Mint with no Fuss and no Muss

    Date: 2010.08.31 | Category: Development, Linux, Rails, Ruby, Tech Stuff | Response: 0

    Okay, so I was wanting to try out the newly released version 3.0 of Ruby on Rails, and I didn’t want any of that old and slow Ruby 1.8.x series that has been the default for years in Kubuntu, and probably any other Debian-based distro (I’m on Mint Isadora right now, and it’s the same thing here).

    Why? Well, you can take that jRuby and stuff it, because even if it beats the 1.8.x MRI “vanilla” Ruby in performance, it comes nowhere near the x4 performance Ferrari run you get with Matz’ MRI Ruby 1.9.x. Besides, let’s move the fuck on people, the first preview of 1.8 was released in 2002, and 1.9 has been here for three years! Could we just try to not fall asleep, please?

    Well, anyway, as this isn’t the first time I’ve tried to go the 1.9 way with Kubunuxumutuntu, I kinda expected it to suck, because I’ve never seen it actually just install and run as “ruby”. I’d always add the packages I wanted using apt, then do ruby –version, and be greeted with the all to familiar,

    The program ‘ruby is currently not installed.  You can install it by typing:
    sudo apt-get install ruby

    …sigh. Thanks. Of course, this isn’t because ruby wasn’t installed, it’s because it’s installed as “ruby1.9.1″, gem is “gem1.9.1″, and so on and so forth. So do you go with the symlinking approach, possible breaking future package installs that try to install ruby 1.8.x as a dependency, do you try to configure your way out of it and aliasing commands in bashrc, or do you go Googling as usual?

    Of course I go Googling, and this time I was actually in for a couple of surprises. First of all, Rails doesn’t even support Ruby 1.9.1, if you want 1.9, you have to go with the brand-new version, 1.9.2! The missing support for 1.9.1 surprised me, because I’d thought “they’d come around by now, what with 3.0 and all”. Anyone who’s tried Railing on 1.9.1 will know that you’d get into some serious trouble getting the gems up and running. Sooner or later you’d be staring at a compiler error taking all the fun and future hopes out of it all.

    Second of all, I came across RVM, or the Ruby Version Manager. This sweet, sweet tool will not only automate the retrieval, compilation, and installation of any Ruby version available from Matz, IronRuby, jRuby or whatever, it will also do it non-intrusively, by installing everything in your home dir and no go fudging with system binaries that other, older, and quirky applications may depend upon.

    And get this: That’s not all of it, you can also install any number of different revisions to suit all kinds of crazy apps and setups you may have that needs it. Sounds fussy? Fuck no, it’s a piece of cake :) There are lots of other cool things it can do that, some that I don’t even understand, but either way, just go read about it, then go install it, and set up your Ruby version(s)!

    A couple of tips to add to what you read there:

    • The documentation claims you need to install a 1.8.x branch before any of the other versions, but I found that doing “rvm –install 1.9.2” twice with a ctrl+c when it starts to download 1.8.x on the first attempt will install just the 1.9.2 branch in the second attempt without any issues (yet).
    • You probably want to set a Ruby version as the default after you’ve installed. I did “rvm –default ruby-1.9.2“.
    • Remember to follow the directions on packages you need to install, and note that git-core should probably be installed before you start doing anything. You don’t really need vim, either, unless that’s your preference. I use Aptana.

    Let’s go Railing 3.0-style on the 1.9.2 Ruby branch motherfuckers! Yeah! :D

    EDIT: When installing gems, note that linecache and ruby-debug-base should be installed from “linecache19″ and “ruby-debug-base19″ for 1.9.x rubies. If you have issues while building mongrel, try “gem install mongrel –pre”. Also, http://isitruby19.com is worth consulting when something fails to install ;)

Recent Posts

Tweets

Just Fun Shizzle

Links