【问题标题】:Capistrano, Bundle Pathing IssueCapistrano,捆绑路径问题
【发布时间】:2010-12-20 05:41:17
【问题描述】:

抱歉,标题太长了 :)。有一些 Capistrano 问题(尽管问题可能在于捆绑程序)。尝试将 Rails 3 应用程序部署到 Linode (Ubuntu 10.04 LTS)。我认为这可能是 RVM 问题,但在服务器上使用 RVM 时我仍然遇到问题。

这是我在运行“cap deploy:update”时遇到的错误(设置和检查运行正常)

  * executing "bundle install --gemfile /home/deploy/rails_apps/deed/releases/20101220040406/Gemfile --path /home/deploy/rails_apps/deed/shared/bundle --deployment --quiet --without development test"
    servers: ["myserver"]
    [myserver] executing command
 ** [out :: myserver] The path `/home/deploy/Documents/Rails_Projects/deed/vendor/gems` does not exist.
    command finished

这是我的 deploy.rb

require 'bundler/capistrano'

set :domain, "mydomain"

set :application, "deed"
set :repository,  "deploy@#{domain}:~/deed.git"

set :scm, :git

# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :user, "deploy"
set :deploy_to, "/home/deploy/rails_apps/#{application}"
role :web, domain                          # Your HTTP server, Apache/etc
role :app, domain                          # This may be the same as your `Web` server
role :db,  domain, :primary => true # This is where Rails migrations will run

# If you are using Passenger mod_rails uncomment this:
# if you're still using the script/reapear helper you will need
# these http://github.com/rails/irs_process_scripts
default_run_options[:pty] = true  # Must be set for the password prompt from git to work

set :default_environment, { 
  'PATH' => "/opt/ruby-enterprise-1.8.7-2010.02/bin:$PATH",
  'RUBY_VERSION' => 'ruby 1.8.7',
  'GEM_HOME' => '/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/',
  'GEM_PATH' => '/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/',
  'BUNDLE_PATH' => '/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/'
}

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end
end

【问题讨论】:

    标签: ruby-on-rails ruby capistrano bundler


    【解决方案1】:

    我是否应该在我的应用程序中覆盖该设计控制器,而不是在本地引用它然后对其进行编辑?

    是的,当然。查看 Devise 附带的生成器,专门用于视图和控制器:http://rubydoc.info/github/plataformatec/devise/master/file/README.rdoc#Configuring_views。您需要创建一个 users_controller 并在其中覆盖设计的功能。

    【讨论】:

      【解决方案2】:

      问题是我有

      gem 'devise', :path => '~/Documents/Rails_Projects/deed/vendor/gems'
      

      在我的 Gemfile 中,因为我想在用户创建后更改 Devise 重定向的位置,所以我只是编辑了 gem。删除 Gemfile 中的硬编码路径解决了这个问题,但我找不到可行的路径。

      我是否应该在我的应用程序中覆盖该设计控制器,而不是在本地引用它然后对其进行编辑?

      【讨论】:

        猜你喜欢
        • 2011-11-10
        • 2011-06-24
        • 1970-01-01
        • 2015-08-15
        • 1970-01-01
        • 2011-03-30
        • 2016-03-05
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多