I've been thinking about getting away from Typo for a little while now. It's a decent little engine, and was my first real run with Ruby on Rails, but there was a couple of things that were always under my skin.
After some looking on the net, I found that all the cool kids are using Mephisto for their web logging needs. I grabbed a copy and took it for a spin on my test site, and was quite impressed. I decided I would share with you all how I made the transition, although I think I was the last person using Typo.
The first thing was to make sure I didn't mangle my current, production database so I created a new one through the web panel and then:
mysqldump -u olduser -p oldpassword -h mysql.existinghost.com existing_database \
| mysql -u testuser -p testpassword -h mysql.testhost.com testing_database
I now had a testing_database that I could wreck havoc with. Next I needed the bleeding edge of Typo, so that I could migrate my database to the current version. I couldn't do this with my current version because I wasn't ready to upgrade my production site to the newest Typo. Therefore I:
svn checkout http://svn.typosphere.org/typo/trunk typo_delete
svn checkout http://svn.techno-weenie.net/projects/mephisto/trunk .
Now I had the lastest version of Mephiso installed in my testing webroot, and typo where I could use it. I then updated the database.yml files for both applications so that typo pointed to the testing database, and Mephisto had production set to a brand new database, as well as the typo entry set to the testing database. Once that was done, I started the migration
cd typo_delete
rake db:migrate VERSION=56
You needed to specify the version to stop at, because the bleeding edge of Typo breaks the Mephisto conversion script. Then we are ready to bootstrap the new database, and migrate the data over
cd ../mephisto
rake db:bootstrap
script/runner "Mephisto.convert_from :typo" -e production
At this point I could not log into the admin application with my old Typo user. The problem was that my user appeared to be missing a validation time, so I logged into the database and:
update users set activated_at = now(), admin = 1 where login = 'wdevauld';
Now I was able to get into the admin applet and check out my articles.
The final conversion I made before switching over was to pre-populate all my tags. I believe that tagging is the future of the internet, and quite a few sites I use (Del.icio.us and Flickr are at the top) implement tagging rather well. I don't want to get caught up in sets, categories or sections so from now on it's all Tags all the time. Most of my Typo articles were categorized to some extent, and the conversion pulled them over into sections. I wanted to pre-populate all my tags with my sections (previously my categories) so I dove into the rails production console and
Article.find(:all).collect do |article|
Tagging.set_on(article, article.sections.collect{|i|i.name}.reject{|i|i=="Home"}.join(', '))
end
There in three easy lines of code I had all my articles tagged with their section names. It was a shame I had to pull the Home section out, but under mephisto everything is in 'Home' and I didn't need a 'Home' tag with every old article in it. The last bit of meat to get me happy enough to switch production over was to facilitate the old permanent links, so I edited config/environment.rb to include:
Mephisto::Routing.redirect 'articles/*' => '$1'
and I was ready enough to go. The old RSS feed doesn't work anymore, because Mephisto facilitates Atom feeds, and that's the way it's going to be. Those that are tech savvy enough to use a feed reader for my blog, are surely not going to be stumped enabling the Atom feed.
This is the first post under the new regime, and I've been compiling a list of what I still need to do in order to be happy again:
- Fill the sidebar up again:
- Recent Del.icio.us tags
- Monthly archives
- Flickr stream
- Blog-roll
- Perhaps some feedburner love
- Code formatting
- Automagic pings to all my favorite sites
- Way more Style!
I was hoping to participate in the CSS Reboot this spring, but I want to have the new look in place before them. Although with how busy I've been lately, I think May 1 is a reasonable deadline.