Sunday, July 2, 2006

Comatose Update

There’s a new version of Comatose, the micro CMS plugin, out there.

I wanted to give you guys a quick heads up. This new version has a couple of breaking changes… After this release, if there are any data model changes, I’ll add a generator to the plugin that will create an ‘upgrade’ migration so you can update smoothly. But I’m hoping since it’s only been a few hours since the initial release, not too many people will have to revert anything!

If you’re not sure what Comatose is, you can read my last post on it for the background.

New Features

  • Hierarchal pages
  • Updated administration styles
  • Page previews
  • ERB pre-processing

Installation

$ ./script/plugin source http://mattmccray.com/svn/rails/plugins
$ ./script/plugin install comatose
$ ./script/generate comatose_migration
$ rake migrate

Add to the bottom of your config/routes.rb file:

map.comatose_root ''

That’s it—you’re good to go.

There’s a lot more info, and an FAQ example, in the README.

11 comments:

  1. Whereas the prior version worked nicely, the new migration is burping due to an MySQL error. It wants a key length to be specified when using a blog (text) column as an index:
    Mysql::Error: #42000BLOB/TEXT column 'full_path' used in key specification without a key length: CREATE INDEX comatose_pages_full_path_index ON comatose_pages (full_path)
    FYI: I'm defaulting to InnoDB

    ReplyDelete
  2. Ah, nice catch! Sheesh, talk about premature optimization.
    OK, I removed the index -- it's really not needed unless you have a lot pages... Which I doubt will be an issue.
    Would you mind giving it another try?
    Thx

    ReplyDelete
  3. I reinstalled from scratch and it worked great!
    It's a really nice piece of work and there's some great code in there. I know it's not easy to "put stuff out there," but I'm glad you took the time to do it. Thanks!
    One thing you might want to consider adding to the readme file (unless it's already there and I didn't see it): Rails novices might not know to remove/rename index.html from the public directory. Unless that is done, '/' will default to the Rails welcome static file.
    Once again, thanks. This is exactly what I needed. If I come up with any (lightweight) suggestions, I'll pass them on.
    Cheers
    - Scott

    ReplyDelete
  4. Thanks! I appreciate it.
    That's a good suggestion to remind people to remove the default index.html that ships with Rails... I'll put a note in the README.

    ReplyDelete
  5. Wonderful! Absolutely wonderful.
    Like you, I've noted that every project seems to require a few static pages. So it was in this week's plans to write very basic cms support for my current project. I'm so glad I've procrastinated so that you saved me the trouble!
    I'll use it right away, but just in case you want some user input for your todo list, here are my wishes:
    * keywords and description for metatags. I don't need anything fancy, like inheriting from parent pages, but it would be really nice to be able to have different keywords for different pages. I hear it helps Google ranking, and with my marketing budget, I need Google on my side.
    * A page comment. I intend to use comatose not only for full pages, but also for instructions on form pages. Although I could make use of the page title (setting it to "new-user-address-instruction"), it would be easier to read if I could write full sentences.
    And that's it. It's amazing that something as simple as comatose really fulfills all my needs. I realise that if I want to list a collection of articles with their first paragraphs, it's simple enough to dig out the paragraphs in a list, since text formatted with Textile will be well-formed. Or I could make each intro-text a child of its article and display c.children.first.content. So, great!

    ReplyDelete
  6. Looks really great - however I seem to have hit a snag after install. I can see that comatose is firing whenever I go to a page, but all is says is "Could not find the page located at test", and there is no way to edit the page.
    Is there some other URL I should go to in order to begin creating/editing pages?

    ReplyDelete
  7. You'll need to go to the Comatose admin... It doesn't really work like a Wiki, there's not an 'edit' link on the rendered pages. You could add one in a custom layout, if you wanted. But it's not built this way, by default.
    Assuming you still have the default :controller/:action/:id route, then the Comatose admin will be available at:
    http://127.0.0.1:3000/comatose
    At least, that's the URL if you are in local development.

    ReplyDelete
  8. Vrensk: Thanks! I'm glad you find it useful.
    As per your suggestions...
    1 - Keywords and Descriptions. Interesting suggestion, I'll add it to the 'idea list'. ;-)
    2 - Page Comments. Hmmm... I don't fully understand this one. Pages have a 'slug' field you can use (Click the 'more...' link next to the title to show it). The slug usually looks like 'title-trimmed-down' -- but you can manually override them and make them whatever you'd like. (The slugs are used in building the page paths)

    ReplyDelete
  9. M@: Re. Page Comments: The more I think about it, the less I see the need myself. It was clear in my mind last night, but not now.
    Anyway, thanks for a great plugin!

    ReplyDelete
  10. On PostgreSQL an error occurs when migrating the fist time.
    Creating the default 'Home Page'...
    rake aborted!
    PGError: ERROR: argument of WHERE must be type boolean, not type integer
    Changing comatose_page.rb's line
    acts_as_list :scope=>'parent_id'
    to
    acts_as_list :scope=> :parent_id
    Fixes the problem.

    ReplyDelete
  11. Lyle: Thanks! I posted this tip to give it more visibility.

    ReplyDelete