herd-rb 0.1.0 → 0.2.0
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 +4 -4
- data/lib/herd/session.rb +12 -2
- data/lib/herd/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84702715cdf7b1c28fe203c5c88a0b0f7a3c0a77bf5bfb237c027a82585be7c0
|
4
|
+
data.tar.gz: d61aa1dcbe955f6ab0bd56c535612cf490891ed2589425af1ac23baf6e085636
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2f6c111802762b7c5e642a1a8f073d9bad60c138f5d607870a4989154777aa2691997ca514ef440237d73b4112107a72dffe17b1c3221aab0d7663440be70bf
|
7
|
+
data.tar.gz: b65a40974cee1729989bfc9c65a95b937e101c71072daa2da4cf70475cd04ce8de65ab4483e1dfbf4301bcc27a4bcbe149a9c07119619190bde82f052c1eee1e
|
data/lib/herd/session.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Herd
|
4
4
|
# Session for executing commands on the remote host
|
5
5
|
class Session
|
6
|
-
COMMANDS = %i[hostname].freeze
|
6
|
+
COMMANDS = %i[cat chmod echo hostname touch].freeze
|
7
7
|
|
8
8
|
attr_reader :ssh
|
9
9
|
|
@@ -11,9 +11,19 @@ module Herd
|
|
11
11
|
@ssh = ssh
|
12
12
|
end
|
13
13
|
|
14
|
+
def authorized_keys
|
15
|
+
cat("~/.ssh/authorized_keys")&.chomp&.split("\n") || []
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_authorized_key(key)
|
19
|
+
touch("~/.ssh/authorized_keys")
|
20
|
+
chmod("600 ~/.ssh/authorized_keys")
|
21
|
+
echo "'#{key}' >> ~/.ssh/authorized_keys"
|
22
|
+
end
|
23
|
+
|
14
24
|
def method_missing(cmd, *args)
|
15
25
|
command = cmd.to_s
|
16
|
-
command
|
26
|
+
command = "#{command} #{args.join(" ")}" if args
|
17
27
|
|
18
28
|
ssh.exec! command do |_, stream, data|
|
19
29
|
raise ::Herd::CommandError, data if stream == :stderr
|
data/lib/herd/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herd-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yury Kotlyarov
|
@@ -65,7 +65,8 @@ dependencies:
|
|
65
65
|
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
|
-
description:
|
68
|
+
description: |
|
69
|
+
Simple ruby DSL for fast host configuration. Supports Ubuntu and requires
|
69
70
|
SSH server running on each targets host.
|
70
71
|
email:
|
71
72
|
- yury.kotlyarov@gmail.com
|