Hello and welcome to the restorm technical blog. It is here that we post about what is happening in our labs, what keeps us busy and why X doesn't work. Read more about us on the about page.
New rake and cap bash-completion scripts
As you all know, hackers are lazy. They are so lazy, that they work today to spare some work tomorrow. And they do this every day.
I’m shure, there are working bash completion scripts for rake and cap, but the ones I downloaded didn’t work that well.
So today I spend some hours hacking new completion scripts to save me (and you) some seconds of typing tomorrow. And the day after. It sums up, you know? At least in theory.
So without further fuzz, here you are: http://github.com/niko/rake_and_cap_completion/tree/master
Have fun!
yours truly, niko
ARMIT - Jumping the git train
I want to be on it. So I release armit to the world – even before its all mature (the way we like our beer). What’s armit, you say? Well, Armit is ‘ActiveRecord Multiple InheriTance’. Ok, that’s contrived you say, right. But it rings well.
With armit you can finally do all that crazy table stuff you’ve always wanted to. I promise to write more about it here – and to make a formal release once it is ready. Birdie, fly:
http://github.com/kschiess/armit/tree/master
git://github.com/kschiess/armit.git
Meanwhile, back at the ranch … that new kid git really rocks me off of my feet. And github looks really promising – so promising in fact that we might host more projects there in the future (not affiliated). Do give it a whirl!
Edit: Now that I read through it, that post reads like the spam I am getting. The same giddy excitement over not much. That’s a mood I am in often, I call it taking pleasure in living.
yours truly, kaspar
eliminate, stamp out and abolish redundancy - to hell with spec/mocks
We firmly believe a testing framework should not also bring a mocking framework along. And we choose flexmock over the alternatives. Also – that choice was made before switching to rspec, so we weren’t at all happy with spec/mocks and flexmock battling themselves in our code.
The battle was inevitable, since both offer you convenience methods like
object.should_receive(:message)
Are you sure which framework you use in your rails specs? Really? Read on.
Ripping out spec/mocks
So you rip it out, right? No. Even though rspec allows you to configure mocking, rspec_on_rails will load and use the spec/mocks framework.
We selfishly rewrote rspec_on_rails into rspec_flexmock_on_rails. Branching is not always a good idea, but this time – it might just solve things for some people, that’s why we put our code in public under the same license that rspec is. Here goes:
http://swissrb.rubyforge.org/svn/rspec_flexmock_on_rails/
Please leave us a comment – if enough people start using this, we might be tempted to patch…
yours truly, kaspar
ScopedProxy 1.0
We’re proud to announce our first software release: Scoped Proxy. Here’s what it does:
require 'scoped_proxy'
class User < ActiveRecord::Base
scoped_proxy :role do |role|
{
:find => { :conditions => ['role = ?', role] }
}
end
scoped_proxy :deleted, :find => {
:conditions => 'deleted_at is not null'
}
end
admins = User.role('admin')
admins.count # => 12
admins.find(:all) # => [ ... ]
User.deleted.count # => a number
Those of you who’ve read our old blog (neotrivium.com) will know the scoped proxy as a single file drop in plugin. On public demand I’ve gem-ified it. To install, simply type:
sudo gem install ScopedProxy
Easy as that. Please let me know what you think!
(Update: Here’s the link to our rubyforge project: swissrb)
yours truly, kaspar