sshconfig 13 → 15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6a3b2a1883ceb5c8be616e5a5857fd9ff6d5419e
4
- data.tar.gz: 69038e22a6e46d2f8cb0c43f55f755dd349f7988
2
+ SHA256:
3
+ metadata.gz: fa71bb68f9d97ef51ad05af87703eabefc565b14266b9923abc7645a905747f6
4
+ data.tar.gz: a432187e5ce8622e8374c9db4556ff8c812e9195f09626222e06737eded25615
5
5
  SHA512:
6
- metadata.gz: 8686735814d1c1da2354d1ee03bb513a866a16a7957324853552b04cfe708ed6e294aad1c381dad8341b4ec2d0b8ad47b671c83be3839ffe796fe9b05ba6c686
7
- data.tar.gz: c0d6ac146c238224a73896acf7c374b6fa967e1006e3e0829e3b7e288e4f586270668b1b7688bdf872bff8a211a89928e13eb46eba4ffe9c00306d7d43236adf
6
+ metadata.gz: 9a9c13ed78eb97c75986b9077b39bfe0a0c4b51e14c0bdc813a56d291a4ca739adf82e8e7a0497b8a738ccb0ecf7186926cffc75f73366c140ea30e5b624df0a
7
+ data.tar.gz: ebc47a45e26327f024d28db8497a6135e3058c9cff066da42903c97eeb9e2076632f9b3108c3fed86e8b5bc336cae59d6a4d958512edd0734cdd45f1e6dabd22
@@ -1,8 +1,31 @@
1
1
  #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
2
4
  require 'sshconfig'
3
5
  include SSHConfig
4
6
 
5
- File.open(File.join(ENV["HOME"], ".ssh/config"), "w") do |f|
6
- load File.join(ENV["HOME"], ".ssh/sshconfig")
7
- f.puts $hostlist
7
+ output = $stdout
8
+ input = File.join(ENV["HOME"], ".ssh/sshconfig")
9
+
10
+ parser = OptionParser.new do |opts|
11
+ opts.banner = "Usage: ssh-update-config"
12
+ opts.on("-h", "--help", "--usage", "Print usage") do
13
+ puts parser.banner
14
+ puts parser.summarize
15
+ exit 0
16
+ end
17
+ opts.on("-o MANDATORY", "--output MANDATORY", "Output destination (default: stdout)") do |out|
18
+ output = File.open(out, "w")
19
+ end
20
+ opts.on("-i MANDATORY", "--input MANDATORY", "Input source (default: ~/.ssh/sshconfig") do |inp|
21
+ input = inp
22
+ end
23
+ opts.on("-l MANDATORY", "--load MANDATORY", "Load an SSHConfig extension") do |ext|
24
+ require ext
25
+ end
8
26
  end
27
+ parser.parse!
28
+
29
+ load input
30
+ output.puts $hostlist
31
+ output.flush
data/lib/hosts.rb CHANGED
@@ -11,8 +11,8 @@ module SSHConfig
11
11
  @hosts += morehosts.hosts
12
12
  end
13
13
 
14
- def host(name)
15
- @hosts << Host.new(name, &Proc.new)
14
+ def host(name, &blk)
15
+ @hosts << Host.new(name, &blk)
16
16
  end
17
17
 
18
18
  def to_s
data/lib/sshconfig.rb CHANGED
@@ -7,7 +7,7 @@ module SSHConfig
7
7
 
8
8
  $hostlist = Hosts.new{}
9
9
 
10
- def hosts
11
- $hostlist.merge(Hosts.new(&Proc.new))
10
+ def hosts(&blk)
11
+ $hostlist.merge(Hosts.new(&blk))
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sshconfig
3
3
  version: !ruby/object:Gem::Version
4
- version: '13'
4
+ version: '15'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Lasseter
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-11 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A DSL to generate SSH config
14
14
  email: nathan@bytemark.co.uk
@@ -25,7 +25,7 @@ homepage: https://github.com/User4574/SSHConfig
25
25
  licenses:
26
26
  - BSD-2-Clause
27
27
  metadata: {}
28
- post_install_message:
28
+ post_install_message:
29
29
  rdoc_options: []
30
30
  require_paths:
31
31
  - lib
@@ -40,9 +40,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  requirements: []
43
- rubyforge_project:
44
- rubygems_version: 2.5.1
45
- signing_key:
43
+ rubygems_version: 3.2.29
44
+ signing_key:
46
45
  specification_version: 4
47
46
  summary: SSH Config DSL
48
47
  test_files: []