部署钩子语法错误

时间:2013-06-08 18:49:34

标签: ruby-on-rails ruby shell deployment

在cloud66部署到digitalocean期间,尝试使用deploy hook为/ public / uploads授予权限,以使carrierwave文件上传起作用。 我收到以下错误:

Error during deployment: Error during after_rails hook: Execution of sudo 
/tmp/open_folder_permissions.sh returned a non-zero exit code. Output was: 
/tmp/open_folder_permissions.sh:5: syntax error, unexpected tGVAR, expecting keyword_do or 
'{' or '(' sudo chmod 0775 -R $RAILS_STACK_PATH/public/uploads ^ 

open_folder_permissions.sh

#! /usr/bin/env ruby
#load environment variables
source /var/.cloud66_env
#assign desired permissions
sudo chmod 0775 -R $RAILS_STACK_PATH/public/uploads

deploy_hooks.yml

production:
  after_rails:
    - source: /.cloud66/files/open_folder_permissions.sh
      destination: /tmp/open_folder_permissions.sh
      target: rails                
      execute: true
      run_on: all_servers
      apply_during: all
      sudo: true

什么可能导致错误?

1 个答案:

答案 0 :(得分:2)

您的open_folder_permissions.sh不包含有效的Ruby代码。从它的外观来看,它应该是一个shell脚本,而不是Ruby脚本,所以你应该将shebang行更改为shell解释器而不是Ruby解释器。

#! bin/bash是正确的翻译。