我们的capistrano设置为:使用普通用户的ssh,但部署到需要使用sudo权限创建文件的位置。capistrano使用sudo运行内部命令
我想使用sudo运行特定的capistrano命令run "cd #{configuration[:releases_path]} && #{decompress(remote_filename).join(" ")} && rm #{remote_filename}"
。有没有一种干净的方式可以搭上它?
def distribute!
upload(filename, remote_filename)
run "cd #{configuration[:releases_path]} && #{decompress(remote_filename).join(" ")} && rm #{remote_filename}"
end
谢谢,我可以某种方式覆盖'分发!'方法而无需修改代码? ('sudo cd' dosent work)。 – 2012-01-30 23:47:39