Camping

Ruby on Rails is a great framework for the development of web applications. But there are some projects where you just don’t need all it’s power and features. However, you probably don’t like to through way some aspects. Fortunately, there’s an alternative.

Camping was developed by _why and it’s a microframework, in this case literally, since the code is meant not to overpass 4KB. It also uses Rails’ ActiveRecord, markaby and metaid. Its meant for small and simple projects, where you still don’t want to loose the MVC structure. To show you for what this framework is meant, where’s a short log from the #camping IRC channel:

20:11 <goalie> can camping do e-commerce?
20:11 <_why> no, use rails
20:11 <RangerCliff> heh wtf?
20:13 <goalie> it’s just a small store, we only have two products
20:13 <goalie> root beer lip balm and cream soda lip balm
20:13 _why contemplates
20:14 <goalie> mail-order only
20:14 <_why> now you’re talking!!

You are advised to keep you application code in just one file, although you can also use a simple directory structure and separate files for models, controllers and views. Now I’ll show some basic examples.

Models
module Blog::Models
  class Post < Base; belongs_to :user; end
  class Comment < Base; belongs_to :user; end
  class User < Base; end
end

Markaby in action
html do
  body do
    h1 'Hello World'
  end
end

Routes
class Posts < R '/posts/(\d+)'

And you can still require any helper from Rails, for example, and include it on your application module.

To learn more about Camping, check out _why’s blog, the documentation or this short introduction. The author goes by the nickname of _why (could find it’s real name anywhere)and it’s one of the most popular and respected ruby hackers. He also created Hackety Hack to enable easy web developing to amateurs and hobbyists, wrote a very peculiar book (although it’s still not finished) teaching Ruby – Why’s (Poignant) Guide To Ruby – and developed or helped developing a large number of ruby libraries and plugins.

Camping

I’ve played a bit with the framework and immediately got drown to it’s beauty (biased analysis). But, although it worked fined on the my computer. I could get it running on my Dreamhost account. The instructions demand that you add some code to the Apache scripts, which I don’t have access on a shared hosting account. I’ve tried following some fcgi scripts I found on my searches and I’ve already asked for help on the Camping mailing list to sort out the errors that occurred. As soon as I’ll get something up and running, I probably show it over here and maybe paste some beautiful code.

If you enjoyed this post, consider subscribing to my RSS Feed RSS feed icon

3 Comments

Yep, I once tried to install a camping app on dreamhost, the #camping channel was a great help, but I never came around to actually get it working (on dreamhost that is). Let me (and the rest of the internets) know if you find a solution! Camping is a piece of art IMO. ;)
Now I'm working on a project with rails, but I'm saving sometime to get back on camping. I'll try the channel the next time. But it's definitely a great framework to work with.
Has anybody gotten it working on Dreamhost yet?

Leave a Comment

Follow this post comments with this RSS feed.