encyclopegia.org

Rake (software)

Rake is a software task management and a build automation tool created by Jim Weirich. It allows the user to specify tasks and to describe dependencies as well as to group tasks into namespaces. It is similar to SCons and Make. Rake was written in Ruby and has been part of the standard library of Ruby since version 1.9.

Rake is a software task management and a build automation tool created by Jim Weirich. It allows the user to specify tasks and to describe dependencies as well as to group tasks into namespaces. It is similar to SCons and Make. Rake was written in Ruby and has been part of the standard library of Ruby since version 1.9. ==Examples== The tasks that should be executed need to be defined in a configuration file called Rakefile. A Rakefile has no special syntax and contains executable Ruby code. task :greet do puts "Hello, Rake!" end When defining a task, you can optionally add dependencies, that is one task can depend on the successful completion of another task. Calling the "seed" task from the following example will first execute the "migrate" task and only then proceed with the execution of the "seed" task. task :seed => :migrate do # This task will run after the :migrate task end Tasks can also be made more versatile by accepting arguments. For example, the "generate_report" task will take a date as argument. If no argument is supplied the current date is used. task :generate_report, [:date] do |t, args| report_date = args[:date] || Date.today # Generate the report based on the specified date end A special type of task is the file task, which can be used to specify file creation tasks. The following task, for example, is given two object files, i.e. "a.o" and "b.o", to create an executable program. file "prog" => ["a.o", "b.o"] do |t| sh "cc -o #{t.name} #{t.prerequisites.join(' ')}" end Another useful tool is the directory convenience method, that can be used to create directories upon demand. directory "testdata/examples/doc" ===Rules=== When a file is named as a prerequisite but it does not have a file task defined for it, Rake will attempt to synthesize a task by looking at a list of rules supplied in the Rakefile. For example, suppose we were trying to invoke task "mycode.o" with no tasks defined for it. If the Rakefile has a rule that looks like this: rule '.o' => '.c' do |t| sh "cc #{t.source} -c -o #{t.name}" end This rule will synthesize any task that ends in ".o". It has as a prerequisite that a source file with an extension of ".c" must exist. If Rake is able to find a file named "mycode.c", it will automatically create a task that builds "mycode.o" from "mycode.c". If the file "mycode.c" does not exist, Rake will attempt to recursively synthesize a rule for it. When a task is synthesized from a rule, the source attribute of the task is set to the matching source file. This allows users to write rules with actions that reference the source file. ===Advanced rules=== Any regular expression may be used as the rule pattern. Additionally, a proc may be used to calculate the name of the source file. This allows for complex patterns and sources. The following rule is equivalent to the example above: rule(/\.o$/ => ->(t_name){ t_name.sub /\.o$/, '.c' }) do |t| sh "cc #{t.source} -c -o #{t.name}" end NOTE: Because of a quirk in Ruby syntax, parentheses are required around a rule when the first argument is a regular expression. The following rule might be used for Java files: rule '.class' => ->(t_name){ t_name .sub(/\.class$/, '.java') .sub(/^classes\//, 'src/') } do |t| java_compile(t.source, t.name) end To better organize big Rakefiles, tasks can be grouped into namespaces. Below is an example of a simple Rake recipe: namespace :cake do desc 'make pancakes' task :pancake => [:flour, :milk, :egg, :baking_powder] do puts "sizzle" end task :butter do puts "cut 3 tablespoons of butter into tiny squares" end task :flour => :butter do puts "use hands to knead butter squares into 1 1/2 cup flour" end task :milk do puts "add 1 1/4 cup milk" end task :egg do puts "add 1 egg" end task :baking_powder do puts "add 3 1/2 teaspoons baking powder" end end ==See also== Make Apache Maven Apache Ant ==External links== Rake documentation

References

  1. Release v13.2.1 · ruby/rake · GitHub · retrieved 2026-11-18 · rev 1343961871
    Cite this reference

    MLA "Release v13.2.1 · ruby/rake · GitHub." "Release v13. 2026-11-18. https://github.com/ruby/rake/releases/tag/v13.2.1. Accessed 24 November 2026.

    Chicago "Release v13.2.1 · ruby/rake · GitHub." "Release v13. 2026-11-18. https://github.com/ruby/rake/releases/tag/v13.2.1.

    APA "Release v13. (2026). Release v13.2.1 · ruby/rake · GitHub. Retrieved November 24, 2026, from https://github.com/ruby/rake/releases/tag/v13.2.1

  2. Rakefile Format # Namespaces · retrieved 2024-06-20 · rev 1343961871
    Cite this reference

    MLA "Rakefile Format # Namespaces." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Namespaces. Accessed 24 November 2026.

    Chicago "Rakefile Format # Namespaces." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Namespaces.

    APA encyclopegia.org. (2024). Rakefile Format # Namespaces. Retrieved November 24, 2026, from https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Namespaces

  3. Rake -- Ruby Make · retrieved 2026-11-18 · rev 1343961871
    Cite this reference

    MLA "Rake -- Ruby Make." 2026-11-18. https://ruby.github.io/rake/. Accessed 24 November 2026.

    Chicago "Rake -- Ruby Make." 2026-11-18. https://ruby.github.io/rake/.

    APA encyclopegia.org. (2026). Rake -- Ruby Make. Retrieved November 24, 2026, from https://ruby.github.io/rake/

  4. NEWS · retrieved 2026-11-18 · rev 1343961871
    Cite this reference

    MLA "NEWS." 2026-11-18. https://web.archive.org/web/20160304130146/https://svn.ruby-lang.org/repos/ruby/tags/v1_9_1_0/NEWS. Accessed 24 November 2026.

    Chicago "NEWS." 2026-11-18. https://web.archive.org/web/20160304130146/https://svn.ruby-lang.org/repos/ruby/tags/v1_9_1_0/NEWS.

    APA encyclopegia.org. (2026). NEWS. Retrieved November 24, 2026, from https://web.archive.org/web/20160304130146/https://svn.ruby-lang.org/repos/ruby/tags/v1_9_1_0/NEWS

  5. Rakefile Format · retrieved 2024-06-20 · rev 1343961871
    Cite this reference

    MLA "Rakefile Format." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Rakefile+Format. Accessed 24 November 2026.

    Chicago "Rakefile Format." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Rakefile+Format.

    APA encyclopegia.org. (2024). Rakefile Format. Retrieved November 24, 2026, from https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Rakefile+Format

  6. Rakefile Format # File Tasks · retrieved 2024-06-20 · rev 1343961871
    Cite this reference

    MLA "Rakefile Format # File Tasks." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-File+Tasks. Accessed 24 November 2026.

    Chicago "Rakefile Format # File Tasks." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-File+Tasks.

    APA encyclopegia.org. (2024). Rakefile Format # File Tasks. Retrieved November 24, 2026, from https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-File+Tasks

  7. Rakefile Format # Direcpory Tasks · retrieved 2024-06-20 · rev 1343961871
    Cite this reference

    MLA "Rakefile Format # Direcpory Tasks." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Directory+Tasks. Accessed 24 November 2026.

    Chicago "Rakefile Format # Direcpory Tasks." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Directory+Tasks.

    APA encyclopegia.org. (2024). Rakefile Format # Direcpory Tasks. Retrieved November 24, 2026, from https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Directory+Tasks

  8. Rakefile Format # Rules · retrieved 2024-06-20 · rev 1343961871
    Cite this reference

    MLA "Rakefile Format # Rules." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Rules. Accessed 24 November 2026.

    Chicago "Rakefile Format # Rules." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Rules.

    APA encyclopegia.org. (2024). Rakefile Format # Rules. Retrieved November 24, 2026, from https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Rules

  9. Rakefile Format # Advanced Rules · retrieved 2024-06-20 · rev 1343961871
    Cite this reference

    MLA "Rakefile Format # Advanced Rules." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Advanced+Rules. Accessed 24 November 2026.

    Chicago "Rakefile Format # Advanced Rules." 2024-06-20. https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Advanced+Rules.

    APA encyclopegia.org. (2024). Rakefile Format # Advanced Rules. Retrieved November 24, 2026, from https://github.com/ruby/rake/blob/master/doc/rakefile.rdoc#label-Advanced+Rules

  10. Ruby on Rails Tutorial: Understanding Rake and Task Automation · retrieved 2024-06-20 · rev 1343961871
    Cite this reference

    MLA "Ruby on Rails Tutorial: Understanding Rake and Task Automation." a b c "Ruby on Rails Tutorial: Understanding Rake and Task Automation". 2024-06-20. https://clouddevs.com/ruby-on-rails/rake-and-task-automation/. Accessed 24 November 2026.

    Chicago "Ruby on Rails Tutorial: Understanding Rake and Task Automation." a b c "Ruby on Rails Tutorial: Understanding Rake and Task Automation". 2024-06-20. https://clouddevs.com/ruby-on-rails/rake-and-task-automation/.

    APA a b c "Ruby on Rails Tutorial: Understanding Rake and Task Automation". (2024). Ruby on Rails Tutorial: Understanding Rake and Task Automation. Retrieved November 24, 2026, from https://clouddevs.com/ruby-on-rails/rake-and-task-automation/

Cite this article

MLA

"Rake (software)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/rake-software. Accessed 24 November 2026.

Chicago

"Rake (software)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/rake-software.

APA

encyclopegia.org. (2026). Rake (software). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/rake-software

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1343961871 · 0.5 · snapshot enwiki-001343961871

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.