sshconfig 13

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6a3b2a1883ceb5c8be616e5a5857fd9ff6d5419e
4
+ data.tar.gz: 69038e22a6e46d2f8cb0c43f55f755dd349f7988
5
+ SHA512:
6
+ metadata.gz: 8686735814d1c1da2354d1ee03bb513a866a16a7957324853552b04cfe708ed6e294aad1c381dad8341b4ec2d0b8ad47b671c83be3839ffe796fe9b05ba6c686
7
+ data.tar.gz: c0d6ac146c238224a73896acf7c374b6fa967e1006e3e0829e3b7e288e4f586270668b1b7688bdf872bff8a211a89928e13eb46eba4ffe9c00306d7d43236adf
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require 'sshconfig'
3
+ include SSHConfig
4
+
5
+ File.open(File.join(ENV["HOME"], ".ssh/config"), "w") do |f|
6
+ load File.join(ENV["HOME"], ".ssh/sshconfig")
7
+ f.puts $hostlist
8
+ end
data/lib/host.rb ADDED
@@ -0,0 +1,19 @@
1
+ module SSHConfig
2
+ class Host
3
+ def initialize(name, &block)
4
+ @name = name
5
+ @directives = {}
6
+ self.instance_eval(&block)
7
+ end
8
+
9
+ def method_missing(meth, arg)
10
+ @directives[meth.capitalize] = arg
11
+ end
12
+
13
+ def to_s
14
+ "Host #{@name}\n" +
15
+ @directives.map { |k, v| "\t#{k} #{v}" }.join("\n") +
16
+ "\n"
17
+ end
18
+ end
19
+ end
data/lib/hosts.rb ADDED
@@ -0,0 +1,22 @@
1
+ module SSHConfig
2
+ class Hosts
3
+ attr_reader :hosts
4
+
5
+ def initialize(&block)
6
+ @hosts = []
7
+ self.instance_eval(&block)
8
+ end
9
+
10
+ def merge(morehosts)
11
+ @hosts += morehosts.hosts
12
+ end
13
+
14
+ def host(name)
15
+ @hosts << Host.new(name, &Proc.new)
16
+ end
17
+
18
+ def to_s
19
+ @hosts.map(&:to_s).join("\n")
20
+ end
21
+ end
22
+ end
data/lib/sshconfig.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'host'
2
+ require 'hosts'
3
+
4
+ module SSHConfig
5
+ YES = "yes"
6
+ NO = "no"
7
+
8
+ $hostlist = Hosts.new{}
9
+
10
+ def hosts
11
+ $hostlist.merge(Hosts.new(&Proc.new))
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sshconfig
3
+ version: !ruby/object:Gem::Version
4
+ version: '13'
5
+ platform: ruby
6
+ authors:
7
+ - Nathan Lasseter
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-01-11 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A DSL to generate SSH config
14
+ email: nathan@bytemark.co.uk
15
+ executables:
16
+ - ssh-update-config
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/ssh-update-config
21
+ - lib/host.rb
22
+ - lib/hosts.rb
23
+ - lib/sshconfig.rb
24
+ homepage: https://github.com/User4574/SSHConfig
25
+ licenses:
26
+ - BSD-2-Clause
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 2.5.1
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: SSH Config DSL
48
+ test_files: []