Ruby 3.2.0 - undefined method `exists?' for Dir:Class
harshalbhakta opened this issue · 0 comments
harshalbhakta commented
I got below error while executing bundle exec cap production deploy --trace
using Ruby 3.2.0.
** Invoke deploy:assets:rsync (first_time)
** Execute deploy:assets:rsync
#<Thread:0x000000010b98a1f0 /Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as harshal@x.x.x.x: undefined method `exists?' for Dir:Class (SSHKit::Runner::ExecuteError)
from /Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/capistrano-local-precompile-1.2.0/lib/capistrano/local_precompile.rb:42:in `block (5 levels) in <top (required)>': undefined method `exists?' for Dir:Class (NoMethodError)
commands << "#{fetch(:rsync_cmd)} #{remote_shell} ./#{fetch(:assets_dir)}/ #{server.user}@#{server.hostname}:#{release_path}/#{fetch(:assets_dir)}/" if Dir.exists?(fetch(:assets_dir))
^^^^^^^^
Did you mean? exist?
from /Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
from /Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `run'
from /Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/capistrano-3.17.1/lib/capistrano/dsl.rb:76:in `run_locally'
from /Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/capistrano-local-precompile-1.2.0/lib/capistrano/local_precompile.rb:38:in `block (4 levels) in <top (required)>'
from /Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
from /Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `run'
from /Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as harshal@x.x.x.x: undefined method `exists?' for Dir:Class
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
Caused by:
NoMethodError: undefined method `exists?' for Dir:Class
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/capistrano-local-precompile-1.2.0/lib/capistrano/local_precompile.rb:42:in `block (5 levels) in <top (required)>'
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `run'
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/capistrano-3.17.1/lib/capistrano/dsl.rb:76:in `run_locally'
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/capistrano-local-precompile-1.2.0/lib/capistrano/local_precompile.rb:38:in `block (4 levels) in <top (required)>'
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `run'
/Users/harshal/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/sshkit-1.21.3/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:assets:rsync
The deploy has failed with an error: Exception while executing as harshal@x.x.x.x: undefined method `exists?' for Dir:Class
** Invoke deploy:failed (first_time)
** Execute deploy:failed
** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:
Dir.exists?
has been deprecated in Ruby 3.2.0