Hello community,
here is the log from the commit of package rubygem-net-scp for openSUSE:Factory checked in at 2019-04-01 12:36:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-net-scp (Old)
and /work/SRC/openSUSE:Factory/.rubygem-net-scp.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-net-scp"
Mon Apr 1 12:36:36 2019 rev:11 rq:689703 version:2.0.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-net-scp/rubygem-net-scp.changes 2014-10-14 07:10:55.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-net-scp.new.25356/rubygem-net-scp.changes 2019-04-01 12:36:46.413868337 +0200
@@ -1,0 +2,10 @@
+Fri Mar 29 06:07:13 UTC 2019 - Stephan Kulow
+
+- updated to version 2.0.0
+ see installed CHANGES.txt
+
+ === 2.0.0
+
+ * NetSSH 5.* support
+
+-------------------------------------------------------------------
Old:
----
net-scp-1.2.1.gem
New:
----
gem2rpm.yml
net-scp-2.0.0.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-net-scp.spec ++++++
--- /var/tmp/diff_new_pack.6IPVLC/_old 2019-04-01 12:36:49.369869783 +0200
+++ /var/tmp/diff_new_pack.6IPVLC/_new 2019-04-01 12:36:49.373869785 +0200
@@ -1,7 +1,7 @@
#
# spec file for package rubygem-net-scp
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -12,12 +12,19 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
+#
+# This file was generated with a gem2rpm.yml and not just plain gem2rpm.
+# All sections marked as MANUAL, license headers, summaries and descriptions
+# can be maintained in that file. Please consult this file before editing any
+# of those fields
+#
+
Name: rubygem-net-scp
-Version: 1.2.1
+Version: 2.0.0
Release: 0
%define mod_name net-scp
%define mod_full_name %{mod_name}-%{version}
@@ -26,7 +33,8 @@
BuildRequires: %{ruby}
BuildRequires: ruby-macros >= 5
Url: https://github.com/net-ssh/net-scp
-Source: http://rubygems.org/gems/%{mod_full_name}.gem
+Source: https://rubygems.org/gems/%{mod_full_name}.gem
+Source1: gem2rpm.yml
Summary: A pure Ruby implementation of the SCP client protocol
License: MIT
Group: Development/Languages/Ruby
++++++ gem2rpm.yml ++++++
# ---
# ## used by gem2rpm
# :summary: this is a custom summary
# ## used by gem2rpm
# :description: |-
# this is a custom description
#
# it can be multiline
# ## used by gem2rpm
# :license: MIT or Ruby
# ## used by gem2rpm and gem_packages
# :version_suffix: -x_y
# ## used by gem2rpm and gem_packages
# :disable_docs: true
# ## used by gem2rpm
# :disable_automatic_rdoc_dep: true
# ## used by gem2rpm
# :preamble: |-
# BuildRequires: foobar
# Requires: foobar
# ## used by gem2rpm
# :patches:
# foo.patch: -p1
# bar.patch:
# :post_patch:
# if you need to fiddle with the source dir before rebuilding the gem
# ## used by gem2rpm
:sources:
# - foo.desktop
# - bar.desktop
# :gem_install_args: '....'
# ## used by gem2rpm
# :pre_install: |-
# %if 0%{?use_system_libev}
# export USE_VENDORED_LIBEV="no"
# %endif
# ## used by gem2rpm
# :post_install: |-
# # delete custom files here or do other fancy stuff
# install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse
# ## used by gem2rpm
# :testsuite_command: |-
# (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test)
# ## used by gem2rpm
# :filelist: |-
# /usr/bin/gem2rpm-opensuse
# ## used by gem2rpm
# :scripts:
# :post: |-
# /bin/echo foo
# ## used by gem_packages
# :main:
# :preamble: |-
# Requires: util-linux
# Recommends: pwgen
# :filelist: |-
# /usr/bin/gem2rpm-opensuse
# ## used by gem_packages
# :custom_pkgs:
# apache:
# :preamble: |-
# Requires: .....
# :filelist: |-
# /etc/apache2/conf.d/passenger.conf
# :summary: Custom summary is optional
# :description: |-
# Custom description is optional
#
# bar
# :post: |-
# /bin/echo foo
# :preamble: |-
# %if 0%{?suse_version} && 0%{?suse_version} < 1330
# %define rb_build_versions ruby24 ruby25
# %define rb_default_ruby_abi ruby:2.4.0 ruby:2.5.0
# %endif
++++++ net-scp-1.2.1.gem -> net-scp-2.0.0.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/.gitignore 2019-03-20 12:25:00.000000000 +0100
@@ -0,0 +1,6 @@
+coverage
+pkg
+doc
+*.swp
+
+.DS_Store
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml 1970-01-01 01:00:00.000000000 +0100
+++ new/.travis.yml 2019-03-20 12:25:00.000000000 +0100
@@ -1,11 +1,16 @@
language: ruby
+cache: bundler
rvm:
- - "1.9.3"
- - "2.0.0"
- - "2.1.0"
+ - 2.3.8
+ - 2.4.5
+ - 2.5.3
+ - 2.6.1
+ - ruby-head
+matrix:
+ allow_failures:
+ - rvm: ruby-head
install: gem install jeweler test-unit mocha net-ssh
script: rake test
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGES.txt new/CHANGES.txt
--- old/CHANGES.txt 1970-01-01 01:00:00.000000000 +0100
+++ new/CHANGES.txt 2019-03-20 12:25:00.000000000 +0100
@@ -1,3 +1,6 @@
+=== 2.0.0
+
+* NetSSH 5.* support
=== 1.2.1 / 30 Apr 2014
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile
--- old/Gemfile 1970-01-01 01:00:00.000000000 +0100
+++ new/Gemfile 2019-03-20 12:25:00.000000000 +0100
@@ -0,0 +1,15 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in mygem.gemspec
+gemspec
+
+# TODO: add to gemspec
+gem "bundler", "~> 1.11"
+gem "rake", "~> 12.0"
+
+gem 'byebug', group: %i[development test] if !Gem.win_platform? && RUBY_ENGINE == "ruby"
+
+if ENV["CI"]
+ gem 'codecov', require: false, group: :test
+ gem 'simplecov', require: false, group: :test
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.rdoc new/README.rdoc
--- old/README.rdoc 1970-01-01 01:00:00.000000000 +0100
+++ new/README.rdoc 2019-03-20 12:25:00.000000000 +0100
@@ -13,7 +13,7 @@
== DESCRIPTION:
-Net::SCP is a pure-Ruby implementation of the SCP protocol. This operates over SSH (and requires the Net::SSH library), and allows files and directory trees to copied to and from a remote server.
+Net::SCP is a pure-Ruby implementation of the SCP protocol. This operates over SSH (and requires the Net::SSH library), and allows files and directory trees to be copied to and from a remote server.
== FEATURES/PROBLEMS:
@@ -42,7 +42,7 @@
data = Net::SCP::download!("remote.host.com", "username", "/remote/path")
# use a persistent connection to transfer files
- Net::SCP.start("remote.host.com", "username", :ssh => { :password => "password" }) do |scp|
+ Net::SCP.start("remote.host.com", "username", :password => "password") do |scp|
# upload a file to a remote server
scp.upload! "/local/path", "/remote/path"
@@ -74,12 +74,12 @@
* gem install net-scp (might need sudo privileges)
-However, in order to be sure the code you're installing hasn't been tampered with, it's recommended that you verify the signiture[http://docs.rubygems.org/read/chapter/21]. To do this, you need to add my public key as a trusted certificate (you only need to do this once):
+However, in order to be sure the code you're installing hasn't been tampered with, it's recommended that you verify the signiture[http://docs.seattlerb.org/rubygems/Gem/Security.html]. To do this, you need to add my public key as a trusted certificate (you only need to do this once):
# Add the public key as a trusted certificate
# (You only need to do this once)
- $ curl -O https://raw.github.com/net-ssh/net-ssh/master/gem-public_cert.pem
- $ gem cert --add gem-public_cert.pem
+ $ curl -O https://raw.githubusercontent.com/net-ssh/net-ssh/master/net-ssh-public_cert...
+ $ gem cert --add net-ssh-public_cert.pem
Then, when install the gem, do so with high security:
@@ -87,7 +87,6 @@
If you don't add the public key, you'll see an error like "Couldn't verify data signature". If you're still having trouble let me know and I'll give you a hand.
-
Or, you can do it the hard way (without Rubygems):
* tar xzf net-scp-*.tgz
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile
--- old/Rakefile 1970-01-01 01:00:00.000000000 +0100
+++ new/Rakefile 2019-03-20 12:25:00.000000000 +0100
@@ -2,40 +2,64 @@
require "rake"
require "rake/clean"
require "rdoc/task"
+require "bundler/gem_tasks"
-task :default => ["build"]
+desc "When releasing make sure NET_SSH_BUILDGEM_SIGNED is set"
+task :check_NET_SSH_BUILDGEM_SIGNED do
+ raise "NET_SSH_BUILDGEM_SIGNED should be set to release" unless ENV['NET_SSH_BUILDGEM_SIGNED']
+end
+
+Rake::Task[:release].enhance [:check_NET_SSH_BUILDGEM_SIGNED]
+Rake::Task[:release].prerequisites.unshift(:check_NET_SSH_BUILDGEM_SIGNED)
+
+task default: ["build"]
CLEAN.include [ 'pkg', 'rdoc' ]
name = "net-scp"
-$:.unshift File.join(File.dirname(__FILE__), 'lib')
-require "net/scp/version"
-version = Net::SCP::Version::STRING.dup
-
-begin
- require "jeweler"
- Jeweler::Tasks.new do |s|
- s.version = version
- s.name = name
- s.rubyforge_project = s.name
- s.summary = "A pure Ruby implementation of the SCP client protocol"
- s.description = s.summary
- s.email = "net-ssh@solutious.com"
- s.homepage = "https://github.com/net-ssh/net-scp"
- s.authors = ["Jamis Buck", "Delano Mandelbaum"]
-
- s.add_dependency 'net-ssh', ">=2.6.5"
-
- s.add_development_dependency 'test-unit'
- s.add_development_dependency 'mocha'
+require_relative "lib/net/scp/version"
+version = Net::SCP::Version::CURRENT
- s.license = "MIT"
+namespace :cert do
+ desc "Update public cert from private - only run if public is expired"
+ task :update_public_when_expired do
+ require 'openssl'
+ require 'time'
+ raw = File.read "net-scp-public_cert.pem"
+ certificate = OpenSSL::X509::Certificate.new raw
+ raise Exception, "Not yet expired: #{certificate.not_after}" unless certificate.not_after < Time.now
+ sh "gem cert --build netssh@solutious.com --days 365*5 --private-key /mnt/gem/net-ssh-private_key.pem"
+ sh "mv gem-public_cert.pem net-scp-public_cert.pem"
+ sh "gem cert --add net-scp-public_cert.pem"
+ end
+end
- s.signing_key = File.join('/mnt/gem/', 'gem-private_key.pem')
- s.cert_chain = ['gem-public_cert.pem']
+if false
+ begin
+ require "jeweler"
+ Jeweler::Tasks.new do |s|
+ s.version = version
+ s.name = name
+ s.rubyforge_project = s.name
+ s.summary = "A pure Ruby implementation of the SCP client protocol"
+ s.description = s.summary
+ s.email = "net-ssh@solutious.com"
+ s.homepage = "https://github.com/net-ssh/net-scp"
+ s.authors = ["Jamis Buck", "Delano Mandelbaum"]
+
+ s.add_dependency 'net-ssh', ">=2.6.5"
+
+ s.add_development_dependency 'test-unit'
+ s.add_development_dependency 'mocha'
+
+ s.license = "MIT"
+
+ s.signing_key = File.join('/mnt/gem/', 'gem-private_key.pem')
+ s.cert_chain = ['gem-public_cert.pem']
+ end
+ Jeweler::GemcutterTasks.new
+ rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end
- Jeweler::GemcutterTasks.new
-rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end
require 'rake/testtask'
@@ -56,5 +80,3 @@
rdoc.rdoc_files.include(file) if File.exists?(file)
}
end
-
-
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
Binary files old/checksums.yaml.gz.sig and new/checksums.yaml.gz.sig differ
Binary files old/data.tar.gz.sig and new/data.tar.gz.sig differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gem-public_cert.pem new/gem-public_cert.pem
--- old/gem-public_cert.pem 1970-01-01 01:00:00.000000000 +0100
+++ new/gem-public_cert.pem 1970-01-01 01:00:00.000000000 +0100
@@ -1,20 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZkZWxh
-bm8xGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
-b20wHhcNMTQwNDMwMTczNjI2WhcNMTUwNDMwMTczNjI2WjBBMQ8wDQYDVQQDDAZk
-ZWxhbm8xGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
-FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdbeFjM67+Txrq
-+8HaD4wKEiacRoB8ps17Vzt9TBUyoMMj5KTtFiptr/+ZTug/YdYBquMprPsKlYM2
-NoG6BzvDcvQK1zrdHnyVosIDKAHk2wnyN/psZikS1bo9nUHCS5hJdPEnQZx/MxTZ
-+GjuRsiBxPYBXnqObLhR83LBeWsauWTuo5gJt1DYxDTVrLoB+Z+ceMV+3vh0HBCb
-iwegkx9GWG45h5wTksUIpzOMB3VsHGtGmBjCvdCgLJ2H6b8U9rmL7chunjdqfNf3
-zPtnH32c/zrFzeWJTyH2s8Ia+3D6vum2xjjn8FnLg3V4zOf5x598GFBJYDQv7zX/
-rV9eCzHDAgMBAAGjOTA3MAkGA1UdEwQCMAAwHQYDVR0OBBYEFA+Buc8ySEw2qKnq
-VH4wh8KAm6hUMAsGA1UdDwQEAwIEsDANBgkqhkiG9w0BAQUFAAOCAQEAYsM0M42h
-ZEUXvr/i18gkwHKLFDKDAcimgCoS5+syG6rkuSOnKGQolyKTNczNM4gWJJPH5aVq
-mW2BtqpIom4YRYb9m3fDNNs6kcB5DedY9UPhVvJ8XTTB2YLxLql7UJid9ZOiqWzC
-OTm06w7zkAT/ldt46p6BqyUy6PW4QMg0Bq7SMfRURVrp2lvhQvBdC7oDR9CGEBZC
-/Ci++ZEh/QR9qy11AHciEIXnNkytidyZtLr4MWhtbV468y6shpPYdKU/uCINSgvt
-FpMAM5Nit8L8nHwf3IIUPg7lsMCRzOkQ/FD87BI3V3SnFNoTCdGgnGj3jfW4zRlL
-iFyareFPA84btQ==
------END CERTIFICATE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/net/scp/download.rb new/lib/net/scp/download.rb
--- old/lib/net/scp/download.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/net/scp/download.rb 2019-03-20 12:25:00.000000000 +0100
@@ -20,7 +20,7 @@
elsif channel[:local].respond_to?(:write) && channel[:options][:preserve]
lwarn { ":preserve option is ignored when downloading to an in-memory buffer" }
channel[:options].delete(:preserve)
- elsif channel[:options][:recursive] && !File.exists?(channel[:local])
+ elsif channel[:options][:recursive] && !File.exist?(channel[:local])
Dir.mkdir(channel[:local])
end
@@ -128,9 +128,9 @@
channel[:local] = File.join(channel[:local], directive[:name])
- if File.exists?(channel[:local]) && !File.directory?(channel[:local])
- raise "#{channel[:local]} already exists and is not a directory"
- elsif !File.exists?(channel[:local])
+ if File.exist?(channel[:local]) && !File.directory?(channel[:local])
+ raise Net::SCP::Error, "#{channel[:local]} already exists and is not a directory"
+ elsif !File.exist?(channel[:local])
Dir.mkdir(channel[:local], directive[:mode] | 0700)
end
@@ -162,4 +162,4 @@
end
end
-end; end
\ No newline at end of file
+end; end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/net/scp/version.rb new/lib/net/scp/version.rb
--- old/lib/net/scp/version.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/net/scp/version.rb 2019-03-20 12:25:00.000000000 +0100
@@ -1,18 +1,68 @@
-require 'net/ssh/version'
+module Net
+ module SCP
+ # A class for describing the current version of a library. The version
+ # consists of three parts: the +major+ number, the +minor+ number, and the
+ # +tiny+ (or +patch+) number.
+ #
+ # Two Version instances may be compared, so that you can test that a version
+ # of a library is what you require:
+ #
+ # require 'net/scp/version'
+ #
+ # if Net::SCP::Version::CURRENT < Net::SCP::Version[2,1,0]
+ # abort "your software is too old!"
+ # end
+ class Version
+ include Comparable
-module Net; class SCP
+ # A convenience method for instantiating a new Version instance with the
+ # given +major+, +minor+, and +tiny+ components.
+ def self.[](major, minor, tiny, pre = nil)
+ new(major, minor, tiny, pre)
+ end
- # Describes the current version of the Net::SCP library.
- class Version < Net::SSH::Version
- MAJOR = 1
- MINOR = 2
- TINY = 1
+ attr_reader :major, :minor, :tiny
- # The current version, as a Version instance
- CURRENT = new(MAJOR, MINOR, TINY)
+ # Create a new Version object with the given components.
+ def initialize(major, minor, tiny, pre = nil)
+ @major, @minor, @tiny, @pre = major, minor, tiny, pre
+ end
- # The current version, as a String instance
- STRING = CURRENT.to_s
- end
+ # Compare this version to the given +version+ object.
+ def <=>(version)
+ to_i <=> version.to_i
+ end
+
+ # Converts this version object to a string, where each of the three
+ # version components are joined by the '.' character. E.g., 2.0.0.
+ def to_s
+ @to_s ||= [@major, @minor, @tiny, @pre].compact.join(".")
+ end
+
+ # Converts this version to a canonical integer that may be compared
+ # against other version objects.
+ def to_i
+ @to_i ||= @major * 1_000_000 + @minor * 1_000 + @tiny
+ end
+
+ # The major component of this version of the Net::SSH library
+ MAJOR = 2
+
+ # The minor component of this version of the Net::SSH library
+ MINOR = 0
-end; end
+ # The tiny component of this version of the Net::SSH library
+ TINY = 0
+
+ # The prerelease component of this version of the Net::SSH library
+ # nil allowed
+ PRE = nil
+
+ # The current version of the Net::SSH library as a Version instance
+ CURRENT = new(*[MAJOR, MINOR, TINY, PRE].compact)
+
+ # The current version of the Net::SSH library as a String
+ STRING = CURRENT.to_s
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/net/scp.rb new/lib/net/scp.rb
--- old/lib/net/scp.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/lib/net/scp.rb 2019-03-20 12:25:00.000000000 +0100
@@ -194,7 +194,7 @@
include Net::SSH::Loggable
include Upload, Download
- # Starts up a new SSH connection and instantiates a new SCP session on
+ # Starts up a new SSH connection and instantiates a new SCP session on
# top of it. If a block is given, the SCP session is yielded, and the
# SSH session is closed automatically when the block terminates. If no
# block is given, the SCP session is returned.
@@ -293,7 +293,7 @@
# * :preserve - the atime and mtime of the file should be preserved.
# * :verbose - the process should result in verbose output on the server
# end (useful for debugging).
- #
+ #
# This method will return immediately, returning the Net::SSH::Connection::Channel
# object that will support the download. To wait for the download to finish,
# you can either call the #wait method on the channel, or otherwise run
@@ -343,7 +343,7 @@
# (See Net::SCP::Upload and Net::SCP::Download).
def start_command(mode, local, remote, options={}, &callback)
session.open_channel do |channel|
-
+
if options[:shell]
escaped_file = shellescape(remote).gsub(/'/) { |m| "'\\''" }
command = "#{options[:shell]} -c '#{scp_command(mode, options)} #{escaped_file}'"
@@ -362,10 +362,10 @@
channel[:stack ] = []
channel[:error_string] = ''
- channel.on_close { |ch| send("#{channel[:state]}_state", channel); raise Net::SCP::Error, "SCP did not finish successfully (#{channel[:exit]}): #{channel[:error_string]}" if channel[:exit] != 0 }
- channel.on_data { |ch, data| channel[:buffer].append(data) }
- channel.on_extended_data { |ch, type, data| debug { data.chomp } }
- channel.on_request("exit-status") { |ch, data| channel[:exit] = data.read_long }
+ channel.on_close { |ch2| send("#{channel[:state]}_state", channel); raise Net::SCP::Error, "SCP did not finish successfully (#{channel[:exit]}): #{channel[:error_string]}" if channel[:exit] != 0 }
+ channel.on_data { |ch2, data| channel[:buffer].append(data) }
+ channel.on_extended_data { |ch2, type, data| debug { data.chomp } }
+ channel.on_request("exit-status") { |ch2, data| channel[:exit] = data.read_long }
channel.on_process { send("#{channel[:state]}_state", channel) }
else
channel.close
@@ -395,7 +395,7 @@
def await_response_state(channel)
return if channel[:buffer].available == 0
c = channel[:buffer].read_byte
- raise "#{c.chr}#{channel[:buffer].read}" if c != 0
+ raise Net::SCP::Error, "#{c.chr}#{channel[:buffer].read}" if c != 0
channel[:next], channel[:state] = nil, channel[:next]
send("#{channel[:state]}_state", channel)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 1970-01-01 01:00:00.000000000 +0100
+++ new/metadata 2019-03-20 12:25:00.000000000 +0100
@@ -1,108 +1,104 @@
--- !ruby/object:Gem::Specification
name: net-scp
version: !ruby/object:Gem::Version
- version: 1.2.1
- prerelease:
+ version: 2.0.0
platform: ruby
authors:
- Jamis Buck
- Delano Mandelbaum
+- Miklós Fazekas
autorequire:
bindir: bin
cert_chain:
-- !binary |-
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUROakNDQWg2Z0F3SUJB
- Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREJCTVE4d0RRWURWUVFEREFaa1pX
- eGgKYm04eEdUQVhCZ29Ka2lhSmsvSXNaQUVaRmdsemIyeDFkR2x2ZFhNeEV6
- QVJCZ29Ka2lhSmsvSXNaQUVaRmdOagpiMjB3SGhjTk1UUXdORE13TVRjek5q
- STJXaGNOTVRVd05ETXdNVGN6TmpJMldqQkJNUTh3RFFZRFZRUUREQVprClpX
- eGhibTh4R1RBWEJnb0praWFKay9Jc1pBRVpGZ2x6YjJ4MWRHbHZkWE14RXpB
- UkJnb0praWFKay9Jc1pBRVoKRmdOamIyMHdnZ0VpTUEwR0NTcUdTSWIzRFFF
- QkFRVUFBNElCRHdBd2dnRUtBb0lCQVFEZGJlRmpNNjcrVHhycQorOEhhRDR3
- S0VpYWNSb0I4cHMxN1Z6dDlUQlV5b01NajVLVHRGaXB0ci8rWlR1Zy9ZZFlC
- cXVNcHJQc0tsWU0yCk5vRzZCenZEY3ZRSzF6cmRIbnlWb3NJREtBSGsyd255
- Ti9wc1ppa1MxYm85blVIQ1M1aEpkUEVuUVp4L014VFoKK0dqdVJzaUJ4UFlC
- WG5xT2JMaFI4M0xCZVdzYXVXVHVvNWdKdDFEWXhEVFZyTG9CK1orY2VNVisz
- dmgwSEJDYgppd2Vna3g5R1dHNDVoNXdUa3NVSXB6T01CM1ZzSEd0R21CakN2
- ZENnTEoySDZiOFU5cm1MN2NodW5qZHFmTmYzCnpQdG5IMzJjL3pyRnplV0pU
- eUgyczhJYSszRDZ2dW0yeGpqbjhGbkxnM1Y0ek9mNXg1OThHRkJKWURRdjd6
- WC8KclY5ZUN6SERBZ01CQUFHak9UQTNNQWtHQTFVZEV3UUNNQUF3SFFZRFZS
- ME9CQllFRkErQnVjOHlTRXcycUtucQpWSDR3aDhLQW02aFVNQXNHQTFVZER3
- UUVBd0lFc0RBTkJna3Foa2lHOXcwQkFRVUZBQU9DQVFFQVlzTTBNNDJoClpF
- VVh2ci9pMThna3dIS0xGREtEQWNpbWdDb1M1K3N5RzZya3VTT25LR1FvbHlL
- VE5jek5NNGdXSkpQSDVhVnEKbVcyQnRxcElvbTRZUlliOW0zZkROTnM2a2NC
- NURlZFk5VVBoVnZKOFhUVEIyWUx4THFsN1VKaWQ5Wk9pcVd6QwpPVG0wNnc3
- emtBVC9sZHQ0NnA2QnF5VXk2UFc0UU1nMEJxN1NNZlJVUlZycDJsdmhRdkJk
- QzdvRFI5Q0dFQlpDCi9DaSsrWkVoL1FSOXF5MTFBSGNpRUlYbk5reXRpZHla
- dExyNE1XaHRiVjQ2OHk2c2hwUFlkS1UvdUNJTlNndnQKRnBNQU01Tml0OEw4
- bkh3ZjNJSVVQZzdsc01DUnpPa1EvRkQ4N0JJM1YzU25GTm9UQ2RHZ25HajNq
- Zlc0elJsTAppRnlhcmVGUEE4NGJ0UT09Ci0tLS0tRU5EIENFUlRJRklDQVRF
- LS0tLS0K
-date: 2014-04-30 00:00:00.000000000 Z
+- |
+ -----BEGIN CERTIFICATE-----
+ MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZuZXRz
+ c2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
+ b20wHhcNMTgwNjA0MTA0OTQwWhcNMTkwNjA0MTA0OTQwWjBBMQ8wDQYDVQQDDAZu
+ ZXRzc2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
+ FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGJ4TbZ9H+qZ08
+ pQfJhPJTHaDCyQvCsKTFrL5O9z3tllQ7B/zksMMM+qFBpNYu9HCcg4yBATacE/PB
+ qVVyUrpr6lbH/XwoN5ljXm+bdCfmnjZvTCL2FTE6o+bcnaF0IsJyC0Q2B1fbWdXN
+ 6Off1ZWoUk6We2BIM1bn6QJLxBpGyYhvOPXsYoqSuzDf2SJDDsWFZ8kV5ON13Ohm
+ JbBzn0oD8HF8FuYOewwsC0C1q4w7E5GtvHcQ5juweS7+RKsyDcVcVrLuNzoGRttS
+ KP4yMn+TzaXijyjRg7gECfJr3TGASaA4bQsILFGG5dAWcwO4OMrZedR7SHj/o0Kf
+ 3gL7P0axAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
+ BBQF8qLA7Z4zg0SJGtUbv3eoQ8tjIzAfBgNVHREEGDAWgRRuZXRzc2hAc29sdXRp
+ b3VzLmNvbTAfBgNVHRIEGDAWgRRuZXRzc2hAc29sdXRpb3VzLmNvbTANBgkqhkiG
+ 9w0BAQsFAAOCAQEAXnNaYXWVr/sCsfZdza+yBBOobYPgjOgDRfqNO2YX8RFEyDNB
+ AxBCQIF4OeUaoMbTQTVh24MwaDHpDTgqBAEfSs9h41lZewQaw4QUGJ6yxNVzO194
+ 2vYohv9vHpodBukIpUFGk40vQq8nOq2MzVyCb911wnt5d0ZQg+UJf5tdMYvRvATa
+ F/dkTaqhq3wq/JJRghq8fJUqWN5aBtMQb/61z5J3mKAUJsUN2/VdDph2fRPDpECa
+ uWREKzWwXbaB96/ZyzoyP7FsQBLgdDL++g2nF0neCENc5Wj5IlQZiH0a2+X3jAgm
+ 7UnoE3CP9Tk5GHVUina5gPyzl0VI4s4pYCPehQ==
+ -----END CERTIFICATE-----
+date: 2019-03-20 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: net-ssh
requirement: !ruby/object:Gem::Requirement
- none: false
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: 2.6.5
+ - - "<"
+ - !ruby/object:Gem::Version
+ version: 6.0.0
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
- none: false
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: 2.6.5
+ - - "<"
+ - !ruby/object:Gem::Version
+ version: 6.0.0
- !ruby/object:Gem::Dependency
name: test-unit
requirement: !ruby/object:Gem::Requirement
- none: false
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
- none: false
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
- !ruby/object:Gem::Dependency
name: mocha
requirement: !ruby/object:Gem::Requirement
- none: false
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
- none: false
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
description: A pure Ruby implementation of the SCP client protocol
-email: net-ssh@solutious.com
+email:
+- net-ssh@solutious.com
executables: []
extensions: []
extra_rdoc_files:
- LICENSE.txt
- README.rdoc
files:
-- .travis.yml
+- ".gitignore"
+- ".travis.yml"
- CHANGES.txt
+- Gemfile
- LICENSE.txt
- Manifest
- README.rdoc
- Rakefile
-- gem-public_cert.pem
- lib/net/scp.rb
- lib/net/scp/download.rb
- lib/net/scp/errors.rb
@@ -110,36 +106,31 @@
- lib/net/scp/version.rb
- lib/uri/open-scp.rb
- lib/uri/scp.rb
+- net-scp-public_cert.pem
- net-scp.gemspec
- setup.rb
-- test/common.rb
-- test/test_all.rb
-- test/test_download.rb
-- test/test_scp.rb
-- test/test_upload.rb
homepage: https://github.com/net-ssh/net-scp
licenses:
- MIT
+metadata: {}
post_install_message:
rdoc_options: []
require_paths:
- lib
required_ruby_version: !ruby/object:Gem::Requirement
- none: false
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
required_rubygems_version: !ruby/object:Gem::Requirement
- none: false
requirements:
- - - ! '>='
+ - - ">="
- !ruby/object:Gem::Version
version: '0'
requirements: []
-rubyforge_project: net-scp
-rubygems_version: 1.8.23
+rubyforge_project:
+rubygems_version: 2.6.8
signing_key:
specification_version: 3
-summary: A pure Ruby implementation of the SCP client protocol
+summary: A pure Ruby implementation of the SCP client protocol.
test_files: []
Binary files old/metadata.gz.sig and new/metadata.gz.sig differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/net-scp-public_cert.pem new/net-scp-public_cert.pem
--- old/net-scp-public_cert.pem 1970-01-01 01:00:00.000000000 +0100
+++ new/net-scp-public_cert.pem 2019-03-20 12:25:00.000000000 +0100
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZuZXRz
+c2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
+b20wHhcNMTgwNjA0MTA0OTQwWhcNMTkwNjA0MTA0OTQwWjBBMQ8wDQYDVQQDDAZu
+ZXRzc2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
+FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGJ4TbZ9H+qZ08
+pQfJhPJTHaDCyQvCsKTFrL5O9z3tllQ7B/zksMMM+qFBpNYu9HCcg4yBATacE/PB
+qVVyUrpr6lbH/XwoN5ljXm+bdCfmnjZvTCL2FTE6o+bcnaF0IsJyC0Q2B1fbWdXN
+6Off1ZWoUk6We2BIM1bn6QJLxBpGyYhvOPXsYoqSuzDf2SJDDsWFZ8kV5ON13Ohm
+JbBzn0oD8HF8FuYOewwsC0C1q4w7E5GtvHcQ5juweS7+RKsyDcVcVrLuNzoGRttS
+KP4yMn+TzaXijyjRg7gECfJr3TGASaA4bQsILFGG5dAWcwO4OMrZedR7SHj/o0Kf
+3gL7P0axAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
+BBQF8qLA7Z4zg0SJGtUbv3eoQ8tjIzAfBgNVHREEGDAWgRRuZXRzc2hAc29sdXRp
+b3VzLmNvbTAfBgNVHRIEGDAWgRRuZXRzc2hAc29sdXRpb3VzLmNvbTANBgkqhkiG
+9w0BAQsFAAOCAQEAXnNaYXWVr/sCsfZdza+yBBOobYPgjOgDRfqNO2YX8RFEyDNB
+AxBCQIF4OeUaoMbTQTVh24MwaDHpDTgqBAEfSs9h41lZewQaw4QUGJ6yxNVzO194
+2vYohv9vHpodBukIpUFGk40vQq8nOq2MzVyCb911wnt5d0ZQg+UJf5tdMYvRvATa
+F/dkTaqhq3wq/JJRghq8fJUqWN5aBtMQb/61z5J3mKAUJsUN2/VdDph2fRPDpECa
+uWREKzWwXbaB96/ZyzoyP7FsQBLgdDL++g2nF0neCENc5Wj5IlQZiH0a2+X3jAgm
+7UnoE3CP9Tk5GHVUina5gPyzl0VI4s4pYCPehQ==
+-----END CERTIFICATE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/net-scp.gemspec new/net-scp.gemspec
--- old/net-scp.gemspec 1970-01-01 01:00:00.000000000 +0100
+++ new/net-scp.gemspec 2019-03-20 12:25:00.000000000 +0100
@@ -1,69 +1,46 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
-# -*- encoding: utf-8 -*-
-
-Gem::Specification.new do |s|
- s.name = "net-scp"
- s.version = "1.2.1"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Jamis Buck", "Delano Mandelbaum"]
- s.cert_chain = ["gem-public_cert.pem"]
- s.date = "2014-04-30"
- s.description = "A pure Ruby implementation of the SCP client protocol"
- s.email = "net-ssh@solutious.com"
- s.extra_rdoc_files = [
+
+require_relative 'lib/net/scp/version'
+
+Gem::Specification.new do |spec|
+ spec.name = "net-scp"
+ spec.version = Net::SCP::Version::STRING
+ spec.authors = ["Jamis Buck", "Delano Mandelbaum", "Mikl\u{f3}s Fazekas"]
+ spec.email = ["net-ssh@solutious.com"]
+
+ if ENV['NET_SSH_BUILDGEM_SIGNED']
+ spec.cert_chain = ["net-scp-public_cert.pem"]
+ spec.signing_key = "/mnt/gem/net-ssh-private_key.pem"
+ end
+
+ spec.summary = %q{A pure Ruby implementation of the SCP client protocol.}
+ spec.description = %q{A pure Ruby implementation of the SCP client protocol}
+ spec.homepage = "https://github.com/net-ssh/net-scp"
+ spec.license = "MIT"
+ spec.required_rubygems_version = Gem::Requirement.new(">= 0") if spec.respond_to? :required_rubygems_version=
+
+ spec.extra_rdoc_files = [
"LICENSE.txt",
"README.rdoc"
]
- s.files = [
- ".travis.yml",
- "CHANGES.txt",
- "LICENSE.txt",
- "Manifest",
- "README.rdoc",
- "Rakefile",
- "gem-public_cert.pem",
- "lib/net/scp.rb",
- "lib/net/scp/download.rb",
- "lib/net/scp/errors.rb",
- "lib/net/scp/upload.rb",
- "lib/net/scp/version.rb",
- "lib/uri/open-scp.rb",
- "lib/uri/scp.rb",
- "net-scp.gemspec",
- "setup.rb",
- "test/common.rb",
- "test/test_all.rb",
- "test/test_download.rb",
- "test/test_scp.rb",
- "test/test_upload.rb"
- ]
- s.homepage = "https://github.com/net-ssh/net-scp"
- s.licenses = ["MIT"]
- s.require_paths = ["lib"]
- s.rubyforge_project = "net-scp"
- s.rubygems_version = "1.8.23"
- s.signing_key = "/mnt/gem/gem-private_key.pem"
- s.summary = "A pure Ruby implementation of the SCP client protocol"
- if s.respond_to? :specification_version then
- s.specification_version = 3
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
+ spec.require_paths = ["lib"]
+
+ if spec.respond_to? :specification_version then
+ spec.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<net-ssh>, [">= 2.6.5"])
- s.add_development_dependency(%q<test-unit>, [">= 0"])
- s.add_development_dependency(%q<mocha>, [">= 0"])
+ spec.add_runtime_dependency(%q<net-ssh>, [">= 2.6.5", "< 6.0.0"])
+ spec.add_development_dependency(%q<test-unit>, [">= 0"])
+ spec.add_development_dependency(%q<mocha>, [">= 0"])
else
- s.add_dependency(%q<net-ssh>, [">= 2.6.5"])
- s.add_dependency(%q<test-unit>, [">= 0"])
- s.add_dependency(%q<mocha>, [">= 0"])
+ spec.add_dependency(%q<net-ssh>, [">= 2.6.5", "< 6.0.0"])
+ spec.add_dependency(%q<test-unit>, [">= 0"])
+ spec.add_dependency(%q<mocha>, [">= 0"])
end
else
- s.add_dependency(%q<net-ssh>, [">= 2.6.5"])
- s.add_dependency(%q<test-unit>, [">= 0"])
- s.add_dependency(%q<mocha>, [">= 0"])
+ spec.add_dependency(%q<net-ssh>, [">= 2.6.5", "< 6.0.0"])
+ spec.add_dependency(%q<test-unit>, [">= 0"])
+ spec.add_dependency(%q<mocha>, [">= 0"])
end
end
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/common.rb new/test/common.rb
--- old/test/common.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/test/common.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,153 +0,0 @@
-require 'test/unit'
-require 'mocha/setup'
-
-begin
- gem 'net-ssh', ">= 2.0.0"
- require 'net/ssh'
-rescue LoadError
- $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../net-ssh/lib"
-
- begin
- require 'net/ssh'
- require 'net/ssh/version'
- raise LoadError, "wrong version" unless Net::SSH::Version::STRING >= '1.99.0'
- rescue LoadError => e
- abort "could not load net/ssh v2 (#{e.inspect})"
- end
-end
-
-$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
-
-require 'net/scp'
-require 'net/ssh/test'
-
-class Net::SSH::Test::Channel
- def gets_ok
- gets_data "\0"
- end
-
- def sends_ok
- sends_data "\0"
- end
-end
-
-class Net::SCP::TestCase < Test::Unit::TestCase
- include Net::SSH::Test
-
- def default_test
- # do nothing, this is just a hacky-hack to work around Test::Unit's
- # insistence that all TestCase subclasses have at least one test
- # method defined.
- end
-
- protected
-
- def prepare_file(path, contents="", mode=0666, mtime=Time.now, atime=Time.now)
- entry = FileEntry.new(path, contents, mode, mtime, atime)
- entry.stub!
- entry
- end
-
- def prepare_directory(path, mode=0777, mtime=Time.now, atime=Time.now)
- directory = DirectoryEntry.new(path, mode, mtime, atime)
- yield directory if block_given?
- directory.stub!
- end
-
- # The POSIX spec unfortunately allows all characters in file names except
- # ASCII 0x00(NUL) and 0x2F(/)
- #
- # Ideally, we should be testing filenames with newlines, but Mocha doesn't
- # like this at all, so we leave them out. However, the Shellwords module
- # handles newlines just fine, so we can be reasonably confident that they
- # will work in practice
- def awful_file_name
- (((0x00..0x7f).to_a - [0x00, 0x0a, 0x2f]).map { |n| n.chr }).join + '.txt'
- end
-
- def escaped_file_name
- "\\\001\\\002\\\003\\\004\\\005\\\006\\\a\\\b\\\t\\\v\\\f\\\r\\\016\\\017\\\020\\\021\\\022\\\023\\\024\\\025\\\026\\\027\\\030\\\031\\\032\\\e\\\034\\\035\\\036\\\037\\ \\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+,-.0123456789:\\;\\<\\=\\>\\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[\\\\\\]\\^_\\`abcdefghijklmnopqrstuvwxyz\\{\\|\\}\\~\\\177.txt"
- end
-
- class FileEntry
- attr_reader :path, :contents, :mode, :mtime, :atime, :io
-
- def initialize(path, contents, mode=0666, mtime=Time.now, atime=Time.now)
- @path, @contents, @mode = path, contents, mode
- @mtime, @atime = mtime, atime
- end
-
- def name
- @name ||= File.basename(path)
- end
-
- def stub!
- stat = Mocha::Mock.new("file::stat")
- stat.stubs(:size => contents.length, :mode => mode, :mtime => mtime, :atime => atime, :directory? => false)
-
- File.stubs(:stat).with(path).returns(stat)
- File.stubs(:directory?).with(path).returns(false)
- File.stubs(:file?).with(path).returns(true)
- File.stubs(:open).with(path, "rb").returns(StringIO.new(contents))
-
- @io = StringIO.new
- File.stubs(:new).with(path, "wb", mode).returns(io)
- end
- end
-
- class DirectoryEntry
- attr_reader :path, :mode, :mtime, :atime
- attr_reader :entries
-
- def initialize(path, mode=0777, mtime=Time.now, atime=Time.now)
- @path, @mode = path, mode
- @mtime, @atime = mtime, atime
- @entries = []
- end
-
- def name
- @name ||= File.basename(path)
- end
-
- def file(name, *args)
- (entries << FileEntry.new(File.join(path, name), *args)).last
- end
-
- def directory(name, *args)
- entry = DirectoryEntry.new(File.join(path, name), *args)
- yield entry if block_given?
- (entries << entry).last
- end
-
- def stub!
- Dir.stubs(:mkdir).with { |*a| a.first == path }
-
- stat = Mocha::Mock.new("file::stat")
- stat.stubs(:size => 1024, :mode => mode, :mtime => mtime, :atime => atime, :directory? => true)
-
- File.stubs(:stat).with(path).returns(stat)
- File.stubs(:directory?).with(path).returns(true)
- File.stubs(:file?).with(path).returns(false)
- Dir.stubs(:entries).with(path).returns(%w(. ..) + entries.map { |e| e.name }.sort)
-
- entries.each { |e| e.stub! }
- end
- end
-
- def expect_scp_session(arguments)
- story do |session|
- channel = session.opens_channel
- channel.sends_exec "scp #{arguments}"
- yield channel if block_given?
- channel.sends_eof
- channel.gets_exit_status
- channel.gets_eof
- channel.gets_close
- channel.sends_close
- end
- end
-
- def scp(options={})
- @scp ||= Net::SCP.new(connection(options))
- end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_all.rb new/test/test_all.rb
--- old/test/test_all.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/test/test_all.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-Dir.chdir(File.dirname(__FILE__)) do
- Dir['**/test_*.rb'].each { |file| require(file) }
-end
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_download.rb new/test/test_download.rb
--- old/test/test_download.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/test/test_download.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,197 +0,0 @@
-require 'common'
-
-class TestDownload < Net::SCP::TestCase
- def test_download_file_should_transfer_file
- file = prepare_file("/path/to/local.txt", "a" * 1234)
-
- expect_scp_session "-f /path/to/remote.txt" do |channel|
- simple_download(channel)
- end
-
- assert_scripted { scp.download!("/path/to/remote.txt", "/path/to/local.txt") }
- assert_equal "a" * 1234, file.io.string
- end
-
- def test_download_file_with_spaces_in_name_should_escape_remote_file_name
- file = prepare_file("/path/to/local file.txt", "")
-
- expect_scp_session "-f /path/to/remote\\ file.txt" do |channel|
- channel.sends_ok
- channel.gets_data "C0666 0 local file.txt\n"
- channel.sends_ok
- channel.gets_ok
- channel.sends_ok
- end
-
- assert_scripted { scp.download!("/path/to/remote file.txt", "/path/to/local file.txt") }
- end
-
- def test_download_file_with_metacharacters_in_name_should_escape_remote_file_name
- file = prepare_file("/path/to/local/#{awful_file_name}", "")
-
- expect_scp_session "-f /path/to/remote/#{escaped_file_name}" do |channel|
- channel.sends_ok
- channel.gets_data "C0666 0 #{awful_file_name}\n"
- channel.sends_ok
- channel.gets_ok
- channel.sends_ok
- end
-
- assert_scripted { scp.download!("/path/to/remote/#{awful_file_name}", "/path/to/local/#{awful_file_name}") }
- end
-
- def test_download_with_preserve_should_send_times
- file = prepare_file("/path/to/local.txt", "a" * 1234, 0644, Time.at(1234567890, 123456), Time.at(12121212, 232323))
-
- expect_scp_session "-f -p /path/to/remote.txt" do |channel|
- channel.sends_ok
- channel.gets_data "T1234567890 123456 12121212 232323\n"
- simple_download(channel, 0644)
- end
-
- File.expects(:utime).with(Time.at(12121212, 232323), Time.at(1234567890, 123456), "/path/to/local.txt")
- assert_scripted { scp.download!("/path/to/remote.txt", "/path/to/local.txt", :preserve => true) }
- assert_equal "a" * 1234, file.io.string
- end
-
- def test_download_with_error_should_respond_with_error_text
- story do |session|
- channel = session.opens_channel
- channel.sends_exec "scp -f /path/to/remote.txt"
-
- channel.sends_ok
- channel.gets_data "\x01File not found: /path/to/remote.txt\n"
- channel.sends_ok
-
- channel.gets_eof
- channel.gets_exit_status(1)
- channel.gets_close
- channel.sends_close
- end
-
- error = nil
- assert_scripted do
- begin
- scp.download!("/path/to/remote.txt")
- rescue
- error = $!
- end
- end
- assert_equal Net::SCP::Error, error.class
- assert_equal "SCP did not finish successfully (1): File not found: /path/to/remote.txt\n", error.message
- end
-
- def test_download_with_progress_callback_should_invoke_callback
- prepare_file("/path/to/local.txt", "a" * 3000 + "b" * 3000 + "c" * 3000 + "d" * 3000)
-
- expect_scp_session "-f /path/to/remote.txt" do |channel|
- channel.sends_ok
- channel.gets_data "C0666 12000 remote.txt\n"
- channel.sends_ok
- channel.gets_data "a" * 3000
- channel.inject_remote_delay!
- channel.gets_data "b" * 3000
- channel.inject_remote_delay!
- channel.gets_data "c" * 3000
- channel.inject_remote_delay!
- channel.gets_data "d" * 3000
- channel.gets_ok
- channel.sends_ok
- end
-
- calls = []
- progress = Proc.new { |ch, *args| calls << args }
-
- assert_scripted do
- scp.download!("/path/to/remote.txt", "/path/to/local.txt", &progress)
- end
-
- assert_equal ["/path/to/local.txt", 0, 12000], calls.shift
- assert_equal ["/path/to/local.txt", 3000, 12000], calls.shift
- assert_equal ["/path/to/local.txt", 6000, 12000], calls.shift
- assert_equal ["/path/to/local.txt", 9000, 12000], calls.shift
- assert_equal ["/path/to/local.txt", 12000, 12000], calls.shift
- assert calls.empty?
- end
-
- def test_download_io_with_recursive_should_raise_error
- expect_scp_session "-f -r /path/to/remote.txt"
- assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", StringIO.new, :recursive => true) }
- end
-
- def test_download_io_with_preserve_should_ignore_preserve
- expect_scp_session "-f -p /path/to/remote.txt" do |channel|
- simple_download(channel)
- end
-
- io = StringIO.new
- assert_scripted { scp.download!("/path/to/remote.txt", io, :preserve => true) }
- assert_equal "a" * 1234, io.string
- end
-
- def test_download_io_should_transfer_data
- expect_scp_session "-f /path/to/remote.txt" do |channel|
- simple_download(channel)
- end
-
- io = StringIO.new
- assert_scripted { scp.download!("/path/to/remote.txt", io) }
- assert_equal "a" * 1234, io.string
- end
-
- def test_download_bang_without_target_should_return_string
- expect_scp_session "-f /path/to/remote.txt" do |channel|
- simple_download(channel)
- end
-
- assert_scripted do
- assert_equal "a" * 1234, scp.download!("/path/to/remote.txt")
- end
- end
-
- def test_download_directory_without_recursive_should_raise_error
- expect_scp_session "-f /path/to/remote" do |channel|
- channel.sends_ok
- channel.gets_data "D0755 0 remote\n"
- end
-
- assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote") }
- end
-
- def test_download_directory_should_create_directory_and_files_locally
- file = nil
- prepare_directory "/path/to/local" do |dir|
- dir.directory "remote" do |dir2|
- dir2.directory "sub" do |dir3|
- file = dir3.file "remote.txt", ""
- end
- end
- end
-
- expect_scp_session "-f -r /path/to/remote" do |channel|
- channel.sends_ok
- channel.gets_data "D0755 0 remote\n"
- channel.sends_ok
- channel.gets_data "D0755 0 sub\n"
- simple_download(channel)
- channel.gets_data "E\n"
- channel.sends_ok
- channel.gets_data "E\n"
- channel.sends_ok
- end
-
- scp.download!("/path/to/remote", "/path/to/local", :recursive => true, :ssh => { :verbose => :debug })
- assert_equal "a" * 1234, file.io.string
- end
-
- private
-
- def simple_download(channel, mode=0666)
- channel.sends_ok
- channel.gets_data "C%04o 1234 remote.txt\n" % mode
- channel.sends_ok
- channel.gets_data "a" * 1234
- channel.gets_ok
- channel.sends_ok
- end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_scp.rb new/test/test_scp.rb
--- old/test/test_scp.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/test/test_scp.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,60 +0,0 @@
-require 'common'
-
-class TestSCP < Net::SCP::TestCase
- def test_start_without_block_should_return_scp_instance
- ssh = stub('session', :logger => nil)
- Net::SSH.expects(:start).
- with("remote.host", "username", :password => "foo").
- returns(ssh)
-
- ssh.expects(:close).never
- scp = Net::SCP.start("remote.host", "username", :password => "foo")
- assert_instance_of Net::SCP, scp
- assert_equal ssh, scp.session
- end
-
- def test_start_with_block_should_yield_scp_and_close_ssh_session
- ssh = stub('session', :logger => nil)
- Net::SSH.expects(:start).
- with("remote.host", "username", :password => "foo").
- returns(ssh)
-
- ssh.expects(:loop)
- ssh.expects(:close)
-
- yielded = false
- Net::SCP.start("remote.host", "username", :password => "foo") do |scp|
- yielded = true
- assert_instance_of Net::SCP, scp
- assert_equal ssh, scp.session
- end
-
- assert yielded
- end
-
- def test_self_upload_should_instatiate_scp_and_invoke_synchronous_upload
- scp = stub('scp')
- scp.expects(:upload!).with("/path/to/local", "/path/to/remote", :recursive => true)
-
- Net::SCP.expects(:start).
- with("remote.host", "username", :password => "foo").
- yields(scp)
-
- Net::SCP.upload!("remote.host", "username", "/path/to/local", "/path/to/remote",
- :ssh => { :password => "foo" }, :recursive => true)
- end
-
- def test_self_download_should_instatiate_scp_and_invoke_synchronous_download
- scp = stub('scp')
- scp.expects(:download!).with("/path/to/remote", "/path/to/local", :recursive => true).returns(:result)
-
- Net::SCP.expects(:start).
- with("remote.host", "username", :password => "foo").
- yields(scp)
-
- result = Net::SCP.download!("remote.host", "username", "/path/to/remote", "/path/to/local",
- :ssh => { :password => "foo" }, :recursive => true)
-
- assert_equal :result, result
- end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_upload.rb new/test/test_upload.rb
--- old/test/test_upload.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/test/test_upload.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,269 +0,0 @@
-require 'common'
-
-class TestUpload < Net::SCP::TestCase
- def test_upload_file_should_transfer_file
- prepare_file("/path/to/local.txt", "a" * 1234)
-
- expect_scp_session "-t /path/to/remote.txt" do |channel|
- channel.gets_ok
- channel.sends_data "C0666 1234 local.txt\n"
- channel.gets_ok
- channel.sends_data "a" * 1234
- channel.sends_ok
- channel.gets_ok
- end
-
- assert_scripted { scp.upload!("/path/to/local.txt", "/path/to/remote.txt") }
- end
-
- def test_upload_file_with_spaces_in_name_should_escape_remote_file_name
- prepare_file("/path/to/local file.txt", "")
-
- expect_scp_session "-t /path/to/remote\\ file.txt" do |channel|
- channel.gets_ok
- channel.sends_data "C0666 0 local file.txt\n"
- channel.gets_ok
- channel.sends_ok
- channel.gets_ok
- end
-
- assert_scripted { scp.upload!("/path/to/local file.txt", "/path/to/remote file.txt") }
- end
-
- def test_upload_file_with_metacharacters_in_name_should_escape_remote_file_name
- prepare_file("/path/to/local/#{awful_file_name}", "")
-
- expect_scp_session "-t /path/to/remote/#{escaped_file_name}" do |channel|
- channel.gets_ok
- channel.sends_data "C0666 0 #{awful_file_name}\n"
- channel.gets_ok
- channel.sends_ok
- channel.gets_ok
- end
-
- assert_scripted { scp.upload!("/path/to/local/#{awful_file_name}", "/path/to/remote/#{awful_file_name}") }
- end
-
- def test_upload_file_with_preserve_should_send_times
- prepare_file("/path/to/local.txt", "a" * 1234, 0666, Time.at(1234567890, 123456), Time.at(1234543210, 345678))
-
- expect_scp_session "-t -p /path/to/remote.txt" do |channel|
- channel.gets_ok
- channel.sends_data "T1234567890 123456 1234543210 345678\n"
- channel.gets_ok
- channel.sends_data "C0666 1234 local.txt\n"
- channel.gets_ok
- channel.sends_data "a" * 1234
- channel.sends_ok
- channel.gets_ok
- end
-
- assert_scripted { scp.upload!("/path/to/local.txt", "/path/to/remote.txt", :preserve => true) }
- end
-
- def test_upload_file_with_progress_callback_should_invoke_callback
- prepare_file("/path/to/local.txt", "a" * 3000 + "b" * 3000 + "c" * 3000 + "d" * 3000)
-
- expect_scp_session "-t /path/to/remote.txt" do |channel|
- channel.gets_ok
- channel.sends_data "C0666 12000 local.txt\n"
- channel.gets_ok
- channel.sends_data "a" * 3000
- channel.sends_data "b" * 3000
- channel.sends_data "c" * 3000
- channel.sends_data "d" * 3000
- channel.sends_ok
- channel.gets_ok
- end
-
- calls = []
- progress = Proc.new do |ch, name, sent, total|
- calls << [name, sent, total]
- end
-
- assert_scripted do
- scp.upload!("/path/to/local.txt", "/path/to/remote.txt", :chunk_size => 3000, &progress)
- end
-
- assert_equal ["/path/to/local.txt", 0, 12000], calls.shift
- assert_equal ["/path/to/local.txt", 3000, 12000], calls.shift
- assert_equal ["/path/to/local.txt", 6000, 12000], calls.shift
- assert_equal ["/path/to/local.txt", 9000, 12000], calls.shift
- assert_equal ["/path/to/local.txt", 12000, 12000], calls.shift
- assert calls.empty?
- end
-
- def test_upload_io_with_recursive_should_ignore_recursive
- expect_scp_session "-t -r /path/to/remote.txt" do |channel|
- channel.gets_ok
- channel.sends_data "C0640 1234 remote.txt\n"
- channel.gets_ok
- channel.sends_data "a" * 1234
- channel.sends_ok
- channel.gets_ok
- end
-
- io = StringIO.new("a" * 1234)
- assert_scripted { scp.upload!(io, "/path/to/remote.txt", :recursive => true) }
- end
-
- def test_upload_io_with_preserve_should_ignore_preserve
- expect_scp_session "-t -p /path/to/remote.txt" do |channel|
- channel.gets_ok
- channel.sends_data "C0640 1234 remote.txt\n"
- channel.gets_ok
- channel.sends_data "a" * 1234
- channel.sends_ok
- channel.gets_ok
- end
-
- io = StringIO.new("a" * 1234)
- assert_scripted { scp.upload!(io, "/path/to/remote.txt", :preserve => true) }
- end
-
- def test_upload_io_should_transfer_data
- expect_scp_session "-t /path/to/remote.txt" do |channel|
- channel.gets_ok
- channel.sends_data "C0640 1234 remote.txt\n"
- channel.gets_ok
- channel.sends_data "a" * 1234
- channel.sends_ok
- channel.gets_ok
- end
-
- io = StringIO.new("a" * 1234)
- assert_scripted { scp.upload!(io, "/path/to/remote.txt") }
- end
-
- def test_upload_io_with_mode_should_honor_mode_as_permissions
- expect_scp_session "-t /path/to/remote.txt" do |channel|
- channel.gets_ok
- channel.sends_data "C0666 1234 remote.txt\n"
- channel.gets_ok
- channel.sends_data "a" * 1234
- channel.sends_ok
- channel.gets_ok
- end
-
- io = StringIO.new("a" * 1234)
- assert_scripted { scp.upload!(io, "/path/to/remote.txt", :mode => 0666) }
- end
-
- def test_upload_directory_without_recursive_should_error
- prepare_directory("/path/to/local")
-
- expect_scp_session("-t /path/to/remote") do |channel|
- channel.gets_ok
- end
-
- assert_raises(Net::SCP::Error) { scp.upload!("/path/to/local", "/path/to/remote") }
- end
-
- def test_upload_empty_directory_should_create_directory_and_finish
- prepare_directory("/path/to/local")
-
- expect_scp_session("-t -r /path/to/remote") do |channel|
- channel.gets_ok
- channel.sends_data "D0777 0 local\n"
- channel.gets_ok
- channel.sends_data "E\n"
- channel.gets_ok
- end
-
- assert_scripted { scp.upload!("/path/to/local", "/path/to/remote", :recursive => true) }
- end
-
- def test_upload_directory_should_recursively_create_and_upload_items
- prepare_directory("/path/to/local") do |d|
- d.file "hello.txt", "hello world\n"
- d.directory "others" do |d2|
- d2.file "data.dat", "abcdefghijklmnopqrstuvwxyz"
- end
- d.file "zoo.doc", "going to the zoo\n"
- end
-
- expect_scp_session("-t -r /path/to/remote") do |channel|
- channel.gets_ok
- channel.sends_data "D0777 0 local\n"
- channel.gets_ok
- channel.sends_data "C0666 12 hello.txt\n"
- channel.gets_ok
- channel.sends_data "hello world\n"
- channel.sends_ok
- channel.gets_ok
- channel.sends_data "D0777 0 others\n"
- channel.gets_ok
- channel.sends_data "C0666 26 data.dat\n"
- channel.gets_ok
- channel.sends_data "abcdefghijklmnopqrstuvwxyz"
- channel.sends_ok
- channel.gets_ok
- channel.sends_data "E\n"
- channel.gets_ok
- channel.sends_data "C0666 17 zoo.doc\n"
- channel.gets_ok
- channel.sends_data "going to the zoo\n"
- channel.sends_ok
- channel.gets_ok
- channel.sends_data "E\n"
- channel.gets_ok
- end
-
- assert_scripted { scp.upload!("/path/to/local", "/path/to/remote", :recursive => true) }
- end
-
- def test_upload_directory_with_preserve_should_send_times_for_all_items
- prepare_directory("/path/to/local", 0755, Time.at(17171717, 191919), Time.at(18181818, 101010)) do |d|
- d.file "hello.txt", "hello world\n", 0640, Time.at(12345, 67890), Time.at(234567, 890)
- d.directory "others", 0770, Time.at(112233, 4455), Time.at(22334455, 667788) do |d2|
- d2.file "data.dat", "abcdefghijklmnopqrstuvwxyz", 0600, Time.at(13579135, 13131), Time.at(7654321, 654321)
- end
- d.file "zoo.doc", "going to the zoo\n", 0444, Time.at(12121212, 131313), Time.at(23232323, 242424)
- end
-
- expect_scp_session("-t -r -p /path/to/remote") do |channel|
- channel.gets_ok
- channel.sends_data "T17171717 191919 18181818 101010\n"
- channel.gets_ok
- channel.sends_data "D0755 0 local\n"
- channel.gets_ok
- channel.sends_data "T12345 67890 234567 890\n"
- channel.gets_ok
- channel.sends_data "C0640 12 hello.txt\n"
- channel.gets_ok
- channel.sends_data "hello world\n"
- channel.sends_ok
- channel.gets_ok
- channel.sends_data "T112233 4455 22334455 667788\n"
- channel.gets_ok
- channel.sends_data "D0770 0 others\n"
- channel.gets_ok
- channel.sends_data "T13579135 13131 7654321 654321\n"
- channel.gets_ok
- channel.sends_data "C0600 26 data.dat\n"
- channel.gets_ok
- channel.sends_data "abcdefghijklmnopqrstuvwxyz"
- channel.sends_ok
- channel.gets_ok
- channel.sends_data "E\n"
- channel.gets_ok
- channel.sends_data "T12121212 131313 23232323 242424\n"
- channel.gets_ok
- channel.sends_data "C0444 17 zoo.doc\n"
- channel.gets_ok
- channel.sends_data "going to the zoo\n"
- channel.sends_ok
- channel.gets_ok
- channel.sends_data "E\n"
- channel.gets_ok
- end
-
- assert_scripted { scp.upload!("/path/to/local", "/path/to/remote", :preserve => true, :recursive => true) }
- end
-
- def test_upload_should_not_block
- prepare_file("/path/to/local.txt", "data")
- story { |s| s.opens_channel(false) }
- assert_scripted { scp.upload("/path/to/local.txt", "/path/to/remote.txt") }
- end
-end