开发者

What makes Rake so useful in Ruby?

开发者 https://www.devze.com 2022-12-20 18:34 出处:网络
Perhaps this is a dumb question, and I\'m not under estimating the value of Rake here by any means, I\'m just not get开发者_StackOverflow社区ting it. What value does Rake have if all it is, is arbitra

Perhaps this is a dumb question, and I'm not under estimating the value of Rake here by any means, I'm just not get开发者_StackOverflow社区ting it. What value does Rake have if all it is, is arbitrarily executed Ruby code? It's apparently good at handling tasks, but what's to stop me from writing a class and embedding it into a shared Ruby directory and executing that code as my task instead? What value does Rake really offer?


  • Rake has all the power of a complex built tool such as Make (with the dependency management rules and so on)...
  • Rake is easily extensible without needing all the complex packaging you'd have otherwise... if you tried to extend ant (jar files and config properties...) and the meta-ness of using a Makefile to build some C code to extend Make...
  • Rake is extensible just using the language it seeks to manage and without extra packaging... - mostly down to the expressiveness of the ruby language.


I presume it has a topological sort for dependency (in rake terms, prerequisite) tracking...

Dependency tracking logic usually involves something like a topological sort and is a type of inference engine.

Combined with the data in the rakefile, the combination of domain data plus the inference engine makes it an expert system.

OK, so it's not exactly ("good morning Dave") HAL


(Caveat: I'm not a Ruby-head, although I've used some Ruby-based projects and so I've used Rake.)

My immediate response is: Structure, convention, and commonality with other projects (so sharing is easy). Your own tool would be...your own tool, and therefore different, and therefore contrary to convention (and we know how the Ruby community is about convention!). [I expect Rake has at least some pre-baked functionality as well (dependency management), which you wouldn't want to have to recode.]

make wasn't initially all that hefty either; it was just a way to run shell commands with "a bit of" dependency management. But the convention was so powerful that (despite a mind-numbingly awkward structure) makefiles became the norm for C projects for, what, three decades or so, so far?

0

精彩评论

暂无评论...
验证码 换一张
取 消