我正在使用 Ruby on Rails 和 Capistrano gem。我想干燥(不要重复自己)Capistrano 食谱。
在deploy.rb
我的文件中:
# First task
task :first_task do
...
run "cd #{current_path}; #{try_sudo} chmod -R 666 /log/production.log"
end
# Second task
task :second_task do
run "..."
# The following code is equal to that stated in the first task.
run "cd #{current_path}; #{try_sudo} chmod -R 666 /log/production.log"
end
那么,我怎样才能干燥上面的代码,以免重复任务呢?