TheLucid Typo theme now works with version 4.1

TheLucid Typo theme finally works with version 4.1 of Typo.

Please bear in mind that this is quick-fix and and there will still be a Version 2 release sometime in the near future.

The new release can be downloaded below:

lucid-typo-theme-1-1.zip

There are a couple of improvements such as cookies remembering which colour scheme and layout have been selected along with some IE fixes.

Thanks to everyone who notified me of browser issues etc. and I hope to release v2.0 as soon as possible (for both Typo and Mephisto).

Using autotest when developing Rails plugins

I am a great fan of ZenTest’s ‘autotest’ tool and use it continuously whilst developing Rails apps. Up until now I’d not found a way to use autotest while developing plugins.

The problem

After some digging around in the ZenTest source, it turns out that autotest looks for files that are prefixed with test_ however the standard convention in Rails is to use a suffix e.g. base_test.rb. You could simply prefix your tests instead of using suffixes and modify the test file pattern in the Rakefile, however this feels wrong.

I noticed that autotest looks for a .autotest file in the current directory before looking in the home directory meaning that getting autotest to run for plugins is surprisingly simple.

The solution

Create an .autotest file in the root of the plugin directory containing the following:

global_autotest_file = File.expand_path('~/.autotest')
load(global_autotest_file) if File.exists?(global_autotest_file)
 
class Autotest
 def tests_for_file(filename)
 Dir['test/**/*_test.rb']
 end
end

You can now cd into the plugin dir, run autotest and all works as it does in a Rails app1. Also as this file loads the .autotest file in the home directory, any Growl notifiers etc. setup there will all work fine.

1 The only difference is that all tests are re-loaded when a test file is saved. This is not an issue for the majority of plugins, if it is, then it’s probably a sign that the tests need optimising.