mirror of
https://github.com/onkelbeh/cheatsheets.git
synced 2026-08-15 13:34:53 +02:00
Add Rake.
This commit is contained in:
34
rake.md
Normal file
34
rake.md
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
title: Rake
|
||||
layout: default
|
||||
---
|
||||
|
||||
### Basic syntax
|
||||
|
||||
```rb
|
||||
namespace :foo do
|
||||
desc "Description"
|
||||
task :bar do
|
||||
...
|
||||
end
|
||||
|
||||
task :baz => :dependency do
|
||||
end
|
||||
|
||||
task :baz => [:dep1, :dep2, dep3] do
|
||||
end
|
||||
end
|
||||
|
||||
# rake foo:bar
|
||||
```
|
||||
|
||||
### Rake task with arguments
|
||||
|
||||
```rb
|
||||
desc "Do something"
|
||||
task :workit, [:id] => :environment do |_, args|
|
||||
id = args[:id]
|
||||
end
|
||||
|
||||
# rake workit[234]
|
||||
```
|
||||
Reference in New Issue
Block a user