【发布时间】:2016-06-08 09:45:42
【问题描述】:
我的葫芦项目中有一个 rake 任务,它执行几个系统命令,例如:
desc 'Export and execute features from JIRA '
task :run_jira, [:key, :language, :apk_file] do |_, args|
key = args[:key]
language = args[:language] || 'en'
apk_file = args[:apk_file] || default_apk
system "curl -u admin:admin -X GET http://myjira/rest/raven/1.0/export/test?keys=#{key} > jira.zip"
system "unzip -o jira.zip -d features/jira"
system "rm -rf jira.zip"
system "calabash-android run #{apk_file} -p android -p #{language} -p common -f json -o results/reports/calabash-#{key}.json features/jira"
system "curl -H 'Content-Type: application/json' -X POST -u admin:admin --data @results/reports/calabash-#{key}.json http://myjira/rest/raven/1.0/import/execution/cucumber"
end
有没有更好的方法来执行这 5 个系统调用?我的想法是制作一个 .sh 脚本并从任务中启动它,但由于该脚本将在 OS X 和 Linux 机器上执行,我认为它可能会造成更多麻烦。
【问题讨论】: