Close and Go BackBack to Viget

Sandstone: A Drop-In CMS for Existing Rails Applications

Ben Scofield
Ben Scofield, Development Director, January 15, 2008 15

Over the past few months, I’ve been talking here and there about a project I’ve been working on - Sandstone. The general idea is that, while Rails makes it easy to build an application quickly, it’s unreasonably difficult to integrate two distinct Rails projects - but if you have an e-commerce site, you may have a need for static content that doesn’t justify the effort of running an entirely distinct Rails application like Radiant CMS. Sandstone meets this need by providing a drop-in, customizable CMS as a plugin, ready to be installed on any given Rails application.

sandstone formation

There are a couple of really interesting things about this project. The first is that it’s an instance of what we at Viget are calling “resourceful plugins” - that is, plugins that provide a complete set of resources and functionality around them in a specific domain. These plugins are intended to be easy to integrate into any existing Rails application, and to allow for extensive modification and customization without losing the ability to upgrade the core plugin code.

That last bit is especially important, since that’s where a lot of alternatives fall down - sure, there are plugins out there that add CMS functionality, but once you invest the time in customizing them to your particular project you’re wed to the particular version you installed. If a new version comes out with some compelling features, you have to do a lot of work to upgrade. With a resourceful plugin, upgrades are relatively painless. When you install Sandstone, for instance, it copies a series of controllers, models, and views into your app folder so you can tweak them to your heart’s desire. The bulk of the core functionality, however, resides in modules defined in the plugin (which are included in the copied files). To upgrade, then, you just update the plugin and leave the copied files alone. The only problems you’ll run into are ones where the new version of the plugin adds some significant new functionality (with new controllers, models, and views), but we have a strategy for dealing with that easily, too.

The other aspect of the Sandstone project (and our other resourceful plugins) that excites me is the fact that we’re open sourcing it. If you’re interested, you can grab the current version of Sandstone (so new it doesn’t even have a version number!) from http://svn.extendviget.com/lab/sandstone/trunk. If you’d like to contribute, we have Trac set up, so you can open bugs and feature requests and otherwise participate in the process. We’re hoping that Sandstone can help meet the needs of a lot of developers, so we welcome your feedback.

Update: Changed Trac URL to reflect the project’s new location

image taken by Ozyman; from http://www.flickr.com/photos/ozyman/211749949/

TJ Stankus said on 01/22 at 10:59 AM

“The only problems you’ll run into are ones where the new version of the plugin adds some significant new functionality (with new controllers, models, and views), but we have a strategy for dealing with that easily, too.”

Interested to hear more details about this strategy. Checking out the source now. Thanks.
-----

Ben Scofield - Senior Developer said on 01/22 at 01:42 PM

Unfortunately, the source won’t help you there, TJ - we’re still working on the implementation, and it’s not in trunk yet.

The general idea is to add custom rake tasks for upgrades with new functionality. Instead of rerunning the complete sandstone installation, then, you’d basically be running only part of it.

This approach should be fine for the most drastic updates, but change that encompass existing features will still be a little trickier.

Harm said on 02/21 at 07:23 AM

Why did you choose to build your own system to share vertical chuncks of functionality? Why not use Rails Engines?

I am currently exploring similar options and I am curious.

Ben Scofield - Senior Developer said on 02/21 at 02:55 PM

Basically, we wanted to work within the plugin framework to produce something that’s a little more forward-compatible - engines are somewhat notorious for breaking with new releases of Rails.

In fact, we didn’t build a system so much as explore an approach for integrating functionality… I think the difference is important.

Harm said on 02/25 at 10:12 AM

Now I finished going through the code I see what you mean. It’s indeed an approach not a system.
And thanks for that little nugget of info on Engines, didn’t know that.

Andrew Selder said on 03/21 at 05:08 AM

I love the idea of this project. It solves so many of the needs that we run into on a daily basis.
I’d love to contribute to the development of this. By any chance will this project be part of the Community Project Code-Drive out at RailsConf? Please let me know what I can do to help out?

Thanks.

(BTW, the trac for this project isn’t working)

Patrick Reagan said on 03/23 at 05:17 AM

@Andrew: I noticed the same thing about the Trac site, Mark fixed it last night.  Let us know if you continue to have problems.

Ben said on 03/24 at 04:37 AM

@Andrew - I hadn’t planned to submit it to the Code-Drive, but that’s a great idea. As for helping out - just try using it, and let us know what your pain points are. We’re happy to accept positive and negative feedback, comments, suggestions, and especially patches!

Thanks!

Andrew Selder said on 03/27 at 06:39 AM

The plugin URL is invalid. Digging around on the site, it looks like it should be:
http://trac.extendviget.com/lab/browser/sandstone/trunk

Patrick Reagan said on 03/27 at 06:58 AM

@Andrew: Thanks, I updated the URL in the post to reflect that change.

Beau said on 04/02 at 06:53 PM

Is this still under development?  It looks like a good solution to a problem I run into often.

Ben said on 04/03 at 04:38 AM

@Beau: Sandstone is still under development, but we’ve been busy so it hasn’t been as active as I’d like. We’re happy to accept suggestions (and even moreso, patches!) if you find it doesn’t quite meet your needs, though.

Nate said on 05/01 at 01:18 PM

Also very interested in this project.  I am currently developing an application which could use something like this.  I like what Radiant offers, but am looking for more of a pluggable approach.  I like what I am hearing.

Alex Le said on 06/07 at 05:00 PM

I ran into this error while running the migration: 

== 21 CreatePages: migrating ==================================================
-- create_table(:pages)
-> 0.0620s
-- add_index(:pages, :path, {:unique=>true})
-> 0.1560s
-- add_index(:pages, :parent_id)
-> 0.1410s
-- add_index(:pages, :editor_id)
-> 0.1560s
-- add_index(:pages, :status)
-> 0.2500s
rake aborted!
Expected D:/Work/Prototypes/TubeCaption/trunk/vendor/plugins/sandstone/lib/sands
tone/models/page.rb to define Sandstone::Models::Page
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependenci
es.rb:249:in `load_missing_constant’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependenci
es.rb:453:in `const_missing’

Any idea?

Ben Scofield said on 06/08 at 08:49 PM

@Alex: Hmm. Do you have both required plugins installed (acts_as_versioned and acts_as_tree)? That would be my first guess for that particular error. If that’s not it, I’ll dig in further.

Oh, and which version are you using - the one from SVN (mentioned in this post) or from GitHub?

Trackback URL: Trackbacks are disabled for this entry

Comments for this entry were closed after 60 days.

A Development Community for Viget Labs and Beyond

Every team member here at Viget Labs strives to be an innovator. We members of the development team are no different - that's why we're constantly engaging in community discussions and exploring the unknown that is the next generation of open-source web applications.

Viget Is Hiring!

Viget has job openings for Ruby Developers, Interns, and Front-End Developers. Learn More »

Recent Comments

Hi,that,s very nice to see and i got a lot of knowledge from this blog which help me in my future because i am new to this kind of stuff.thanks