Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find task after :updating #57

Open
sjf-control opened this issue Oct 14, 2020 · 1 comment
Open

Can't find task after :updating #57

sjf-control opened this issue Oct 14, 2020 · 1 comment
Labels

Comments

@sjf-control
Copy link

sjf-control commented Oct 14, 2020

Below is the contents of lib/capistrano/tasks/load_seeds.rake.
If I change the 'after :updating' line to 'before :updating', the task is executed at the proper time. If run as shown, it generates "Task: load_seeds not found". See the dump below task listing.

Sure would like to know what the problem is. Thanks!
Capistrano Version: 3.11.2 (Rake Version: 12.3.3)

namespace :deploy do
  namespace :check do
    desc "Execute rake db:seed"
    after :updating, :load_seeds do
      on roles(:app), in: :sequence do
        puts "\n=== Seeding Database ===\n"
#     execute :rake, 'db:seed'
      end
    end
  end
end
cap aborted!
ArgumentError: Task :load_seeds not found
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/dsl/task_enhancements.rb:15:in `block in after'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `block in execute'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `each'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `execute'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/airbrussh-1.4.0/lib/airbrussh/rake/context.rb:61:in `execute'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:183:in `invoke'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/dsl.rb:26:in `invoke'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/tasks/framework.rake:64:in `block (2 levels) in <top (required)>'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/tasks/framework.rake:63:in `each'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/tasks/framework.rake:63:in `block in <top (required)>'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `block in execute'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `each'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `execute'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/airbrussh-1.4.0/lib/airbrussh/rake/context.rb:61:in `execute'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:183:in `invoke'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:160:in `invoke_task'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `each'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block in top_level'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:110:in `top_level'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:83:in `block in run'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:80:in `run'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/lib/capistrano/application.rb:14:in `run'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/capistrano-3.11.2/bin/cap:3:in `<top (required)>'
/Users/sjf/.rbenv/versions/2.6.2/bin/cap:23:in `load'
/Users/sjf/.rbenv/versions/2.6.2/bin/cap:23:in `<top (required)>'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/cli/exec.rb:74:in `load'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/cli/exec.rb:74:in `kernel_load'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/cli/exec.rb:28:in `run'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/cli.rb:463:in `exec'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/cli.rb:27:in `dispatch'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/cli.rb:18:in `start'
/Users/sjf/.rbenv/versions/2.6.2/bin/bundle:30:in `block in <main>'
/Users/sjf/.rbenv/versions/2.6.2/lib/ruby/site_ruby/2.6.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/Users/sjf/.rbenv/versions/2.6.2/bin/bundle:22:in `<main>'
Tasks: TOP => deploy:updating
The deploy has failed with an error: Task :load_seeds not found
** Invoke deploy:failed (first_time)
** Execute deploy:failed


@ikari7789
Copy link
Collaborator

You haven't defined any task.

You'd want to write something like this:

namespace :deploy do
  desc 'Execute artisan db:seed'
  task :load_seeds do
    Rake::Task['laravel:artisan'].invoke('db:seed')
  end

  after 'deploy:updating', 'deploy:load_seeds'
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants