Posted by Aaric Pittman
Fri, 09 Apr 2010 04:45:00 GMT
Ok, so specifying my custom gem path in the top of the config.ru file did not completely solve my problem. I was getting intermittent application errors saying that it could not load sinatra. I was pretty sure it had something to do with my gem path and rack ignoring the line I added to specify the custom path. So, I did some more searching and came across the following solution with seems to have fixed my problem.
if (ENV['HOME'] =~ /^\/home\//) ## DREAMHOST
ENV['GEM_HOME'] = "#{ENV['HOME']}/.gems"
ENV['GEM_PATH'] = "#{ENV['HOME']}/.gems:/usr/lib/ruby/gems/1.8"
require 'rubygems'
Gem.clear_paths
else
require 'rubygems'
end
Tags dreamhost, ruby, sinatra | no comments
Posted by Aaric Pittman
Tue, 22 Dec 2009 11:51:00 GMT
Up until a week or so ago my website was just static html and one PHP page for the contact us. Since I have started learning Ruby and Rails, I’ve wanted to switch my site to something Ruby based but I felt that Rails was a bit of an overkill for something so small and simple. So, last week I decided to look into Sinatra, as I had heard that it was very light weight web framework. And I have to say that I really like it. It is simple to setup (see below) and light weight (it only took 2 files to get it up and running on my host).
The weight of Rails is one thing that I have been struggling with as I have been trying to figure out a way to start working Ruby and Rails into my day job MindReactor. A lot of the sites we do usually fall into being primarily static content with 1 or 2 forms or the amount of content and required features necessitates a CMS. For now when it falls into the realm of needing a CMS we are using ExpressionEngine, due to the fact that one of my co-workers has lots of experience with it and I already know PHP, so it makes a smart business decision. However, on the other end of the spectrum, I again felt like that Rails was just way more than I needed and would resort to using PHP or .NET to build it out. Though, now I think that Sinatra would be a prefect fit for that senario and am planning on trying to work that in.
For the most part I followed the steps in the Deploying Sinatra on Dreamhost With Passenger post over on the RailsTips blog, with the following exception. I did not Vendor Sinatra. Instead I opted for installing a local copy of the Sinatra gem and had to add the following line to my config.ru file.
ENV['GEM_PATH'] = '/home/USER/.gems:/usr/lib/ruby/gems/1.8'
Tags dreamhost, ruby, sinatra | no comments