Extract Rule to its own class.

Then, using TDD, improve and check the way `cmd` is executed by the rule. Both
stdout and stderr are captured, as well as any unexpected exception.