Archive for the ‘Ruby on Rails’ Category

Installing GitLabHQ on Debian

Posted on the January 30th, 2012 under Linux,Ruby on Rails,Tutorials by

Just a few notes from getting GitLabHQ up and running on Debian.

Used the following as a reference, however that is geared toward Ubuntu (and most of it applies) https://github.com/gitlabhq/gitlabhq_install Depending upon your situation you may want to skip some of those steps such as installing ruby (I’m using RVM) and using apache…

If you have not done so already, su to root and add apt-get install sudo.

The documentation on that link is assuming you using ubuntu which uses the admin group for sudo access, and by default on debian it the sudo group. You can either edit the /etc/sudoers and add the admin group or just change the first step to the following:

sudo useradd -s /bin/bash -m -G sudo gitlabhq
sudo passwd gitlabhq
Follow the rest of the instructions (ignoring ruby if you have RVM installed)…

There is one little typo where the guide tells you to edit the gitlab.yml file under “Configure GitLabHQ” The correct path is:

~gitlabhq/config/gitlab.yml

In my case I wanted to use MySQL instead of SQLite, so I went ahead and edited the database.yml file to mysql… Added the mysql2 gem to the Gemfile then ran the following commands:

bundle install –without development test
bundle exec rake db:setup RAILS_ENV=production
bundle exec rake db:seed_fu RAILS_ENV=production

On my Dev server I’m running apache with passenger, so I added a new site pointing to the public directory of the gitlabhq user that was created during the process and fired up the url. Everything seems to be working fine, I’ll update this page as I get to play around a bit. So far it seems solid, comitted my first project and update.

My main reason for installing this was to avoid the costs of using one of the git hosting sites. I couldn’t see paying for it when I’d like to create a whole bunch of repositories for testing and side projects, cost wise it just didn’t make sense.

Ruby on Rails Best Coding Practices Slide Show and Gem

Posted on the November 17th, 2009 under Ruby on Rails by

When browsing around today I saw quite a few sites talking about the Rails Best Practices presentation / talk that ihower did at the Kungfu RailsConf. Check it below, it really covers a lot of basic tips on how to clean up your code and follow some better coding practices.

Someone just released a gem that will analyze your code and check for “Best Practices” –  seems promising. Check it out at GitHub here: http://github.com/flyerhzm/rails_best_practices

Quick Ruby On Rails Tip for Nested Resources

Posted on the November 1st, 2008 under My Projects,Remodeling,Ruby on Rails by

Just a quick tip for when you are doing nested resources….

In this example, I am building a app for a client where there is a recipient and they have many physicians. So I have a case where I have a nested resource. To keep thing DRY, I added this to my before filter where I get the recipient. This allows you to nuke the find in the show, edit, update and delete actions and retain the original use of @physician.

def get_recipient
  @recipient = Recipient.find(params[:recipient_id])
  # DRYs her up a little so you don't have a find in the show,edit,update and delete actions	
  @physician = @recipient.physicians.find(params[:id]) if params[:id]
end

Don’t forget to modify your index find, change it to reflect the nested route… In my case:

    @physicians = @recipient.physicians.find(:all)

Have any other useful tips? Let me know!