我有一個包含三個任務的rake文件,需要按順序執行。Rake測試任務的順序
require 'rake/testtask'
file 'some_binary_file.elf' do
puts 'fetching file from server ...'
# this task connects to a server and downloads some binaries
# it takes a few seconds to run
end
task flash_application: 'some_binary_file.elf' do
puts 'flashing the file to the hardware ...'
# this task copies a binary file to the flash memory
# of some external hardware, also takes a few seconds
end
Rake::TestTask(:hardware) do |t|
puts 'running tests ...'
f.test_files = FileList['test/**/*_test.rb']
end
rake default: [:flash_application, :hardware]
當我在終端運行$ rake
時,它會產生以下輸出。
running tests ... < ---- (not actually running)
fetching file from server ...
flashing the file to the hardware ...
我希望rake按我指定的順序運行任務,但它似乎總是首先執行測試任務。非常值得注意的是,測試不會運行 - 但創建任務的輸出無論如何都會產生。
會做出一個任務,只是以正確的順序觸發其他人是一個可接受的解決方案? – tadman
試過了,似乎沒有工作。測試任務似乎沒有被調用。 –