February 2009 Archives

Redirect, a simple Ruby redirect DSL build on Rack

Posted by petrik on Feb 19, 2009

Just released another small gem called Redirect for doing quick redirects.

Example

Create a file and pass an array to the redirect method:

  require 'redirect'
  redirect  ['/catch_url', '/redirect_url'],
            ['/catch_url2', '/redirect_url2',
             {:code => 307, :name => 'redirect link'}],
            ['^/some_regexp', '/all']

The catch_url can be a regular expression. You can overwrite the default 301 http code in the options.

The default redirect code can be changed:

  Redirect.default_code = 307

A sitemap.xml is generated for all redirects that have a name.

"no <group_id> configured for ..." error when releasing a Gem to Rubyforge

Posted by petrik on Feb 19, 2009

If you get the "no <group_id> configured for <PROJECTNAME>" error, you probably need to do the following:

rubyforge setup # unless you already did this before
rubyforge config PROJECTNAME

Bukka White - Old Lady Blues

Posted by petrik on Feb 13, 2009

admin