LoginSignup
3
2

More than 5 years have passed since last update.

Rakeタスク実行前に別タスクを実行する書き方

Posted at

案外ググっても出てこなかったので一応

やり方

事前に実行したいタスクをハッシュの値に設定してあげます

hogefuga.rake
# taskの引数をハッシュにする
task hoge: :fuga do
  puts "executed hoge"
end

task :fuga do
  puts "executed fuga"
end

実行すると...

$ rake hoge
executed fuga
executed hoge

hogeタスクの前にfugaタスクが実行されました!

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2