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
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/rake-0.9.6/lib/rake/contrib/sshpublisher.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/rake-0.9.6/lib/rake/contrib/sshpublisher.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/contrib/sshpublisher.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rake-10.0.3/lib/rake/contrib/sshpublisher.rb
gss-0.0.7 vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb
gss-0.0.6 vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb
gss-0.0.5 vendor/bundle/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/contrib/sshpublisher.rb
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
sadui-0.0.4 vendor/bundle/ruby/2.1.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
sadui-0.0.4 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
plyom_user-0.3.1 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
plyom_user-0.3.0 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
plyom_user-0.2.9 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
plyom_user-0.2.8 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/contrib/sshpublisher.rb
vtd_xml-0.0.3-java bundle/jruby/1.9/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
plyom_user-0.2.7 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb
plyom_user-0.2.6 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb