Prototype for adding cms functionality to a rails app. The cms content, however, is saved to git instead of to a db.
Ruby JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
config
db
doc
log
public
script
test
tmp
vendor/plugins
.gitignore
README
Rakefile

README

acts_as_cms is a prototype for exploring the following question:

1. Why do all content management systems (cms) save their content in a database?  Why not save the content in source control?

I reiterate, this code is only a prototype.  It is not, nor ever will be production code.

Read on for more information about this project and the question above.


== Saving cms content in source control (i.e. git) ==

Ask yourself the following question: In a web project, who are the content creators?  In other words, who is
responsible for creating the different pages on a website?

Three different groups of content creators come to mind:
1. Software developers (e.g. mycoolpage.html.erb)
2. CMS Authors (e.g. contact.html designed by the marketing department and created in the cms)
3. Users (e.g. my cool blog entry)


Where is their created content saved?

Software developers -> source control (e.g. git)
CMS Authors -> cms database (e.g. day cq)
Users -> application database (e.g. mysql)


Why?

O.k., user data being saved in a database makes sense.  That I don't want to dispute.  That developers save their
css, javascript, rb, etc. files in the source control also makes complete sense.  Consider the chaos we would have
if each developer had their own oracle database on their machine and they saved their work as blobs in the database.
In order to get another developers work, you'd have to export their database and import it into yours.  Merging,
for example, would be absolute hell.

...

Wait a second.  If saving developer's work in a database is such a bad idea, why do we do just that for author's work?

Is an author more like a developer or more like a user?


I would argue that an author is more like a developer:

1. Given a website, xyz.com, can a visitor to that website tell whether the content comes from an author or a
developer? No.  It is possible to tell user generated content apart though.

2. Ideally, when the website is made live, the content from authors and developers is set. The users content is the
only thing that changes.


"Yeah, but what about a newspaper's website" you say.  They have authors (i.e. journalists who write articles) and
users (i.e. visitors to the site that comment on the articles).  The content from the journalists and from the users
changes daily.  The content provided by the software developer changes at a much slower pace (monthly at the most).
Would we want to redeploy the website for every article the journalist writes?  No.  Don't we want to be able to
search for old articles? Yes.

Ok. Ok.  I admit, there are cases when a traditional cms backed by a traditional database is the best solution.
However, by the same token, I argue that their are other cases in which a traditional cms with a database is not the
best solution.


Take the following case.  We have a small website which consists mainly of a few applications (e.g. dynamic content).
There are a few exceptions though.  There is an 'about', 'contact' and a few other pages (e.g. static content).
Typically, the few static pages wouldn't warrant the use of a full blown cms.  The developers would simply program
those pages too. Whenever the website owner's address changes, he'd call up the developer and ask him to update it.
The developer would make the change and redeploy the site.  The website owner is constantly on the move, so his address
needs to be updated quite often.  Eventually the developer implements a micro cms for the website.  The owner can
now change his own address and all of the other static pages.  The pages are saved in the application's database.

Let's take a look at this scenario closer...

What if there are two developers working on the project?  Don't they see two different versions of the static content,
even if their code is both up to date?

What happens when a new developer joins the team?  He won't have any static content.  What will the site look like for
him?

What happens when a developer clicks on the link to a static page that doesn't exist in his local database?

Shouldn't the website look the same for the developers as it does for the users?


Ok. Lets wrap things up here.  I think there are certain scenarios where a website just barely needs a cms, but the
content from that cms is more closely related to source code than user generated content.  For said scenarios, saving
the author's content in source control might make more sense than saving it in a database.


== Next steps ==

1. Use the prototype to answer the following questions:

* In which projects, if any, does such system (author content in soure control) make sense?

* Should the content be saved to the file system or directly to the source control?

* If the content is saved to the file system, when should it be pushed to the central source control server?

* Or should content only be pulled from the author systems and merged on a developer machine before being pushed to
 the central source control server?


2. Take an existing micro cms (e.g. comatose, sandstone) and modify it such that the content is saved like in this
prototype.


3. Try out the modified micro cms on a real project and evaluate it in the real world.


== Getting started ==

1. Download the source code from git (https://github.com/austinmoore/acts_as_cms/tree/master)
2. cd acts_as_cms
3. cp ./config/database.yml.example ./config/database.yml
4. Go wild. :)


== Plugins used ==

ActiveRecordBaseWithoutTable
ryanb/nifty-generators