Merb rake tasks

Thursday 11/27/2008  –  Category: Merb

When trying to run a merb rake task I wrote, I ran across this error:
rake aborted!
Don’t know how to build task ‘environment’
It turns out that merb uses a different environment variable than Rails,  so instead of :environment use :merb_env instead:
task :whatever => :merb_env do



merb and Twitter made easy with Twitter4R

Wednesday 11/26/2008  –  Category: Merb

Updating twitter with merb is super easy with Twitter4R:
sudo gem install twitter4r
in config/dependencies.rb:
gem “twitter4r”
require ‘twitter’
(just doing dependency “twitter4r” didn’t work)
in your controller:
client = Twitter::Client.new(:login => ‘username’, :password => ‘password’)
status = client.status(:post, “hello world”)



Strange errors when upgrading merb

Wednesday 11/26/2008  –  Category: Merb

I had some strange errors when upgrading to the latest version of merb (1.1.3).  When trying to run
rake db:automigrate
I would get something like:
~ Connecting to database…
/opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/adapters/data_objects_adapter.rb:137:in `initialize’: wrong number of arguments (8 for 1) (ArgumentError)
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/adapters/data_objects_adapter.rb:137:in `new’
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/adapters/data_objects_adapter.rb:137:in `normalize_uri’
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/adapters/abstract_adapter.rb:44:in `initialize’
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core/adapters/data_objects_adapter.rb:159:in `initialize’
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core.rb:157:in `new’
from /opt/local/lib/ruby/gems/1.8/gems/dm-core-0.9.6/lib/dm-core.rb:157:in `setup’
from /opt/local/lib/ruby/gems/1.8/gems/merb_datamapper-1.0/lib/merb/orms/data_mapper/connection.rb:44:in `setup_connections’
from /opt/local/lib/ruby/gems/1.8/gems/merb_datamapper-1.0/lib/merb/orms/data_mapper/connection.rb:27:in `connect’
from /opt/local/lib/ruby/gems/1.8/gems/merb_datamapper-1.0/lib/merb_datamapper.rb:17:in `run’
from /opt/local/lib/ruby/gems/1.8/gems/merb-core-1.0/lib/merb-core/bootloader.rb:99:in `run’
from [...]



Using Monit to…monitor stuff

Tuesday 11/25/2008  –  Category: Uncategorized

Monit is a useful tool that lets you monitor your server and run commands based on certain variables (ex: restart your mongrel instances if they grow > x MB).  Plus, it comes with a nice web interface to quickly see your load averages and memory usage (easier than logging in and running top).



I’ve liked using Phusion Passenger as a stupid-easy deployment solution for Rails (and now merb) apps, but running three Rails apps and one Merb app on a Slicehost 256slice, things got kind of crowded.  I had to set the PassengerMaxPoolSize variable to 2 in order to keep my free memory at an acceptable level, and [...]



 Page 2 of 4 « 1  2  3  4 »