Is it a better way to build?

T

TRANS

Yesterday, as I beat myself with my old
what-to-name-it-where-to-put-it stick ;-) I touched on idea loosely
derived on the script/ dir "Railism". So I tried it out just to see if
it could work and indeed it does. The idea is this. Instead of a
single monolithic script like Rakefile to manage your project tasks,
you can have a script file for each task in a subdir (like script/).
Task dependencies are simply handled by internal methods if they are
"hidden" tasks or by requiring another tasks, and handling them a
cache mechinism.

So for example a project might look like:

fooproject/
lib/
test/
script/
rdoc
package
release
test

An example script (as presently implemented) looks like this. Note,
for the expiremental system I called the module "Scriptonic" (as
opposed to "Reap"). Here's script/rdoc:

#!/usr/bin/env ruby

def rdoc
Scriptonic.rdoc do |r|
r.template = 'jamis'
r.options = ['--all', '--inline-source']
r.include = [ 'lib/**/*', '[A-Z]*' ]
r.output = 'rdoc'
end
end

load 'scriptonic.rb'

By calling script/rdoc on the command line:

$ script/rdoc

It will find the ProjectInfo and change to the project root dir and
then call the method of the same name, e.g. rdoc, which as we see runs
the Scriptonic.rdoc builtin task.

(Note, on a system that doesn't support #!/usr/bin/env ruby, you have
to use "ruby script/rdoc")

To have a prerequisite task lets say we wanted to run our test task
before rdocing. To do that we can use the #prereq method which returns
a Once functor (a memoize/cache system):

require 'test'

def rdoc
prereq.test
Scriptonic.rdoc do |r|
r.template = 'jamis'
r.options = ['--all', '--inline-source']
r.include = [ 'lib/**/*', '[A-Z]*' ]
r.output = 'doc/api'
end
end

There is also a help system "script/rdoc --help" and task can take
arguments "script/rdoc more" (doesn't yet support custom flag options
though).

Okay, now that I explained it, the question is: Is this a better way
to build than Rake (and it's clone, Reap)?

Thanks,
T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top