I have been carrying this Rakefile around between projects, that uses another file which reopens the
FlogTask class and adds an
attr_accessor to it, which the task definition in the Rakefile then uses.
This works but, as you can readily tell, it's less than ideal. In particular, the
Rakefile defines multiple tasks which are the same for each project; the only change is usually the Flog threshold value.
What I want to be able to do is:
- Subclass a tool's standard Rake task (e.g.,
FlogTask). The subclass'
#initializemethod would then set up our standard settings as is presently done in the Rakefile;
- Define namespaced Rake tasks (in, e.g.,
lib/tasks/custom_flog.rake) that use those subclasses rather than the tool's standard Rake task; reducing boilerplate and possibility of copy/paste errors;
- Have those tasks be available in the
Rakefileso that the only code in
Rakefilewould be the default task setup.
I've been reading the docs, and I've spent a couple hours with Google reading through blogs that people have posted, and I still haven't figured out what I need to do.
(Files referenced reproduced below, as taken from a small open-source project of ours.)
EDIT: Thanks to @csmr (aka
c-c on Freenode) for helping me think through rewording the goal list.
EDIT 2: Added
c11e-flog.rake as an example of what I've tried to do that hasn't worked yet.