gpt4 book ai didi

ruby-on-rails - 如何构建任务 'deploy:migrations'

转载 作者:行者123 更新时间:2023-12-04 06:34:59 25 4
gpt4 key购买 nike

我正在尝试通过迁移执行 Capistrano 部署,但出现以下错误:

cap aborted!
Don't know how to build task 'deploy:migrations'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/lib/capistrano/application.rb:15:in `run'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/bin/cap:3:in `<top (required)>'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/bin/cap:23:in `load'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/bin/cap:23:in `<main>'
(See full trace by running task with --trace)

gem 文件:
# Use Capistrano to deploy on production server
group :development do
gem 'capistrano', '~> 3.2.0'
gem 'capistrano-rails'
gem 'capistrano-bundler'
gem 'capistrano-rvm'
end

部署.rb:
# config valid only for Capistrano 3.1
lock '3.2.1'

set :application, 'someapp'

set :scm, :git
set :repo_url, 'somerepo'

# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call

# Default deploy_to directory is /var/www/my_app
# set :deploy_to, '/var/www/my_app'

# Default value for :scm is :git
# set :scm, :git

# Default value for :format is :pretty
# set :format, :pretty

# Default value for :log_level is :debug
# set :log_level, :debug

# Default value for :pty is false
# set :pty, true

# Default value for :linked_files is []
# set :linked_files, %w{config/database.yml}

# Default value for linked_dirs is []
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for keep_releases is 5
# set :keep_releases, 5

namespace :deploy do

desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
execute :touch, release_path.join('tmp/restart.txt')
end
end

after :publishing, :restart
end

capfile.rb:
# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'

# Includes tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
# https://github.com/capistrano/rvm
# https://github.com/capistrano/rbenv
# https://github.com/capistrano/chruby
# https://github.com/capistrano/bundler
# https://github.com/capistrano/rails
#
require 'capistrano/rvm'
# require 'capistrano/rbenv'
# require 'capistrano/chruby'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

如果我执行“上限生产部署”,那么一切正常。我该如何解决?

最佳答案

确实没有这样的任务了。当您运行时 deploy任务,它将已经运行迁移。

关于ruby-on-rails - 如何构建任务 'deploy:migrations',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23950314/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com