GoRuCo talk: Going Camping

Presented by Jeremy McAnally

History of the tent…

  • Native Americans
  • Hippie fests
  • Crazy diagrams

What is Camping?

  • MVC architecture
  • ActiveRecord for models
  • Markaby for the views
  • Everything goes in one file
  • File has modules for each MVC component
  • Run camping

When should you use Camping instead of Rails?

  • When Rails is too fat
  • Right tool for the right job
  • You ain’t gonna need it

Controllers in Camping

  • Classes define actions instead of methods in Rails
  • Methods within those classes handle HTTP method types (GET, POST, etc.)
  • Routes baked into action definitions

Camping Views

  • Markaby is “Markup in Ruby”
  • No more ERb!
  • Methods define tags
  • Will complain about invalid HTML
  • Blocks build tag heirarchy
  • Attributes as a hash

Models in Camping

  • Simply ActiveRecord models
  • Defaults to SQLite
  • You can also use migrations
    • No down migrations, but you can script that
  • Can use acts_as_versioned and other AR-specific plugins

Deployment

  • Much easier than in Rails
  • Don’t use Camping server (just like we don’t use Webrick)
  • Can be deployed in a variety of environments
    • Mongrel!

What if my application gets big?

  • Possible to split a Camping app into multiple files (use require)
  • At that point, you should probably use Rails

Databases

  • Camping defaults to SQLite
  • But supports other RDBMS options

Sessions

  • Camping has support
  • Include a module, it acts like Rails

Testing

  • Use Mosquito for bug-free Camping
  • Not in the default package, but still available

Form helpers

  • Gregory Brown wrote a snippet to get form helper support in Camping
  • Can use form_for syntax

Serving static files

  • Does not work like Rails
  • Static files can be embedded in a Camping application
  • They can be read from disk using File.read (better)
  • Have the web server do it (best)

Before/after filters

  • Override the service method and put logic before and after it
  • Not as flexible as Rails’ filter DSL

Decamper

  • Converts Camping application to Rails applications
  • Status is unknown

Kindling

  • Library I started to pull top 5-10 “Railsisims” in Camping
    • before/after filters
    • file upload
    • etc.

Q & A

  • Q: Is it possible to use something other than Markaby with Camping like XMLBuilder? (from Jay Phillips)
  • A: Yes. Extend my ERb templating code to use Builder or something else. The code is simple.
  • Q: Can you exaplain the syntax for inheriting a class from R?
  • A: Uses regular expression to do routing. You have to use your own.

0 Responses to “GoRuCo talk: Going Camping”