Ruby-on-rails 耙子究竟是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/724724/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What exactly is Rake?
提问by Skip
In simple terms, what does Rake do? What purposes does it have? I understand it's a build tool but I'm looking a bit more detail. (For a simpleton.)
简单来说,Rake 是做什么的?它有什么目的?我知道这是一个构建工具,但我正在寻找更多细节。(对于一个简单的人。)
采纳答案by David M
Try Martin Fowler's article on Rake for more information:
尝试 Martin Fowler 关于 Rake 的文章以获取更多信息:
http://martinfowler.com/articles/rake.html
http://martinfowler.com/articles/rake.html
His pre-amble is:
他的序言是:
Rake is a build language, similar in purpose to make and ant. Like make and ant it's a Domain Specific Language, unlike those two it's an internal DSL programmed in the Ruby language. In this article I introduce rake and describe some interesting things that came out of my use of rake to build this web site: dependency models, synthesized tasks, custom build routines and debugging the build script.
Rake 是一种构建语言,目的类似于 make 和 ant。与 make 和 ant 一样,它是一种领域特定语言,与这两者不同的是,它是一种用 Ruby 语言编程的内部 DSL。在这篇文章中,我介绍了 rake 并描述了我使用 rake 构建这个网站时产生的一些有趣的事情:依赖模型、综合任务、自定义构建例程和调试构建脚本。
There is more information available on or linked from the project's home page as well:
项目主页上还有更多可用信息或链接:
回答by bryanbraun
These answers assume you know what a DSL is, or are familiar with Make or Ant. If that's not the case, here's a (perhaps grossly oversimplified answer):
这些答案假设您知道 DSL 是什么,或者熟悉 Make 或 Ant。如果情况并非如此,这里有一个(可能过于简单化的答案):
Rakeis a tool you can use with Rubyprojects. It allows you to use ruby code to define "tasks" that can be run in the command line.
Rake是一个可以用于Ruby项目的工具。它允许您使用 ruby 代码来定义可以在命令行中运行的“任务”。
Rake can be downloaded and includedin ruby projects as a ruby gem.
Rake 可以作为 ruby gem下载并包含在 ruby 项目中。
Once installed, you define tasks in a file named "Rakefile" that you add to your project.
安装后,您可以在添加到项目中的名为“ Rakefile”的文件中定义任务。
We call it a "build tool" because Rake comes with some libraries that make it easy to do tasks that are common during the build/deploy process, like file operations(creating, deleting, renaming, & moving files), publishing sites via FTP/SSH, and running tests.
我们称其为“构建工具”,因为 Rake 带有一些库,可以轻松执行构建/部署过程中常见的任务,例如文件操作(创建、删除、重命名和移动文件)、通过FTP发布站点/ SSH,并运行测试。
For more information, here's the project documentation: http://rake.rubyforge.org/
有关更多信息,这里是项目文档:http: //rake.rubyforge.org/
回答by J?rg W Mittag
Rakeis an implementation of dependency-based declarative programmingin the Ruby Programming Language. Basically, Rake is to Ruby what Makeis to C, with the notable difference, that Make is an external DSL, while Rake is an internal DSL.
瑞克是一个实现基于依赖关系的声明式编程的Ruby编程语言。基本上,Rake 之于 Ruby 就像Make 之于 C,显着的区别在于 Make 是外部DSL,而 Rake 是内部 DSL。
回答by August Lilleaas
Rake lets you execute Ruby code through a nice namespace api. An example is rake db:migrate. You can run tasks automatically before and after other tasks. That is all.
Rake 允许您通过一个漂亮的命名空间 api 执行 Ruby 代码。一个例子是 rake db:migrate。您可以在其他任务之前和之后自动运行任务。就这些。

