kanrisuru 0.2.5 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/kanrisuru.gemspec +9 -9
- data/lib/kanrisuru/core.rb +3 -0
- data/lib/kanrisuru/core/path.rb +0 -1
- data/lib/kanrisuru/core/yum.rb +5 -2
- data/lib/kanrisuru/remote/fstab.rb +11 -2
- data/lib/kanrisuru/remote/os.rb +3 -1
- data/lib/kanrisuru/util/bits.rb +3 -3
- data/lib/kanrisuru/util/os_family.rb +11 -8
- data/lib/kanrisuru/version.rb +1 -1
- data/spec/functional/remote/fstab_spec.rb +16 -0
- data/spec/unit/util_spec.rb +1 -0
- metadata +32 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0be09a32fde3ad8b5856c2e4b215d20201a6de1d890f1ede3cf27e471dfd50fd
|
4
|
+
data.tar.gz: 3573e66a75ce2fc88939e72bda7b915a7469506da713f19f8b80522a35849f58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08780b59675a42aeea9f523e253c23d393fa745bc66e73a5c79c6c3d6d6fa0462fa3e4ddf388b56668c32f80708671a1d2b9dbd6a9b918d4cecdfae37404a0f9'
|
7
|
+
data.tar.gz: 07fd46b83cf7b0391ba4729ad16cdcc88e73b2aacc1c7457855833c60ac4b55defd22914fba9f9cbe48bf5df42cad1bf34d2ddefc6db0918d651710cbbe549d2
|
data/kanrisuru.gemspec
CHANGED
@@ -9,19 +9,19 @@ Gem::Specification.new do |gem|
|
|
9
9
|
gem.email = 'ryan@avamia.com'
|
10
10
|
gem.license = 'MIT'
|
11
11
|
gem.summary = 'Manage remote servers over ssh with ruby.'
|
12
|
+
gem.description = 'Manage remote servers over ssh with ruby.'
|
12
13
|
gem.homepage = 'https://github.com/avamia/kanrisuru'
|
13
14
|
|
14
|
-
gem.required_ruby_version
|
15
|
-
gem.required_rubygems_version = '>= 1.8.11'
|
15
|
+
gem.required_ruby_version = '>= 2.5.0'
|
16
16
|
|
17
|
-
gem.add_development_dependency 'rspec', '
|
18
|
-
gem.add_development_dependency 'rubocop', '
|
19
|
-
gem.add_development_dependency 'rubocop-rspec', '
|
20
|
-
gem.add_development_dependency 'simplecov', '
|
17
|
+
gem.add_development_dependency 'rspec', '~> 3.10'
|
18
|
+
gem.add_development_dependency 'rubocop', '~> 1.12'
|
19
|
+
gem.add_development_dependency 'rubocop-rspec', '~> 2.2'
|
20
|
+
gem.add_development_dependency 'simplecov', '~> 0.21'
|
21
21
|
|
22
|
-
gem.add_runtime_dependency 'net-ping', '
|
23
|
-
gem.add_runtime_dependency 'net-scp', '
|
24
|
-
gem.add_runtime_dependency 'net-ssh', '
|
22
|
+
gem.add_runtime_dependency 'net-ping', '~> 2.0'
|
23
|
+
gem.add_runtime_dependency 'net-scp', '~> 3.0'
|
24
|
+
gem.add_runtime_dependency 'net-ssh', '~> 6.1'
|
25
25
|
|
26
26
|
gem.files = `git ls-files`.split("\n")
|
27
27
|
gem.require_paths = ['lib']
|
data/lib/kanrisuru/core.rb
CHANGED
@@ -16,6 +16,7 @@ require_relative 'core/ip'
|
|
16
16
|
require_relative 'core/socket'
|
17
17
|
require_relative 'core/apt'
|
18
18
|
require_relative 'core/yum'
|
19
|
+
require_relative 'core/zypper'
|
19
20
|
|
20
21
|
module Kanrisuru
|
21
22
|
module Remote
|
@@ -36,6 +37,7 @@ module Kanrisuru
|
|
36
37
|
os_include Kanrisuru::Core::Socket
|
37
38
|
os_include Kanrisuru::Core::Apt
|
38
39
|
os_include Kanrisuru::Core::Yum
|
40
|
+
os_include Kanrisuru::Core::Zypper
|
39
41
|
end
|
40
42
|
|
41
43
|
class Cluster
|
@@ -54,6 +56,7 @@ module Kanrisuru
|
|
54
56
|
os_collection Kanrisuru::Core::Socket
|
55
57
|
os_collection Kanrisuru::Core::Apt
|
56
58
|
os_collection Kanrisuru::Core::Yum
|
59
|
+
os_collection Kanrisuru::Core::Zypper
|
57
60
|
end
|
58
61
|
end
|
59
62
|
end
|
data/lib/kanrisuru/core/path.rb
CHANGED
data/lib/kanrisuru/core/yum.rb
CHANGED
@@ -67,7 +67,7 @@ module Kanrisuru
|
|
67
67
|
def append_file!
|
68
68
|
@file.append do |f|
|
69
69
|
@entries.each do |_, entry|
|
70
|
-
f << entry.to_s if entry[:new]
|
70
|
+
f << entry[:entry].to_s if entry[:new]
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -78,13 +78,22 @@ module Kanrisuru
|
|
78
78
|
def write_file!
|
79
79
|
@file.write do |f|
|
80
80
|
@entries.each do |_, entry|
|
81
|
-
f << entry.to_s
|
81
|
+
f << entry[:entry].to_s
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
reload!
|
86
86
|
end
|
87
87
|
|
88
|
+
def to_s
|
89
|
+
lines = []
|
90
|
+
@entries.each do |_, entry|
|
91
|
+
lines << entry[:entry].to_s
|
92
|
+
end
|
93
|
+
|
94
|
+
lines.join("\n")
|
95
|
+
end
|
96
|
+
|
88
97
|
def reload!
|
89
98
|
init_from_os
|
90
99
|
end
|
data/lib/kanrisuru/remote/os.rb
CHANGED
data/lib/kanrisuru/util/bits.rb
CHANGED
@@ -13,11 +13,11 @@ module Kanrisuru
|
|
13
13
|
case unit.downcase
|
14
14
|
when 'b'
|
15
15
|
Kanrisuru::Util::Bits.convert_bytes(size, :byte, :kilobyte)
|
16
|
-
when 'kb', 'k'
|
16
|
+
when 'kb', 'k', 'kib'
|
17
17
|
size
|
18
|
-
when 'mb', 'm'
|
18
|
+
when 'mb', 'm', 'mib'
|
19
19
|
Kanrisuru::Util::Bits.convert_from_mb(size, :kilobyte).to_i
|
20
|
-
when 'gb', 'g'
|
20
|
+
when 'gb', 'g', 'gib'
|
21
21
|
Kanrisuru::Util::Bits.convert_from_gb(size, :kilobyte).to_i
|
22
22
|
end
|
23
23
|
end
|
@@ -163,24 +163,27 @@ module Kanrisuru
|
|
163
163
|
state: 'current',
|
164
164
|
type: 'distribution'
|
165
165
|
},
|
166
|
-
|
167
|
-
name: '
|
166
|
+
sles: {
|
167
|
+
name: 'SUSE Linux Enterprise Server',
|
168
168
|
os_family: 'linux',
|
169
169
|
upstream: 'linux',
|
170
|
-
model: '
|
170
|
+
model: 'commercial',
|
171
171
|
state: 'current',
|
172
172
|
type: 'distribution'
|
173
173
|
},
|
174
174
|
opensuse_leap: {
|
175
175
|
name: 'openSUSE Leap',
|
176
|
-
|
177
|
-
|
176
|
+
os_family: 'linux',
|
177
|
+
upstream: 'sles',
|
178
|
+
model: 'open_source',
|
179
|
+
state: 'current',
|
180
|
+
type: 'distribution'
|
178
181
|
},
|
179
|
-
|
180
|
-
name: '
|
182
|
+
opensuse: {
|
183
|
+
name: 'openSUSE',
|
181
184
|
os_family: 'linux',
|
182
185
|
upstream: 'linux',
|
183
|
-
model: '
|
186
|
+
model: 'open_source',
|
184
187
|
state: 'current',
|
185
188
|
type: 'distribution'
|
186
189
|
}
|
data/lib/kanrisuru/version.rb
CHANGED
@@ -16,6 +16,22 @@ RSpec.describe Kanrisuru::Remote::Fstab do
|
|
16
16
|
host.disconnect
|
17
17
|
end
|
18
18
|
|
19
|
+
it 'outputs string version of fstab' do
|
20
|
+
host.su('root')
|
21
|
+
|
22
|
+
result = host.cat('/etc/fstab')
|
23
|
+
expect(result).to be_success
|
24
|
+
raw_file_lines = []
|
25
|
+
result.each do |line|
|
26
|
+
next if line.match(/^#/) || line == ''
|
27
|
+
|
28
|
+
raw_file_lines << line.split.join(' ')
|
29
|
+
end
|
30
|
+
|
31
|
+
raw_file_output = raw_file_lines.join("\n")
|
32
|
+
expect(raw_file_output).to eq(host.fstab.to_s)
|
33
|
+
end
|
34
|
+
|
19
35
|
it 'parses fstab' do
|
20
36
|
host.su('root')
|
21
37
|
fstab = host.fstab
|
data/spec/unit/util_spec.rb
CHANGED
@@ -59,6 +59,7 @@ RSpec.describe Kanrisuru::Util do
|
|
59
59
|
expect(Kanrisuru::Util::OsFamily.upstream_include_distribution?('linux', 'linux_mint')).to eq(true)
|
60
60
|
|
61
61
|
expect(Kanrisuru::Util::OsFamily.upstream_include_distribution?('fedora', 'redhat')).to eq(true)
|
62
|
+
expect(Kanrisuru::Util::OsFamily.upstream_include_distribution?('sles', 'opensuse_leap')).to eq(true)
|
62
63
|
expect(Kanrisuru::Util::OsFamily.upstream_include_distribution?('fedora', 'centos')).to eq(true)
|
63
64
|
|
64
65
|
expect(Kanrisuru::Util::OsFamily.upstream_include_distribution?('unix_like', 'linux_mint')).to eq(false)
|
metadata
CHANGED
@@ -1,114 +1,114 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kanrisuru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Mammina
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.10
|
19
|
+
version: '3.10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.10
|
26
|
+
version: '3.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.12
|
33
|
+
version: '1.12'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.12
|
40
|
+
version: '1.12'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.2
|
47
|
+
version: '2.2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.2
|
54
|
+
version: '2.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.21
|
61
|
+
version: '0.21'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.21
|
68
|
+
version: '0.21'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: net-ping
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.0
|
75
|
+
version: '2.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.0
|
82
|
+
version: '2.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: net-scp
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.0
|
89
|
+
version: '3.0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.0
|
96
|
+
version: '3.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: net-ssh
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 6.1
|
103
|
+
version: '6.1'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 6.1
|
111
|
-
description:
|
110
|
+
version: '6.1'
|
111
|
+
description: Manage remote servers over ssh with ruby.
|
112
112
|
email: ryan@avamia.com
|
113
113
|
executables: []
|
114
114
|
extensions: []
|
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
218
|
requirements:
|
219
219
|
- - ">="
|
220
220
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
221
|
+
version: '0'
|
222
222
|
requirements: []
|
223
223
|
rubygems_version: 3.1.2
|
224
224
|
signing_key:
|