Rails Challenge: Day 1

You can read about the Rails Challenge here.

10AM – After various Monday tasks and email, started on the challenge. Aquick search for Ruby on Rails leads me to http://rubyonrails.org/. Theyadvise using Ruby 1.9.2 or 1.8.7, but the link to download leads to 1.8.7. I know we were asked to use “latest versions” so going to go for 1.9.2. Off to http://www.ruby-lang.org/en/downloads/ where I find 1.9.2. A quickdownload then squiz at the README. From the directory you extracted Ruby in:* ./configure* make* make test* sudo make installVoila! Ruby 1.9.2 installed and ready to go.

10.25AM – OK, play with the language – run through the quick start.http://www.ruby-lang.org/en/documentation/quickstart/* Got to be happy – fire up the shell, type irb and there it is (somethingmust of worked!).* First page done, nothing unusual or unexpected there.* Second page… some interesting syntactical things with Ruby. Like the wayit does string substitution, very clean and clear.

def h(name = "World")        puts "Hello #{name.capitalize}!"    end
  • Like the ? syntax to interpret if something is a boolean or not. Seemsvery well thought out as a language.
  • On balance slightly more in that Quick Start 20 minutes example than canbe explored in 20 minutes (I don’t think I can type that fast) but a goodintro.

11:00AM – Back to the Rails stuff. Rails tells me to get RubyGems. Followedthe links, downloaded, tried to install. Tells me it’s an upgrade… Littlebit of research. Turns out that RubyGems 1.3.7 ships with the latest Rubyalready. Type gem at console and sure enough, there it is.

11.10AM – sudo gem install rails

11.24AM – While that install ran, I researched IDE’s by asking around onTwitter plus a bit of searching. Deciding between a full IDE and perhaps astandard editor with a bit syntactical sugar, I’ve decided to go for thefull IDE. Mostly because I need all the hints I can get given that it’s allnew. So the suggestions I had back (ignoring the expected ribbing about notwanting to use VIM):

  • Komodo 6
  • NetBeans
  • RubyMine
  • BlueFish
  • Geany
  • Aptana Rad Rails

In the end I’ve decided to go for RubyMine. Keeping in mind this was NOT anextensive eval, main decision factors – obvious GIT integration (others mayhave it but this clearly lists it) and Twitter use it (I know they are a bigrails shop). Downside to RubyMine – $70, but there is a 30 day free trial –I figure I may as well get started with a good strong editor, then bearingin mind this is only a 2 week experiment anyway, it will either be worth theupgrade, or I won’t need it any more (or I’ll know enough to make aneducated choice on a different editor).

11.35AM – Right, that’s the IDE downloading and the rails install out theway. Let’s create a Rails Framework now.

1PM – Bit of a break there, Alex came back online, catch up after weekendand re-synch with activities for today then feed kids lunch.So creating the rails framework was easy.

  • rails new source/railstest

Now in theory, I should be able to start rails by running this from that newdirectory:

  • rails server

No dice – crashed…

1.48PM – Well that slowed us down! Long story short, latest Ruby / Railsrelies on the latest version of SQLite3, not installed on my PC. I had thefollowing error:

Could not find gem 'sqlite3-ruby (>= 0, runtime)' in any of the gemsources listed in your Gemfile. Try running `bundle install`.

After trying lots of different things (including running bundle install) Iresolved by downloading the latest SQLite3 from herehttp://www.sqlite.org/download.html, ran ./configure, make and make install,then tried bundle install again from the railstest directory (the app I’msetting up).

Finally, success.

1.50PM – Rails app up and running!

Booyah!

3.25PM – Coffee break and then managed to get RubyMine set up. Needs theSun JDE (doesn’t like Open Java) :–( Register with Oracle, 72Mb downloadlater… Wait, make that 2 installs later (downloaded the RPM first, no goodfor Ubuntu). Finally once I had the path setup properly I could install /run RubyMine.

  • export JDK_HOME=“/usr/lib/jvm/java-6-sun/”
  • .//bin/rubymine.sh

Took almost 1hr and a half for this step :–( Still hopefully pays off havingan IDE. Took a bit of time here to explore the basic IDE and play with therailstest app I setup earlier and see where all the bits went. I will saythis – there’s a heck of a lot more guff installed with a Rails app thanDjango!

3.40PM – Minor distraction – hunt down some online shopping for Master 8’sChristmas present.

4PM -OK, meat of the day. Try and find a Twitter library and install it.Mat Kelcey recommended https://github.com/jnunemaker/twitter/ which looksgood, but we want some streaming support.

4.20PM – Wow, lots of searching and flicking through Twitter Ruby GEMs, thecoverage here is a lot worse than Python. Really surprises me! I thoughtRuby would have some strong libaries. The library recommended by Mat isbest, but no streaming support. The few streaming libraries don’t includeOAuth support and are generally weak.

4.30PM – Looks like we might need to use EventMachinehttps://github.com/eventmachine/eventmachine/wiki. Thin also looksinteresting – a Python Tornado equivalent? http://code.macournoyer.com/thin/

6PM – Reading, reading reading. Going to call it quits here – lots to thinkabout on how to implement a streaming Twitter app with OAuth support – lotsof bits and pieces but no one GEM I can pull that does it all. Seriouslythinking about cutting my own to do all the pieces together.

About these ads

One thought on “Rails Challenge: Day 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s