samvera-deprecated / jettywrapper

Convenience tasks and classes for automated testing of hydra heads.
Apache License 2.0
7 stars 19 forks source link

rake tasks should take arguments #33

Open atz opened 10 years ago

atz commented 10 years ago

Several of the rake tasks should take arguments, and certainly the underlying jettywrapper.rb methods should. For rake, at least:

rake jetty:download
rake jetty:clean
rake jetty:unzip

jettywrapper.rb's download() method already takes a url argument, but rake doesn't expose it.

In general, you should be able to target a jetty version directly from the command line, without setting global ZIP_URL or previous magic call to jettywrapper.instance.url= or passing arguments to stop(). Side note: I don't get the convenience of "configure via stop() call".

awead commented 10 years ago

Are you suggesting something like:

$ rake jetty:download JETTY_URL=http://blah/master.zip
atz commented 10 years ago

Partially. See https://github.com/jimweirich/rake/blob/master/doc/rakefile.rdoc#task-arguments-and-the-environment

This would also be sufficient:

rake jetty:download[http://blah/master.zip]
atz commented 10 years ago

The difference is that rake knows that the task takes an argument, it shows up in rake -T, etc. And the user doesn't have to know all the various internal variable names that they don't actually care about. Also, if your rake task is prerequisite to other tasks, those tasks don't have to bounce off a GLOBAL variable or coordinate args outside the API.

awead commented 10 years ago

@atz so long as the argument isn't required, it's fine with me.