adva_cms
A few days ago I stumbled over Sven’s current project adva_cms which is a cms, mixed from mephisto, beast and signalwiki. The basis is mephisto, with all the pro and cons (aka page caching), everything else is included as plugins with Engine.
I hope to use it for a small community site this month and will post updates here on the experiences with adva_cms.
everything in plastic*
Last month I bought plasticpilots.com from Alex (from plasticshore.com), trashed the expression engine it was running on and wrote a completely new software called plasticairships. The new software is running on plasticpilots for a week now, a few of bugs have been fixed since and improvements in the design been made.
I’m not sure if anyone else will ever find good use for it. Alex and I did a redux version this week, for a workshop he does next month. The redux looks totally different of course, very minimalistic, and it has a few features from feedme (which will get some loving soon).
Btw, plasticairships is running on rails 2.1, so it’s totally covered with named_scopes, the new eager loading and other stuff.
single table inheritance in rails 2.1
With the new “rails 2.1” there was a small but for me important change in the STI that made my life easier. Thanks to divoxx for his enhancement. It didn’t show up in the docs yet but I’ll give you an example where.
The documentation’s example consists of the models Company, Firm and Client, very simple. My real life example (it will be on the new plasticpilots website) consists of a model Comment that I use as an association for Post and Site. So Post and Site have many comments. To save duplication I use STI of course and to keep the directories clean I have Site::Comment << Comment and Post::Comment << Comment (and maybe more in the far future of 2009). Old rails versions did a demodulize the class names so I would have Comment in my type column and a lot of confusion. With rails 2.1 it’s the full class name in the type column and I can kick all the work-arounds I had previously.
ActiveRecord::Base.store_full_sti_class = false
rails 2.1, goldberg but no postgres
Sure it’s a strange combination but mysql is most people’s favourite and goldberg is my very personal favourite.
Anyways, today I was upgrading to rails 2.1.0 and guess what, it didn’t work anymore cause some pg was being required which I don’t have. The problem has basically two causes. First the rails devs added a few lines to the postgresql connection adapter to enforce loading the pg or postgresql gem. Second, goldberg was a bit sloppy with its model monkeypatching. The fix is very simple, just a few changes to lib/goldberg/model.rb basically adding the check that goldberg is using in it’s migration extensions anyways.
You can find my patch over at goldberg’s rubyforge bugtracker
Update: A few more issues came up, so you might just want to git clone git://github.com/TomK32/goldberg.git my github repository into vendor/generators and use it like normal.
recent activities
I’ve been doing a lot of open source in the last two months and you might want to check out the results so far. And besides all that there’s the githorde of course.
FeedMe!
FeedMe! is a RSS planet that was started by Daniel Lindsley and I improved it to match my needs for salzburg-weblogs.net. It’s still incomplete and I will put a few more days of work into.
exabuch
exabuch is a german billing web-app and took over this one as well. I have quite big plans with it, also on a commercial level
plastipilots
My newest investment is this very old design website plasticpilots that I’m about to buy from a guy living nearby (yeah, very big internet). It’s getting a completely new software as replacement for expression engine and the new software will be open source as well: plasticairships. I think it will be very easy to customize for any kind of showcases or portfolio.
jaxdoc: Ruby on Rails docs on AJAX
I became big fan of the jaxdoc generator for rdoc in the last months. It’s amazing to find out that you can extend rdoc to generate the docs (and I really love having docs on my local machine) the way you want it. Jaxdoc provides you with ajaxfied documentations which make searching in the docs much faster. Not to forget that you the source of the methods, just like normal rdoc. There are a few download packages at railsbrain.com and one for ruby core at rubybrain.com. But there’s no howto for creating your own docs, so I hope this example to generate for Rails 2.0.1 is complete enough for everyone. If not, please drop me a note. The exclusions could be defined a bit better I guess. And of course you can include other gems if you want a fat documenation.
1 2 3 4 |
sudo gem install jaxdoc VERSION = '2.0.1' cd /opt/local/lib/ruby/gems/1.8/gems/ rdoc --op ~/docs/rails-$VERSION --fmt ajax --exclude .*generator.* --exclude .*test.* --include actionmailer-$VERSION activerecord-$VERSION actionpack-$VERSION activesupport-$VERSION activeresource-$VERSION rails-$VERSION |
date_select with fewer selects
date_select is sure an useful helper in when building forms, but sometimes you don’t want the year to be a select but a text input for practical reasons or for typing in the dates of ancient philosophers.
My first idea was to overwrite date_or_time_select which is called by date_select but why not a step further? Instead of select_year giving me a select box I’ll get a text input working just like the select. Put the code lines into your application helper file or into a new file in your lib. I’m not exactly sure how to have both variations in one app, any hints are welcome.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
module ActionView module Helpers class InstanceTag def select_year(date, options = {}) val = date ? (date.kind_of?(Fixnum) ? date : date.year) : '' if options[:use_hidden] hidden_html(options[:field_name] || 'year', val, options) else name = options[:field_name] || 'year' tag :input, { "type" => "text", "name" => name, "id" => name, "value" => val, :size => 4 } end end end end end |
das war der railsrumble
times running up
rake stats
TomK32:~/Arbeit/subnet/denkmaltisch/denkmaltisch tomk32$ rake stats
(in /Users/tomk32/Arbeit/subnet/denkmaltisch/denkmaltisch)
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 192 | 168 | 2 | 12 | 6 | 12 |
| Helpers | 39 | 34 | 0 | 2 | 0 | 15 |
| Models | 160 | 122 | 6 | 16 | 2 | 5 |
| Libraries | 68 | 47 | 1 | 7 | 7 | 4 |
| Components | 0 | 0 | 0 | 0 | 0 | 0 |
| Integration tests | 95 | 79 | 1 | 6 | 6 | 11 |
| Functional tests | 267 | 227 | 2 | 34 | 17 | 4 |
| Unit tests | 173 | 136 | 5 | 18 | 3 | 5 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total | 994 | 813 | 17 | 95 | 5 | 6 |
+----------------------+-------+-------+---------+---------+-----+-------+
Code LOC: 371 Test LOC: 442 Code to Test Ratio: 1:1.2
Neue Website bzw. Unterschriftenaktion
$ rake stats
(in /data/rails/talktogether)
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers | 93 | 75 | 3 | 13 | 4 | 3 |
| Helpers | 7 | 6 | 0 | 0 | 0 | 0 |
| Models | 26 | 20 | 4 | 1 | 0 | 18 |
| Libraries | 0 | 0 | 0 | 0 | 0 | 0 |
| Components | 0 | 0 | 0 | 0 | 0 | 0 |
| Integration tests | 0 | 0 | 0 | 0 | 0 | 0 |
| Functional tests | 36 | 26 | 4 | 6 | 1 | 2 |
| Unit tests | 40 | 28 | 4 | 4 | 1 | 5 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total | 202 | 155 | 15 | 24 | 1 | 4 |
+----------------------+-------+-------+---------+---------+-----+-------+
Code LOC: 101 Test LOC: 54 Code to Test Ratio: 1:0.5
Die stats schaun ganz gut aus, oder? 155 LOC, ich müsste noch etwas mehr Tests schreiben für ein 1:1 Verhältnis. Bei Kampodscha sind's zur Zeit 1137 LOC.
We are ready rumble!
Du musst nie wiederin die Schule gehenPHP programmieren.