Sha256: d8b9ec6f664791f6cc35f3328544c9989784134c39887c1b4e942e60df2ecbf5

Contents?: true

Size: 1.5 KB

Versions: 36

Compression:

Stored size: 1.5 KB

Contents

require 'capistrano/transfer'

module Capistrano
  class Configuration
    module Actions
      module FileTransfer

        # Store the given data at the given location on all servers targetted
        # by the current task. If <tt>:mode</tt> is specified it is used to
        # set the mode on the file.
        def put(data, path, options={})
          opts = options.dup
          upload(StringIO.new(data), path, opts)
        end
    
        # Get file remote_path from FIRST server targeted by
        # the current task and transfer it to local machine as path.
        #
        # get "#{deploy_to}/current/log/production.log", "log/production.log.web"
        def get(remote_path, path, options={}, &block)
          download(remote_path, path, options.merge(:once => true), &block)
        end

        def upload(from, to, options={}, &block)
          mode = options.delete(:mode)
          transfer(:up, from, to, options, &block)
          if mode
            mode = mode.is_a?(Numeric) ? mode.to_s(8) : mode.to_s
            run "chmod #{mode} #{to}"
          end
        end

        def download(from, to, options={}, &block)
          transfer(:down, from, to, options, &block)
        end

        def transfer(direction, from, to, options={}, &block)
          execute_on_servers(options) do |servers|
            targets = servers.map { |s| sessions[s] }
            Transfer.process(direction, from, to, targets, options.merge(:logger => logger), &block)
          end
        end

      end
    end
  end
end

Version data entries

36 entries across 36 versions & 8 rubygems

Version Path
wulffeld-capistrano-2.5.8.3 lib/capistrano/configuration/actions/file_transfer.rb
dan-capistrano-2.5.6 lib/capistrano/configuration/actions/file_transfer.rb
fotonauts-capistrano-2.5.2 lib/capistrano/configuration/actions/file_transfer.rb
mbailey-capistrano-2.5.5 lib/capistrano/configuration/actions/file_transfer.rb
mbailey-capistrano-2.5.6 lib/capistrano/configuration/actions/file_transfer.rb
mbailey-capistrano-2.5.7 lib/capistrano/configuration/actions/file_transfer.rb
sneakin-capistrano-2.5.5 lib/capistrano/configuration/actions/file_transfer.rb
thoughtbot-capistrano-2.5.5 lib/capistrano/configuration/actions/file_transfer.rb
thoughtbot-capistrano-2.5.6 lib/capistrano/configuration/actions/file_transfer.rb
wulffeld-capistrano-2.5.8.1 lib/capistrano/configuration/actions/file_transfer.rb
wulffeld-capistrano-2.5.8 lib/capistrano/configuration/actions/file_transfer.rb
wulffeld-capistrano-2.5.8.2 lib/capistrano/configuration/actions/file_transfer.rb
capistrano-2.5.18 lib/capistrano/configuration/actions/file_transfer.rb
capistrano-2.5.17 lib/capistrano/configuration/actions/file_transfer.rb
capistrano-2.5.16 lib/capistrano/configuration/actions/file_transfer.rb
capistrano-2.5.15 lib/capistrano/configuration/actions/file_transfer.rb
capistrano-2.5.14 lib/capistrano/configuration/actions/file_transfer.rb
capistrano-2.5.13 lib/capistrano/configuration/actions/file_transfer.rb
capistrano-2.5.12 lib/capistrano/configuration/actions/file_transfer.rb
capistrano-2.5.11 lib/capistrano/configuration/actions/file_transfer.rb