Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI
on:
pull_request:
push: { branches: master }
permissions:
contents: read
jobs:
test:
# setup-ruby has no builds of Ruby 3.1 and older for ubuntu-latest (26.04).
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0', 'ruby-head', 'jruby']
continue-on-error: ${{ contains(fromJSON('["ruby-head", "jruby"]'), matrix.ruby-version) }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Run Tests
run: bundle exec rake test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
doc
pkg
*.swp
.bundle/
Gemfile.lock

.DS_Store
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
=== Unreleased

* Require net-ssh >= 4.0 [mfazekas]
* Replace Jeweler and Travis with a hand-written gemspec, a Gemfile and GitHub Actions for Ruby 2.6 to 4.0 [mfazekas]
* Fix the gemspec homepage, and ship the renewed net-ssh-public_cert.pem used to sign releases [mfazekas]

=== 1.3.0.rc1 / 12 Mar 2016

* Make sure we wait no more than keeepalive in select [Eugene Kenny]
Expand Down
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in net-ssh-multi.gemspec
gemspec
8 changes: 4 additions & 4 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= Net::SSH::Multi

* Docs: http://net-ssh.github.com/net-ssh-multi
* Docs: https://net-ssh.github.io/net-ssh-multi
* Issues: https://github.com/net-ssh/net-ssh-multi/issues
* Codes: https://github.com/net-ssh/net-ssh-multi
* Email: net-ssh@solutious.com
Expand Down Expand Up @@ -66,12 +66,12 @@ If you want to run the tests or use any of the Rake tasks, you'll need:

* gem install net-ssh-multi

However, in order to be sure the code you're installing hasn't been tampered with, it's recommended that you verify the signature[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 signature[https://guides.rubygems.org/security/]. 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-multi/master/net-ssh-public_cert.pem
$ gem cert --add net-ssh-public_cert.pem

Then, when install the gem, do so with high security:

Expand Down
64 changes: 4 additions & 60 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,65 +1,9 @@
require "rubygems"
require "rake"
require "rake/clean"
require "rdoc/task"
require "bundler/gem_tasks"
require "rake/testtask"

task :default => ["build"]
CLEAN.include [ 'pkg', 'rdoc' ]
name = "net-ssh-multi"

$:.unshift File.join(File.dirname(__FILE__), 'lib')
require './lib/net/ssh/multi/version'
version = Net::SSH::Multi::Version::STRING.dup

begin
require "jeweler"
Jeweler::Tasks.new do |s|
s.version = version
s.name = name
s.rubyforge_project = s.name
s.summary = "Control multiple Net::SSH connections via a single interface."
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_dependency 'net-ssh-gateway', ">=1.2.0"

s.add_development_dependency 'minitest'
s.add_development_dependency 'mocha'

s.license = "MIT"

unless ENV['NET_SSH_NOKEY']
signing_key = File.join('/mnt/gem/', 'net-ssh-private_key.pem')
s.signing_key = signing_key
s.cert_chain = ['gem-public_cert.pem']
unless (Rake.application.top_level_tasks & ['build','install']).empty?
raise "No key found at #{signing_key} for signing, use rake <taskname> NET_SSH_NOKEY=1 to build without key" unless File.exist?(signing_key)
end
end
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end

require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs = ["lib", "test"]
t.pattern = "test/**/*_test.rb"
end

extra_files = %w[LICENSE.txt THANKS.txt CHANGES.txt ]
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.title = "#{name} #{version}"
rdoc.generator = 'hanna' # gem install hanna-nouveau
rdoc.main = 'README.rdoc'
rdoc.rdoc_files.include("README*")
rdoc.rdoc_files.include("bin/*.rb")
rdoc.rdoc_files.include("lib/**/*.rb")
extra_files.each { |file|
rdoc.rdoc_files.include(file) if File.exists?(file)
}
end
task :default => :test
20 changes: 0 additions & 20 deletions gem-public_cert.pem

This file was deleted.

101 changes: 29 additions & 72 deletions net-ssh-multi.gemspec
Original file line number Diff line number Diff line change
@@ -1,77 +1,34 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: net-ssh-multi 1.3.0.rc1 ruby lib
# coding: utf-8

Gem::Specification.new do |s|
s.name = "net-ssh-multi"
s.version = "1.3.0.rc1"
# version.rb requires net-ssh, which isn't installed yet when bundler first evaluates this file.
version_rb = File.read(File.expand_path('../lib/net/ssh/multi/version.rb', __FILE__))
version = %w[MAJOR MINOR TINY PRE].map { |part| version_rb[/^\s*#{part}\s*=\s*"?(\w+)"?/, 1] }
version = version.reject { |part| part.nil? || part == "nil" }.join(".")

s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Jamis Buck", "Delano Mandelbaum"]
s.cert_chain = ["gem-public_cert.pem"]
s.date = "2016-03-24"
s.description = "Control multiple Net::SSH connections via a single interface."
s.email = "net-ssh@solutious.com"
s.extra_rdoc_files = [
"LICENSE.txt",
"README.rdoc"
]
s.files = [
".travis.yml",
"CHANGES.txt",
"LICENSE.txt",
"README.rdoc",
"Rakefile",
"gem-public_cert.pem",
"lib/net/ssh/multi.rb",
"lib/net/ssh/multi/channel.rb",
"lib/net/ssh/multi/channel_proxy.rb",
"lib/net/ssh/multi/dynamic_server.rb",
"lib/net/ssh/multi/pending_connection.rb",
"lib/net/ssh/multi/server.rb",
"lib/net/ssh/multi/server_list.rb",
"lib/net/ssh/multi/session.rb",
"lib/net/ssh/multi/session_actions.rb",
"lib/net/ssh/multi/subsession.rb",
"lib/net/ssh/multi/version.rb",
"net-ssh-multi.gemspec",
"test/channel_test.rb",
"test/common.rb",
"test/multi_test.rb",
"test/server_test.rb",
"test/session_actions_test.rb",
"test/session_test.rb",
"test/test_all.rb"
]
s.homepage = "https://github.com/net-ssh/net-scp"
s.licenses = ["MIT"]
s.rubyforge_project = "net-ssh-multi"
s.rubygems_version = "2.4.6"
s.signing_key = "/mnt/gem/net-ssh-private_key.pem"
s.summary = "Control multiple Net::SSH connections via a single interface."
Gem::Specification.new do |spec|
spec.name = "net-ssh-multi"
spec.version = version
spec.authors = ["Jamis Buck", "Delano Mandelbaum", "Mikl\u{f3}s Fazekas"]
spec.email = ["net-ssh@solutious.com"]

if s.respond_to? :specification_version then
s.specification_version = 4

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_runtime_dependency(%q<net-ssh-gateway>, [">= 1.2.0"])
s.add_development_dependency(%q<minitest>, [">= 0"])
s.add_development_dependency(%q<mocha>, [">= 0"])
else
s.add_dependency(%q<net-ssh>, [">= 2.6.5"])
s.add_dependency(%q<net-ssh-gateway>, [">= 1.2.0"])
s.add_dependency(%q<minitest>, [">= 0"])
s.add_dependency(%q<mocha>, [">= 0"])
end
else
s.add_dependency(%q<net-ssh>, [">= 2.6.5"])
s.add_dependency(%q<net-ssh-gateway>, [">= 1.2.0"])
s.add_dependency(%q<minitest>, [">= 0"])
s.add_dependency(%q<mocha>, [">= 0"])
if ENV['NET_SSH_BUILDGEM_SIGNED']
spec.cert_chain = ["net-ssh-public_cert.pem"]
spec.signing_key = "/mnt/gem/net-ssh-private_key.pem"
end
end

spec.summary = %q{Control multiple Net::SSH connections via a single interface.}
spec.description = %q{Control multiple Net::SSH connections via a single interface.}
spec.homepage = "https://github.com/net-ssh/net-ssh-multi"
spec.license = "MIT"

spec.files = Dir["lib/**/*.rb"] + %w[CHANGES.txt LICENSE.txt README.rdoc]
spec.extra_rdoc_files = %w[LICENSE.txt README.rdoc]
spec.require_paths = ["lib"]

spec.add_development_dependency "rake", ">= 12.0"
spec.add_development_dependency "minitest", ">= 5.10"
spec.add_development_dependency "mocha", ">= 1.4"

spec.add_runtime_dependency "net-ssh", ">= 4.0.0"
spec.add_runtime_dependency "net-ssh-gateway", ">= 1.2.0"
end
21 changes: 21 additions & 0 deletions net-ssh-public_cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMQ8wDQYDVQQDDAZuZXRz
c2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
b20wHhcNMjYwNTE2MTYyMDUzWhcNMjcwNTE2MTYyMDUzWjBBMQ8wDQYDVQQDDAZu
ZXRzc2gxGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGJ4TbZ9H+qZ08
pQfJhPJTHaDCyQvCsKTFrL5O9z3tllQ7B/zksMMM+qFBpNYu9HCcg4yBATacE/PB
qVVyUrpr6lbH/XwoN5ljXm+bdCfmnjZvTCL2FTE6o+bcnaF0IsJyC0Q2B1fbWdXN
6Off1ZWoUk6We2BIM1bn6QJLxBpGyYhvOPXsYoqSuzDf2SJDDsWFZ8kV5ON13Ohm
JbBzn0oD8HF8FuYOewwsC0C1q4w7E5GtvHcQ5juweS7+RKsyDcVcVrLuNzoGRttS
KP4yMn+TzaXijyjRg7gECfJr3TGASaA4bQsILFGG5dAWcwO4OMrZedR7SHj/o0Kf
3gL7P0axAgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
BBQF8qLA7Z4zg0SJGtUbv3eoQ8tjIzAfBgNVHREEGDAWgRRuZXRzc2hAc29sdXRp
b3VzLmNvbTAfBgNVHRIEGDAWgRRuZXRzc2hAc29sdXRpb3VzLmNvbTANBgkqhkiG
9w0BAQsFAAOCAQEAVx/yCCX0ZPQ8TFeZe1T+OBEn3Co/AfjAmCdhstf1TF+Jziyx
dFJ8m8mF4596gru87Mi8mvu+WbPsLlFMOf5LDUkAsgnlvJ+zqNL7jPjGmsh0KOHJ
0dzPYnTeGcfyrp1AXNN3Z2jWlEInrnqvo376vOmejjTtmDVVlhPjITHQqLSXzRaQ
e3M8fbJ+nupobti6jpXCYvH86KtpaxF66mwaynfdjzxQAVycV/ilKtL+sHH8zxlg
vNiMFH5yLu/tlav4xh+HlYscWVdFQIvd7f/Uxa+Vip1Pi16wmhnrE15z/vDX921v
hukBRIoCEAuUgNVBh+L/C8aETzbf/77WU3Si/w==
-----END CERTIFICATE-----
4 changes: 2 additions & 2 deletions test/channel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def test_exec_should_delegate_to_component_channels

def test_request_pty_should_delegate_to_component_channels
c1, c2, results = mock('channel'), mock('channel'), []
c1.expects(:request_pty).with(:foo => 5).yields(c1)
c2.expects(:request_pty).with(:foo => 5).yields(c2)
c1.expects(:request_pty).with({:foo => 5}).yields(c1)
c2.expects(:request_pty).with({:foo => 5}).yields(c2)
channel = Net::SSH::Multi::Channel.new(mock('session'), [c1, c2])
assert_equal channel, channel.request_pty(:foo => 5) { |c| results << c }
assert_equal [c1, c2], results
Expand Down
9 changes: 1 addition & 8 deletions test/common.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,2 @@
require 'minitest/autorun'
require 'mocha/setup'

if Minitest.const_defined?('Test')
# We're on Minitest 5+. Nothing to do here.
else
# Minitest 4 doesn't have Minitest::Test yet.
Minitest::Test = MiniTest::Unit::TestCase
end
require 'mocha/minitest'
13 changes: 9 additions & 4 deletions test/session_actions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ def setup
@session = SessionActionsContainer.new
end

# Mocha keeps the visibility of the method it stubs, and Kernel#exec is private.
def channel_hash
{ :host => "host" }.tap { |c| c.singleton_class.send(:public, :exec) }
end

def test_busy_should_be_true_if_any_server_is_busy
srv1, srv2, srv3 = @session.use('h1'), @session.use('h2'), @session.use('h3')
srv1.stubs(:busy?).returns(false)
Expand Down Expand Up @@ -80,14 +85,14 @@ def test_open_channel_should_delegate_to_sessions_and_set_accessors_on_each_chan
end

def test_exec_should_raise_exception_if_channel_cannot_exec_command
c = { :host => "host" }
c = channel_hash
@session.expects(:open_channel).yields(c).returns(c)
c.expects(:exec).with('something').yields(c, false)
assert_raises(RuntimeError) { @session.exec("something") }
end

def test_exec_with_block_should_pass_data_and_extended_data_to_block
c = { :host => "host" }
c = channel_hash
@session.expects(:open_channel).yields(c).returns(c)
c.expects(:exec).with('something').yields(c, true)
c.expects(:on_data).yields(c, "stdout")
Expand All @@ -101,7 +106,7 @@ def test_exec_with_block_should_pass_data_and_extended_data_to_block
end

def test_exec_without_block_should_write_data_and_extended_data_lines_to_stdout_and_stderr
c = { :host => "host" }
c = channel_hash
@session.expects(:open_channel).yields(c).returns(c)
c.expects(:exec).with('something').yields(c, true)
c.expects(:on_data).yields(c, "stdout 1\nstdout 2\n")
Expand All @@ -115,7 +120,7 @@ def test_exec_without_block_should_write_data_and_extended_data_lines_to_stdout_
end

def test_exec_should_capture_exit_status_of_process
c = { :host => "host" }
c = channel_hash
@session.expects(:open_channel).yields(c).returns(c)
c.expects(:exec).with('something').yields(c, true)
c.expects(:on_data)
Expand Down
2 changes: 1 addition & 1 deletion test/session_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_group_with_mapping_should_append_new_servers_to_specified_and_open_grou
end

def test_via_should_instantiate_and_set_default_gateway
Net::SSH::Gateway.expects(:new).with('host', 'user', :a => :b).returns(:gateway)
Net::SSH::Gateway.expects(:new).with('host', 'user', {:a => :b}).returns(:gateway)
assert_equal @session, @session.via('host', 'user', :a => :b)
assert_equal :gateway, @session.default_gateway
end
Expand Down
Loading