本文介绍了Capistrano没有要加载的此类文件-部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我尝试运行任何 cap
命令时,出现没有此类文件可加载-部署消息。错误。
When I try to run any cap
commands, I get a "no such file to load -- deploy" error.
以下是输出:
Tylers-MacBook-Pro:cap_app Tyler$ cap -T
/Users/Tyler/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- deploy (LoadError)
from /Users/Tyler/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/configuration/loading.rb:152:in `require'
from Capfile:1:in `load'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/configuration/loading.rb:93:in `load'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/configuration/loading.rb:89:in `load'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/configuration/loading.rb:86:in `each'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/configuration/loading.rb:86:in `load'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/cli/execute.rb:65:in `block in load_recipes'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/cli/execute.rb:65:in `each'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/cli/execute.rb:65:in `load_recipes'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/cli/execute.rb:31:in `execute!'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/lib/capistrano/cli/execute.rb:14:in `execute'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/gems/capistrano-2.11.0/bin/cap:4:in `<top (required)>'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/bin/cap:19:in `load'
from /Users/Tyler/.rvm/gems/ruby-1.9.2-p290/bin/cap:19:in `<main>'
以下是Gemfile:
Here is the Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'capistrano'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
config / deploy.rb
config/deploy.rb
require 'bundler/capistrano'
set :application, "CapistranoApp"
set :repository, "ssh://ubuntu@weaponxo.com/~/projectdir.git"
set :applicationdir, "/var/www/#{application}"
set :domain, "ror.weaponxo.com"
set :scm, :git
set :branch, "master"
set :git_shallow_clone, 1
set :scm_verbose, true
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
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
set :deploy_to, applicationdir
set :deploy_via, :remote_cache
# 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:
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
Capfile:
require '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
要求'部署'的引用。
我搞砸了什么?
谢谢
将Capfile的第一行更改为
Changing the first line of the Capfile to
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
可以加载'deploy'。知道为什么默认情况下,Capfile会带有此损坏的内容吗?行吗?我是否需要做不同于 capify的事情。
?
works. Any idea why the Capfile ships by default with this "broken" line in it? Do I need to do something different than capify .
?
推荐答案
尝试:
load 'deploy'
(假设您使用的是capistrano 2)。
(Assuming you're using capistrano 2).
我们的capfile如下:
Our capfile looks like this:
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
# 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
这篇关于Capistrano没有要加载的此类文件-部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!