Rubygems swapping out slice fix.

June, 21 2008 10:14 PM by Lancelot
Rubygems 1.1.1 has a memory problem and will attempt to download more than it should when trying to install gems. In order to fix this problem, you have to upgrade rubygems to the latest version (1.2.0) which includes patches that now only pulls the necessary gemspecs from rubyforge. Here is how you upgrade:

wget http://rubyforge.org/frs/download.php/38645/rubygems-update-1.2.0.gem

gem install rubygems-update-1.2.0.gem --local
update_rubygems

Hope this helps someone!

Ruby on Rails and Nginx on a Gentoo Slice presumably at Slicehost

June, 21 2008 09:23 PM by Lancelot
This is a script I found online that I wanted to keep that and the page was removed for some reason. I hope I can preserve it. Let me know how I can improve it!

# login as root before running this script
# edit the username to reflect your preferences.
# save the script to a file and run it like:
# > /bin/bash this_script &
# remember the ampersand on the end and it'll run until it's done even if you disconnect

username='whatever_you_like_to_login_with'

# this bit will require some user interaction
useradd -m $username
passwd $username

# from here on we're rollin'
echo 'ACCEPT_KEYWORDS=~amd64' >> /etc/make.conf
echo 'USE="gif imagemagick innodb jbig jpeg jpeg2k pdf perl png mysql python ruby sqlite3 ssl svg truetype unicode xml xpm pcre -php -wmf -tiff -lcms -postgres"' >> /etc/make.conf
emerge --sync
emerge sudo
echo "$username ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
emerge -C ssmtp
emerge vim ruby rubygems nginx subversion dev-db/mysql postfix vixie-cron
gem install --include-dependencies --no-ri --no-rdoc rails mongrel mongrel_cluster tzinfo BlueCloth RedCloth mysql sqlite3-ruby rspec zentest capistrano nginx_config_generator
gem install --include-dependencies --no-ri --no-rdoc activeresource --source http://gems.rubyonrails.org
emerge --config =dev-db/mysql-5.0.44-r1
rc-config add mysql default
/etc/init.d/mysql start
rc-config add nginx default
/etc/init.d/nginx start
rc-config add postfix default
/etc/init.d/postfix start

Boot Camp

April, 04 2008 08:22 PM by Lancelot
I just installed Windows on my macbook pro because VMFusion seemed to have issues with running a computer game I was hoping to run called Hellgate London. It went surprisingly well (although I'm installing the game as we speak and I'm unsure how successful it will be.. I will keep you posted) but I just noticed this blog looks awful in Internet Explorer (bleh) so I'm going to work improving this layout soon! Sorry to all of you IE users out there.. please use firefox instead!

The mate command was not found?

March, 31 2008 11:02 AM by Lancelot
Today I got my new macbook pro and have been migrating everything with very little problems. I did however get a little confused when I tried typing mate . in a directory and had expected textmate to open it up as a project. Instead, I got the following:

-bash: mate: command not found

WIth a little googling I found the solution:

ln -s /Applications/TextMate.app/Contents/Resources/mate ~/bin/mate

Hopefully this gets googled so people will find the solution faster! :)
3 Comment(s)

Big Changes coming in rails 2.1

March, 31 2008 10:51 AM by Lancelot
It's not too often these days that you hear BIG announcements for rails. I was excited to hear however that the latest version of rails is getting some cool new features and is getting some press. Courtenay posted an informative blog post detailing the changes:

http://blog.caboo.se/articles/2008/3/30/exciting-times-in-rails-land
0 Comment(s)

Using Subversion with Nginx

March, 27 2008 02:31 PM by Lancelot
I've been wanting to solve this problem for awhile now, and it seems like solving this problem is a simple thing, but will require some good old open source programming. At the moment the only solution I can find for getting subversion to work with nginx is to proxy subversion requests through nginx to apache (or use apache directly if that is the sole purpose of your machine). The solution is well documented even posted up on the trac wiki (http://trac.edgewall.org/wiki/TracNginxRecipe) but wouldn't it be nice to be able to use nginx directly? I found a post on the ruby forums regarding this and it looks like someone might be working on it sometime soon (http://www.ruby-forum.com/topic/140841). Is anyone working on this and if so where can I get some more information?
0 Comment(s)

Rubygems requiring issue?

March, 27 2008 02:23 PM by Lancelot
I filed a ticket awhile ago to the rubygems project regarding what I consider a bug to the way it lets you require files. Here is what my ticket said:

======

When two different projects have a file with the same name inside of it, and you try to use require, you can get some
funky results. I'm not sure there is a solution for this, but it can get pretty frustrating when you realize it's requiring
the wrong file. Example:

I have two gems, anvil and rails. Anvil defines an initializer.rb inside of lib. Rails defines an initializer.rb inside
of lib. Now if I run require 'initializer', it picks anvil first because it is higher in the alphabet. The same I believe
applies to the gem command, but I haven't thoroughly tested that. Here were the results of my irb prompt prior
to uninstalling anvil (now I'm going to have to refactor anvil not to have an initializer.rb):

Macintosh-5:rails-2.0.2 lance$ irb
>> require 'rubygems'
=> false
>> require 'initializer'
=> true
>> Rails
NameError: uninitialized constant Rails
from (irb):3

After uninstalling anvil:

Macintosh-5:lancelot lance$ irb
>> require 'rubygems'
=> false
>> require 'initializer'
=> true
>> Rails

Thoughts?

======

Today I got a response saying that this was not a rubygems bug and that Anvil and Rails should duke it out? IMO, this not the expected behavior I had for requiring files, am I the only one in the same boat? I know I haven't submitted a patch for this, but at least keep this ticket open so I can file a patch eventually or maybe comment on the ticket encouraging me or someone else to write a patch for this!

Anyone else think this should be fixed?

Here is the ticket:

http://rubyforge.org/tracker/?func=detail&atid=575&aid=18890&group_id=126
0 Comment(s)

Nginx proxy header for rails and SSL

March, 24 2008 10:30 AM by Lancelot
Something that comes up at work often is the fact that nginx is missing a configuration in the location block of the SSL server block. The problem is that rails needs https headers to be sent directly to it in order to recognize it's an ssl request. Here is the configuration you need:

location / {
proxy_set_header X_FORWARDED_PROTO https;
}

This is more of a note to self than anything. If someone could provide more detail on this issue, that would be great! :)
1 Comment(s)

New Blog!

March, 23 2008 11:01 PM by Lancelot
Finally, after having some free time this weekend, I was able to deploy my new blog that I created from scratch on my Engine Yard slice. The layout is still a little sketchy and simple, but I will be working on improving it over time. Stay tuned for updates as I attempt to post something useful.
0 Comment(s)

About Lancelot Carlson and this blog

I created this blog from scratch using rails at a lightning quick pace. I figure, why not walk the walk and use my blog as a testing bed for all those ruby/rails ideologies I evangelize. Here you will find not only a digest of my learnings and brain dumps about topics ranging from Ruby to Nginx to Search Engine Optimization, but also a laboratory. This is a place where the mad programmer in me can test my crazy ideas and code in the wild and hopefully get enough interest to warrant some feedback.

Feel free to check out my working with rails profile for more information on me here.