1
votes

Today (I don't know why!!!!) I cannot deploy my project with capistrano.

When I launch this task

namespace :deploy do

  # Theme path
  set :theme_path, Pathname.new('web/app/themes').join(fetch(:theme_name))

  # Local Paths
  set :local_theme_path, Pathname.new(File.dirname(__FILE__)).join('../').join(fetch(:theme_path))
  set :local_dist_path, fetch(:local_theme_path).join('dist')

  task :compile do
    run_locally do
      within fetch(:local_theme_path) do
        execute "git checkout #{fetch(:branch)}"
        execute :gulp, '--production'
      end
    end
  end

  task :copy do
    on roles(:web) do

      # Remote Paths (Lazy-load until actual deploy)
      set :remote_dist_path, -> { release_path.join(fetch(:theme_path)).join('dist') }

      info " Your local distribution path: #{fetch(:local_dist_path)} "
      info " Boom!!! Your remote distribution path: #{fetch(:remote_dist_path)} "
      info " Uploading files to remote "
      upload! fetch(:local_dist_path).to_s, fetch(:remote_dist_path), recursive: true
    end
  end

  task assets: %w(compile copy)
end

Capistrano print this error

(Backtrace restricted to imported tasks)

cap aborted!

SSHKit::Runner::ExecuteError: Exception while executing as ec2->user@*********: undefined method `start_with?' for #Pathname:0x0000*fc***a****

Caused by:

NoMethodError: undefined method `start_with?' for #Pathname:0x0000*fc***a****

I try all: uninstall node, ruby, etc... ma nothing change. Someone can help me?

Thanks

1
What did you change recently? Something related to paths, I'm sure. - Sergio Tulentsev
On my server ruby -v = ruby 2.0.0p648 (2015-12-16) [x86_64-linux] - mikmprdd
I do only some "gem updates"... - mikmprdd
Did you update the capistrano itself? Guess it doesn't stringifies its pathnames anymore. Try adding .to_s on the pathnames. - Sergio Tulentsev
Yep!!! It works! But until yesterday everything worked without it! - mikmprdd

1 Answers

3
votes
upload! fetch(:local_dist_path).to_s, fetch(:remote_dist_path), recursive: true

should be

upload! fetch(:local_dist_path).to_s, fetch(:remote_dist_path).to_s, recursive: true

(call to_s on both Pathnames.)