Sunday, September 24, 2006

Another Day, Another Update: 0.7.1

As most of you will know, Comatose has been having a few problems co-existing with some kinds of plugins lately. The problems seem to be caused, at least in part, because the comatose controllers extend ApplicationController and therefore require the application.rb before the rest of the plugins load.

Plus, some plugins seem to take issue with any previous plugins defining an Active Record model before they’re loaded—very picky stuff.

To combat this, I’ve added a DEFER_COMATOSE_LOAD flag (it’s an ENVironment variable).

When the plugin initializes it will check the flag, if it’s set to true it won’t load the controllers or the models. You’ll tell Comatose to load at the bottom of your environment.rb file, which will load the controllers and models after the rest of your app.

By default, the flag is set to false for backward compatibility.

Test It Out!

So if you’ve been having problems using Comatose with other plugins, or applications, please give this version a shot.

After you’ve re-installed the plugin, just open your config/enviroment.rb and at the top, next to where the RAILS_ENV is set, add this:

ENV['DEFER_COMATOSE_LOAD'] = 'true'

Then, at the bottom of your enviroment.rb add:

Comatose.load

That’s it! Now Comatose will be loaded after the rest of your application which should make it work with most plugins and applications.

Update: Sean recommended this much improved method of enabling “compatibility mode”. Thanks!

DevBlog Update

Oh, I’ve tweaked the devblog feed, so this should be the last time you get all those duplicates in NetNewsWire—Hopefully. It’s funny, I don’t have that problem in NewsFire.

Wednesday, September 20, 2006

Comatose 0.7 Released!

Comatose version 0.7 is ready to go! This release features:

  • Page versioning
  • Automatic loading of comatose extension scripts from RAILSROOT/lib/comatose/
  • And, of course, bug-fixes (previewing no longer modifies the page record — that was a big bug that slipped through the cracks)

Page Versions

Only content fields are versioned, namely: title, body, slug, and keywords. Which is to say that they’re the only ones, if changed, that will trigger the creation of a new version.

The versions view shows the current version on the left side, and the selected older version on the right. You can change which older version is shown, and mark the older one as the current version.

There’s also a new database table to support all this so… You guessed it: A new migration. But it’s still as easy as ever. If you’re upgrading from version 0.6.9, you can run:

$ ./script/plugin remove comatose
$ ./script/plugin install comatose
$ ./script/generate comatose_migration --upgrade --from=0.6
$ rake migrate

That’s it. If you’re upgrading from an even older version, no big deal - just make sure and specify the version in the from parameter ( --from=#.#).

Versioning is supported using Rick Olsen’s excellent actsasversioned library (included with Comatose).

Comatose Extension Scripts Folder

Comatose will now automatically load all *.rb files in the RAILS_ROOT/lib/comatose folder (if it exists). If you put your comatose-specific customizations, tags, and filters in that folder, then you won’t need to muck around in your environment.rb file anymore.