Sha256: bd65ff790a105f6cfe864165fdb20494be9043a4123be370323b614c1b305932

Contents?: true

Size: 1.2 KB

Versions: 218

Compression:

Stored size: 1.2 KB

Contents

require 'rake/dsl_definition'
require 'rake/contrib/compositepublisher'

module Rake

  # Publish an entire directory to an existing remote directory using
  # SSH.
  class SshDirPublisher
    include Rake::DSL

    def initialize(host, remote_dir, local_dir)
      @host = host
      @remote_dir = remote_dir
      @local_dir = local_dir
    end

    def upload
      sh %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
    end
  end

  # Publish an entire directory to a fresh remote directory using SSH.
  class SshFreshDirPublisher < SshDirPublisher
    def upload
      sh %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
      sh %{ssh #{@host} mkdir #{@remote_dir}}
      super
    end
  end

  # Publish a list of files to an existing remote directory.
  class SshFilePublisher
    include Rake::DSL

    # Create a publisher using the give host information.
    def initialize(host, remote_dir, local_dir, *files)
      @host = host
      @remote_dir = remote_dir
      @local_dir = local_dir
      @files = files
    end

    # Upload the local directory to the remote directory.
    def upload
      @files.each do |fn|
        sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
      end
    end
  end
end

Version data entries

218 entries across 184 versions & 48 rubygems

Version Path
plyom_user-0.0.6 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
plyom_user-0.0.5 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
plyom_user-0.0.4 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
plyom_user-0.0.3 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
plyom_user-0.0.2 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
rake-10.1.1 lib/rake/contrib/sshpublisher.rb
social_url_stats-0.0.1 vendor/ruby/1.9.1/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
bundle_depot-0.2.2 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
bundle_depot-0.2.1 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
bundle_depot-0.2.0 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
bundle_depot-0.0.3 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
bundle_depot-0.0.2 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
bundle_depot-0.0.1 fixtures/bundle/rake/4c3a94088cd7bd0ac6b190c7f40a19c809356cda7fbd7dd8860ed3155b8e5c3d/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
clickable_link-0.0.2 vendor/bundle/ruby/1.9.1/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb
candlepin-api-0.4.0 bundle/ruby/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb