如何配置capistrano以使用我的rvm版本的Ruby

时间:2021-12-02 20:00:48

Does anybody know how I can tell capistrano to use my default rvm version of ruby for on the server I am pushing to. It insists on using the system version.

有谁知道我怎么能告诉capistrano在我推动的服务器上使用我的默认rvm版本的ruby。它坚持使用系统版本。

Is it even possible?

它甚至可能吗?

4 个解决方案

#1


10  

The rvm-capistrano gem is the best way to go.

rvm-capistrano宝石是最好的方式。

Link to the official detailed usage of that gem. From that I am guessing this will get the local version of Ruby:

链接到该gem的官方详细用法。从那以后我猜这将获得本地版本的Ruby:

set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system

#2


36  

You have two options:

你有两个选择:

  1. Enable .ssh environment variables using the PermitUserEnvironment option in your ssh configuration file
  2. 使用ssh配置文件中的PermitUserEnvironment选项启用.ssh环境变量
  3. Use the capistrano :default_environment setting
  4. 使用capistrano:default_environment设置

For the second option, simply add the following line in your deploy.rb file

对于第二个选项,只需在deploy.rb文件中添加以下行

set :default_environment, { 
  'PATH' => "/path/to/.rvm/ree-1.8.7-2009.10/bin:/path/to/.rvm/gems/ree/1.8.7/bin:/path/to/.rvm/bin:$PATH",
  'RUBY_VERSION' => 'ruby 1.8.7',
  'GEM_HOME' => '/path/to/.rvm/gems/ree/1.8.7',
  'GEM_PATH' => '/path/to/.rvm/gems/ree/1.8.7' 
}

To get the accurate locations have a look at cat ~/.rvm/default

要获得准确的位置,请查看cat~ / .rvm / default

#3


21  

If your rvm version is recent on both development and production machines add this to your deploy.rb:

如果你的rvm版本是开发和生产机器上的最新版本,请将其添加到deploy.rb:

set :rvm_ruby_string, '1.9.2@yourapp' # you probably have this already
set :rvm_type, :user # this is the money config, it defaults to :system

#4


7  

See http://rvm.io/integration/capistrano/. "Integration via the rvm capistrano plugin" looks like a winner.

见http://rvm.io/integration/capistrano/。 “通过rvm capistrano插件集成”看起来像一个胜利者。

And http://rvm.io/deployment/

和http://rvm.io/deployment/

#1


10  

The rvm-capistrano gem is the best way to go.

rvm-capistrano宝石是最好的方式。

Link to the official detailed usage of that gem. From that I am guessing this will get the local version of Ruby:

链接到该gem的官方详细用法。从那以后我猜这将获得本地版本的Ruby:

set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system

#2


36  

You have two options:

你有两个选择:

  1. Enable .ssh environment variables using the PermitUserEnvironment option in your ssh configuration file
  2. 使用ssh配置文件中的PermitUserEnvironment选项启用.ssh环境变量
  3. Use the capistrano :default_environment setting
  4. 使用capistrano:default_environment设置

For the second option, simply add the following line in your deploy.rb file

对于第二个选项,只需在deploy.rb文件中添加以下行

set :default_environment, { 
  'PATH' => "/path/to/.rvm/ree-1.8.7-2009.10/bin:/path/to/.rvm/gems/ree/1.8.7/bin:/path/to/.rvm/bin:$PATH",
  'RUBY_VERSION' => 'ruby 1.8.7',
  'GEM_HOME' => '/path/to/.rvm/gems/ree/1.8.7',
  'GEM_PATH' => '/path/to/.rvm/gems/ree/1.8.7' 
}

To get the accurate locations have a look at cat ~/.rvm/default

要获得准确的位置,请查看cat~ / .rvm / default

#3


21  

If your rvm version is recent on both development and production machines add this to your deploy.rb:

如果你的rvm版本是开发和生产机器上的最新版本,请将其添加到deploy.rb:

set :rvm_ruby_string, '1.9.2@yourapp' # you probably have this already
set :rvm_type, :user # this is the money config, it defaults to :system

#4


7  

See http://rvm.io/integration/capistrano/. "Integration via the rvm capistrano plugin" looks like a winner.

见http://rvm.io/integration/capistrano/。 “通过rvm capistrano插件集成”看起来像一个胜利者。

And http://rvm.io/deployment/

和http://rvm.io/deployment/