首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Capistrano ( Rails )中未定义的方法“命名空间”

Capistrano ( Rails )中未定义的方法“命名空间”
EN

Stack Overflow用户
提问于 2015-02-28 08:41:21
回答 1查看 803关注 0票数 0

这是我第一次在DigitalOcean中部署rails应用程序,但我在部署应用程序时遇到了问题。当我试图运行cap production deploybundle exec cap deploy:setup时,我得到了以下错误:

代码语言:javascript
运行
复制
/usr/local/rvm/gems/ruby-2.2.0/gems/capistrano-bundler-1.1.4/lib/capistrano/tasks/bundler.cap:1:in `<top (required)>': undefined method `namespace' for main:Object (NoMethodError)

这是我的deploy.rb

代码语言:javascript
运行
复制
set :application, "myapp.com"
set :repository,  "git@heroku.com:myapp.git"

set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :user, 'user'
set :use_sudo, false
set :deploy_to, "/home/user/video-benta"
set :deploy_via, :remote_cache

role :web, "myapp.com"                          # Your HTTP server, Apache/etc
role :app, "myapp.com"                          # This may be the same as your `Web` server
role :db,  "myapp", :primary => true # This is where Rails migrations will run
#role :db,  "your slave db-server here"

# if you want to clean up old releases on each deploy uncomment this:
# after "deploy:restart", "deploy:cleanup"

# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts

# If you are using Passenger mod_rails uncomment this:
after "deploy", "deploy:bundle_gems"
after "deploy:bundle_gems", "deploy:restart"

 namespace :deploy do
   task :bundle_gems do
        run "cd #{deploy_to}/current && bundle install vendor/gems"
   end
   task :start do ; end
   task :stop do ; end
   task :restart, :roles => :app, :except => { :no_release => true } do
     run "touch #{File.join(current_path,'tmp','restart.txt')}"
   end
 end

Capfile (更新)

代码语言:javascript
运行
复制
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
    # load 'deploy/assets'
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
require 'capistrano/bundler'
require 'capistrano/rails'

# If you are using rvm add these lines:
require 'capistrano/rvm'
 set :rvm_type, :user
 set :rvm_ruby_version, '2.2.0p0'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-02-28 09:15:32

您正在尝试使用与Capistrano版本不兼容的不同的Capistrano扩展。您的Capistrano版本是2.x (根据Capfile的格式检测到的),但是capistrano/bundler是Capistrano 3.x的扩展。

只要使用Capistrano 3(如果可能的话)和兼容的扩展。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28779784

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档