title: Why are Moonshine/Capistrano having SFTP trouble during deploy:setup?
body: <p>I'm having trouble setting up a new server using Moonshine and Capistrano. It seems to get started pretty well, installs a bunch of Ubuntu packages, compiles REE, installs some gems, but then it fails to upload a file via SFTP with this output:</p>
  
  <pre><code>  * executing `moonshine:setup_directories'
    * executing "mkdir /tmp/moonshine"
      servers: ["myserver.tld"]
      [myserver.tld] executing command
      command finished
      servers: ["myserver.tld"]
   ** sftp upload /Users/arussell/Sites/mysite/config/moonshine/production.yml -&gt; /tmp/moonshine/production.yml
  /Users/arussell/.rvm/gems/ree-1.8.7-2011.03/gems/capistrano-2.5.19/lib/capistrano/transfer.rb:196:in `normalize': undefined method `pos' for #&lt;Pathname:0x10f3a6988&gt; (NoMethodError)
      from /Users/arussell/.rvm/gems/ree-1.8.7-2011.03/gems/capistrano-2.5.19/lib/capistrano/transfer.rb:104:in `prepare_transfers'
  </code></pre>
  
  <p>Googling that error isn't really turning much up, all I can figure out is that capistrano/transfer.rb is expecting something other than a PathName object on line 196, but I'm not sure what it's expecting, nor am I sure why it's being fed a PathName object.</p>
  
  <hr>
  
  <p><strong>Edit:</strong> Here is my deploy.rb:</p>
  
  <pre><code>set :stages, %w(staging production dev)
  set :default_stage, "staging"
  require 'capistrano/ext/multistage' rescue "YOU NEED TO INSTALL THE capistrano-ext GEM"
  require 'fileutils'
  
  if ENV['branch']
    set :branch, ENV['branch']
  end
  
  set :deploy_via, :remote_cache
  
  before "deploy:restart", "deploy:delete_cache"
  
  namespace(:deploy) do
    desc "delete cache"
    task :delete_cache do
      run "rm -rf /usr/local/shared/cache/"
    end
    task :null, :roles =&gt; :app do
      run "date"
    end
  end
  require './config/boot'
  </code></pre>
  
  <p>... and my deploy/production.rb:</p>
  
  <pre><code>server "myserver.tld", :app, :web, :db, :primary =&gt; true
  
  set :rails_env, 'production'
  </code></pre>
  
  <hr>
  
  <p><strong>Edit 2:</strong> I tried using SCP instead of SFTP, but that didn't go any better. I added this to my deploy/production.rb:</p>
  
  <pre><code>upload "local", "remote", :via =&gt; :scp
  download "remote", "local", :via =&gt; :scp
  </code></pre>
  
  <p>and got this error instead while trying to deploy:</p>
  
  <pre><code>upload via scp failed on myserver.tld: SCP did not finish successfully () (SCP did not finish successfully ())
  </code></pre>