0

链接文本

我尝试了上述堆栈溢出帖子中的所有答案,但都没有奏效

当我用 #!/path/to/my/script/runner 替换 #!/usr/bin/env ruby​​ 并尝试运行

Rails 返回:

/var/www/cmgmail/production/releases/20100810151610/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in establish_connection': Please install the postgresql adapter:gem install activerecord-postgresql-adapterestablish_connection (no such file to load -- pg) (RuntimeError) from /var/www/cmgmail/production/releases/20100810151610/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:60:in'等。. .

当我完好无损地保留原始 shebang #!/usr/bin/env ruby​​ 时,没有任何命令组合起作用。

例如 script/my_script -e 生产返回:

/var/www/cmgmail/production/releases/20100810151610/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:62:inestablish_connection establish_connection': development database is not configured (ActiveRecord::AdapterNotSpecified) from /var/www/cmgmail/production/releases/20100810151610/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:55:in' ...等

./my_script 返回: ./my_script: 没有这样的文件或目录(但我验证了文件在那里)

我有什么明显的遗漏吗?

我想我可以把它变成一个 rake 任务,但是这个脚本在开发模式下运行良好。

4

1 回答 1

0

别忘了跑chmod a+x my_script。顺便说一下,尝试script/my_script使用RAILS_ENV=production环境变量运行。

于 2010-08-11T00:42:19.090 回答