Archive for ruby on rails

Wii Sites

I am just trying out Pocket SharpMT: a pocket pc blogging application, that integrates directly with wordpress. This offers a more portable approach to blogging, and another way of justifying to myself that my pocket pc wasn’t a waste of money.

I haven’t had much spare time over the last few weeks to look into rails, so I have took the easy way out and used an open source php script for wiisites.com
just to try and get some early interest.

It occurred to me while deploying the topsites script to wiisites, that the difficulties in deploying a rails app would make rails far less suitable for the kind of open source web apps that are designed to be widely distributed, than a php app.

It would be interesing to hear other peoples opinions on how suitable rails is for developing open source applications and whether the deployment could be easily scripted so that a novice user could deploy a third party rails app.

Comments del.icio.us

Stuck at the station

With a bit of guidance from my Ruby on Rails book, I was ready to deploy my first Rails app wiisites.com and all within an hour; along way from complete, but I was happy with it for the first iteration. Allot of thought has obviously gone into the Rails framework, by making a less flexible than .Net and enforcing things like object relational mapping and the use of the Model View Controller pattern Rails is easy to learn and simple to use; that’s why I was horrified to find out how difficult Rails is to deploy.

In my eagerness to get my application deployed, I initially tried the XCopy approach dumping the application directories in my sub domain; of course this would have been too good to be true: a bit more investigation was called for.

Again wanting a quick solution I turned to google, it seemed the recommended best practice was to use a program called Capistrano to automate the deployment. I began to follow the manual I found http://manuals.rubyonrails.com/read/book/17. It seems that it is recommended to use the source control program Subversion along with Capistrano, so I began installing Subversion (use the one click installer). However Subversion requires apache, so I had to install Apache that too. After an evening spent messing around with unfamiliar configs I called it a day.

The following day with a fresh head it occurred to me that there must be a simpler solution, after all my app was little more that a hello world so surely an automated build was a bit overkill. I decided to connect to the server using my shell account and recreate the app on the server; when the app was created I ftp’d the app from my development machine across to the server. After a couple of daft mistakes with configurations I got my app working, its just my URL was now something like www.wiisites.com/wiisites/wiisites/public/, I’m sure you will agree not the most elegant url you have ever seen.

The next step was to sort out the messy url; this is done with some unix wizardry called a symlink which created a special kind of file that links to somewhere else.

I needed a file called wiisites that linked to the location of my rails app. I had created an addon domain using the bluehost control panel for wiisites.com, so I had a subdomain under my web route for wiisites; this caused me a problem because I needed to replace that subdomain with a symlink in order to redirect to the rails directory.

I stumbled across an article Getting Ruby Running on Bluehost which cleared things up for me. I renamed the directory “wiisites” that was created when I setup the addon domain and created a symlink with the name of “wiisites” in its place.

ln -s ~/www/wiisites_link/wiisites/public/ ~/www/wiisites/

The above symlink creates a symlink file called wiisites in the directory www pointing to my rails app directory /www/wiisites_link/wiisites/public/.

At last a working, semi complete web application and it only took 1hour 2days.

Comments del.icio.us

Right tool for the job.

A few years ago while at uni, I read the book The Pragmatic Programmer: From Journeyman to Master by Andrew Hunt and David Thomas; the books aim is to help you to become a better programmer, and it provides loads of tips and best practices covering everything from estimating, testing to design guidelines. One of the main characteristics the book suggests will make you a better programmer is your ability to work with a broad range of technologies; so in my case, although I work with .net on a day to day basis, the suggestion is I should be familiar with other languages and platforms.

This has always made sense to me, for example; if you were going to write a program to search a folder for a text file containing a certain phrase, then although this would be relatively straight forward using .Net, it would literally be just a few lines using Perl. The same has been true with web technologies, although it may be easy to develop a simple website using the feature rich .net framework, it may be overkill for a small personal website that just maintains a photo gallery: using php it would be easy to incorporate a free off the shelf photo gallery system like Gallery 2 that is already fairly mature and tested for bugs.

I have used php on a few personal sites and think that it has benefited my html and css skills, but even with template engines like Smarty that separate the presentation layer, php to me has always felt a bit of a step backwards, when compared to asp.net.

I have just started a personal site wiisites that as the name suggests will simply maintain a directory of Nintendo wii web sites. I don’t really want to spend too much on hosting, so have opted to add the domain to my bluehost account and develop the site on the Linux platform; which would have usually meant Perl, or Php, but now there is a new contender for the open source title, Ruby on Rails.

Ruby is a fully object orientated language and Rails is a framework designed to greatly simplify web development based on the Model View Controller pattern. After following OnLamp tutorial which guides you through the easiest way to install and develop your first project, I can say that Ruby on Rails seems like a massive leap forward for open source web development; it appeals to me because its;

  • Object orientated, so should be easy enough to learn.
  • Follows the familiar Model View Controller pattern.
  • Greatly simplifies alot of the plumbing, like data access.
  • Ajax built in.
  • Embraces Agile development with unit testing built into the framework.
  • Is quick to use.
  • Cheap to host.

I have just bought a book on Rails and am looking forward to learning more about it, hopefully there will be lessons learned in Rails that could be applied to future .Net projects.
The Pragmatic Programmer: From Journeyman to Master Agile Web Development with Rails : A Pragmatic Guide (The Facets of Ruby Series)

Comments del.icio.us