diff options
author | delano <delano.mandelbaum@gmail.com> | 2013-07-06 08:30:40 -0700 |
---|---|---|
committer | delano <delano.mandelbaum@gmail.com> | 2013-07-06 08:30:40 -0700 |
commit | 2120304fb6959d664ae6908fe3154a4ff5f98863 (patch) | |
tree | 1389e499623637061682ed848d4b0f6f150a552b | |
parent | f133721ef9594b55658ac1d5e1b002b4513babda (diff) | |
parent | e61e91323a12de5b96929db4465177decae7edb6 (diff) | |
download | net-ssh-GabKlein-master.tar.gz |
Fixed merge from GabKlein-masterGabKlein-master
-rw-r--r-- | Rakefile | 4 | ||||
-rw-r--r-- | lib/net/ssh/config.rb | 3 | ||||
-rw-r--r-- | net-ssh.gemspec | 7 | ||||
-rw-r--r-- | test/configs/substitutes | 8 | ||||
-rw-r--r-- | test/test_config.rb | 19 |
5 files changed, 36 insertions, 5 deletions
@@ -34,8 +34,8 @@ begin s.license = "MIT" - s.signing_key = File.join('/mnt/gem/', 'gem-private_key.pem') - s.cert_chain = ['gem-public_cert.pem'] + #s.signing_key = File.join('/mnt/gem/', 'gem-private_key.pem') + #s.cert_chain = ['gem-public_cert.pem'] end Jeweler::GemcutterTasks.new rescue LoadError diff --git a/lib/net/ssh/config.rb b/lib/net/ssh/config.rb index 283121d..6c51fd9 100644 --- a/lib/net/ssh/config.rb +++ b/lib/net/ssh/config.rb @@ -92,6 +92,7 @@ module Net; module SSH multi_host = value.to_s.split(/\s+/) matched_host = multi_host.select { |h| host =~ pattern2regex(h) }.first seen_host = true + settings[key] = host elsif !seen_host if key == 'identityfile' (globals[key] ||= []) << value @@ -145,7 +146,7 @@ module Net; module SSH when 'hostkeyalias' then hash[:host_key_alias] = value when 'hostname' then - hash[:host_name] = value + hash[:host_name] = value.gsub(/%h/, settings['host']) when 'identityfile' then hash[:keys] = value when 'macs' then diff --git a/net-ssh.gemspec b/net-ssh.gemspec index b961f62..0e0481a 100644 --- a/net-ssh.gemspec +++ b/net-ssh.gemspec @@ -9,8 +9,12 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Jamis Buck", "Delano Mandelbaum"] +<<<<<<< HEAD s.cert_chain = ["gem-public_cert.pem"] s.date = "2013-04-11" +======= + s.date = "2013-03-28" +>>>>>>> e61e91323a12de5b96929db4465177decae7edb6 s.description = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol. It allows you to write programs that invoke and interact with processes on remote servers, via SSH2." s.email = "net-ssh@solutious.com" s.extra_rdoc_files = [ @@ -169,8 +173,7 @@ Gem::Specification.new do |s| s.licenses = ["MIT"] s.require_paths = ["lib"] s.rubyforge_project = "net-ssh" - s.rubygems_version = "1.8.25" - s.signing_key = "/mnt/gem/gem-private_key.pem" + s.rubygems_version = "1.8.24" s.summary = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol." if s.respond_to? :specification_version then diff --git a/test/configs/substitutes b/test/configs/substitutes new file mode 100644 index 0000000..9f04a69 --- /dev/null +++ b/test/configs/substitutes @@ -0,0 +1,8 @@ +Host test + HostName %h.sufix + +Host 1234 + HostName prefix.%h.sufix + +Host * + HostName %h
\ No newline at end of file diff --git a/test/test_config.rb b/test/test_config.rb index 634252a..300c8a3 100644 --- a/test/test_config.rb +++ b/test/test_config.rb @@ -116,6 +116,25 @@ class TestConfig < Test::Unit::TestCase assert_equal '2G', config['rekeylimit'] assert_equal 1980, config['port'] end + + def test_load_wildcar_with_substitutes + config = Net::SSH::Config.load(config(:substitutes), "toto") + net_ssh = Net::SSH::Config.translate(config) + puts net_ssh + assert_equal 'toto', net_ssh[:host_name] + end + + def test_load_sufix_with_substitutes + config = Net::SSH::Config.load(config(:substitutes), "test") + net_ssh = Net::SSH::Config.translate(config) + assert_equal 'test.sufix', net_ssh[:host_name] + end + + def test_load_prefix_and_sufix_with_substitutes + config = Net::SSH::Config.load(config(:substitutes), "1234") + net_ssh = Net::SSH::Config.translate(config) + assert_equal 'prefix.1234.sufix', net_ssh[:host_name] + end private |