kanrisuru 0.11.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/CHANGELOG.md +9 -0
- data/README.md +13 -88
- data/kanrisuru.gemspec +1 -0
- data/lib/kanrisuru/command.rb +7 -0
- data/lib/kanrisuru/core/archive.rb +11 -35
- data/lib/kanrisuru/core/file.rb +4 -11
- data/lib/kanrisuru/core/find.rb +2 -6
- data/lib/kanrisuru/core/mount.rb +14 -15
- data/lib/kanrisuru/core/stream.rb +1 -2
- data/lib/kanrisuru/core/zypper.rb +6 -23
- data/lib/kanrisuru/os_package/collection.rb +58 -0
- data/lib/kanrisuru/os_package/define.rb +34 -0
- data/lib/kanrisuru/os_package/include.rb +163 -0
- data/lib/kanrisuru/os_package.rb +3 -245
- data/lib/kanrisuru/remote/fstab.rb +1 -1
- data/lib/kanrisuru/result.rb +5 -4
- data/lib/kanrisuru/version.rb +1 -1
- data/spec/functional/core/archive_spec.rb +2 -1
- data/spec/functional/core/mount_spec.rb +121 -0
- data/spec/helper/stub_network.rb +1 -1
- data/spec/helper/test_hosts.rb +11 -1
- data/spec/integration/core/apt_spec.rb +2 -3
- data/spec/integration/core/archive_spec.rb +8 -13
- data/spec/integration/core/disk_spec.rb +2 -3
- data/spec/integration/core/dmi_spec.rb +2 -3
- data/spec/integration/core/file_spec.rb +4 -13
- data/spec/integration/core/find_spec.rb +2 -3
- data/spec/integration/core/group_spec.rb +2 -3
- data/spec/integration/core/ip_spec.rb +2 -3
- data/spec/integration/core/path_spec.rb +2 -3
- data/spec/integration/core/socket_spec.rb +2 -4
- data/spec/integration/core/stat_spec.rb +2 -3
- data/spec/integration/core/stream_spec.rb +6 -9
- data/spec/integration/core/system_spec.rb +2 -3
- data/spec/integration/core/transfer_spec.rb +4 -9
- data/spec/integration/core/user_spec.rb +2 -4
- data/spec/integration/core/yum_spec.rb +2 -3
- data/spec/integration/core/zypper_spec.rb +2 -3
- data/spec/integration/remote/cpu_spec.rb +2 -3
- data/spec/integration/remote/env_spec.rb +2 -3
- data/spec/integration/remote/fstab_spec.rb +2 -3
- data/spec/integration/remote/host_spec.rb +2 -3
- data/spec/integration/remote/memory_spec.rb +2 -2
- data/spec/integration/remote/os_spec.rb +2 -3
- data/spec/integration/remote/remote_file_spec.rb +9 -15
- data/spec/spec_helper.rb +12 -3
- data/spec/unit/command_spec.rb +18 -0
- metadata +21 -3
@@ -2,22 +2,20 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json, spec_dir|
|
6
|
+
RSpec.describe Kanrisuru::Core::Archive do
|
7
7
|
context "with #{os_name}" do
|
8
8
|
before(:all) do
|
9
|
-
host_json = TestHosts.host(os_name)
|
10
9
|
host = Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
12
11
|
username: host_json['username'],
|
13
12
|
keys: [host_json['ssh_key']]
|
14
13
|
)
|
15
14
|
|
16
|
-
host.mkdir(
|
15
|
+
host.mkdir(spec_dir, silent: true)
|
17
16
|
host.disconnect
|
18
17
|
end
|
19
18
|
|
20
|
-
let(:host_json) { TestHosts.host(os_name) }
|
21
19
|
let(:host) do
|
22
20
|
Kanrisuru::Remote::Host.new(
|
23
21
|
host: host_json['hostname'],
|
@@ -26,22 +24,19 @@ RSpec.describe Kanrisuru::Core::Archive do
|
|
26
24
|
)
|
27
25
|
end
|
28
26
|
|
29
|
-
let(:spec_dir) { "#{host_json['home']}/.kanrisuru_spec_files" }
|
30
|
-
|
31
27
|
after do
|
32
28
|
host.disconnect
|
33
29
|
end
|
34
30
|
|
35
31
|
after(:all) do
|
36
|
-
host_json = TestHosts.host(os_name)
|
37
32
|
host = Kanrisuru::Remote::Host.new(
|
38
33
|
host: host_json['hostname'],
|
39
34
|
username: host_json['username'],
|
40
35
|
keys: [host_json['ssh_key']]
|
41
36
|
)
|
42
37
|
|
43
|
-
host.rmdir(
|
44
|
-
host.rmdir("#{
|
38
|
+
host.rmdir(spec_dir)
|
39
|
+
host.rmdir("#{spec_dir}/extract-tar-files") if host.dir?("#{spec_dir}/extract-tar-files")
|
45
40
|
host.disconnect
|
46
41
|
end
|
47
42
|
|
@@ -126,10 +121,10 @@ RSpec.describe Kanrisuru::Core::Archive do
|
|
126
121
|
paths = result.map(&:path)
|
127
122
|
expect(paths.include?('test2.config')).to eq(false)
|
128
123
|
|
129
|
-
host.mkdir("#{
|
130
|
-
host.tar('extract', 'archive.tar', directory: "#{
|
124
|
+
host.mkdir("#{spec_dir}/extract-tar-files", silent: true)
|
125
|
+
host.tar('extract', 'archive.tar', directory: "#{spec_dir}/extract-tar-files")
|
131
126
|
|
132
|
-
result = host.ls(path: "#{
|
127
|
+
result = host.ls(path: "#{spec_dir}/extract-tar-files")
|
133
128
|
paths = result.map(&:path)
|
134
129
|
|
135
130
|
expect(paths.include?('test1.config')).to eq(true)
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::Disk do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::Dmi do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,22 +2,20 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json, spec_dir|
|
6
|
+
RSpec.describe Kanrisuru::Core::File do
|
7
7
|
context "with #{os_name}" do
|
8
8
|
before(:all) do
|
9
|
-
host_json = TestHosts.host(os_name)
|
10
9
|
host = Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
12
11
|
username: host_json['username'],
|
13
12
|
keys: [host_json['ssh_key']]
|
14
13
|
)
|
15
14
|
|
16
|
-
host.mkdir(
|
15
|
+
host.mkdir(spec_dir, silent: true)
|
17
16
|
host.disconnect
|
18
17
|
end
|
19
18
|
|
20
|
-
let(:host_json) { TestHosts.host(os_name) }
|
21
19
|
let(:host) do
|
22
20
|
Kanrisuru::Remote::Host.new(
|
23
21
|
host: host_json['hostname'],
|
@@ -26,25 +24,18 @@ RSpec.describe Kanrisuru::Core::File do
|
|
26
24
|
)
|
27
25
|
end
|
28
26
|
|
29
|
-
let(:spec_dir) { "#{host_json['home']}/.kanrisuru_spec_files" }
|
30
|
-
|
31
27
|
after do
|
32
28
|
host.disconnect
|
33
29
|
end
|
34
30
|
|
35
31
|
after(:all) do
|
36
|
-
host_json = TestHosts.host(os_name)
|
37
32
|
host = Kanrisuru::Remote::Host.new(
|
38
33
|
host: host_json['hostname'],
|
39
34
|
username: host_json['username'],
|
40
35
|
keys: [host_json['ssh_key']]
|
41
36
|
)
|
42
37
|
|
43
|
-
host.rm(
|
44
|
-
if host.dir?("#{host_json['home']}/extract-tar-files")
|
45
|
-
host.rm("#{host_json['home']}/extract-tar-files", force: true,
|
46
|
-
recursive: true)
|
47
|
-
end
|
38
|
+
host.rm(spec_dir, force: true, recursive: true)
|
48
39
|
host.disconnect
|
49
40
|
end
|
50
41
|
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::Find do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::Group do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::IP do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::Path do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::Socket do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
|
-
|
10
8
|
let(:host) do
|
11
9
|
Kanrisuru::Remote::Host.new(
|
12
10
|
host: host_json['hostname'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::Stat do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -1,21 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
TestHosts.each_os do |os_name, host_json, spec_dir|
|
6
|
+
RSpec.describe Kanrisuru::Core::Stream do
|
5
7
|
context "with #{os_name}" do
|
6
8
|
before(:all) do
|
7
|
-
host_json = TestHosts.host(os_name)
|
8
9
|
host = Kanrisuru::Remote::Host.new(
|
9
10
|
host: host_json['hostname'],
|
10
11
|
username: host_json['username'],
|
11
12
|
keys: [host_json['ssh_key']]
|
12
13
|
)
|
13
14
|
|
14
|
-
host.mkdir(
|
15
|
+
host.mkdir(spec_dir, silent: true)
|
15
16
|
host.disconnect
|
16
17
|
end
|
17
18
|
|
18
|
-
let(:host_json) { TestHosts.host(os_name) }
|
19
19
|
let(:host) do
|
20
20
|
Kanrisuru::Remote::Host.new(
|
21
21
|
host: host_json['hostname'],
|
@@ -24,21 +24,18 @@ RSpec.describe Kanrisuru::Core::Stream do
|
|
24
24
|
)
|
25
25
|
end
|
26
26
|
|
27
|
-
let(:spec_dir) { "#{host_json['home']}/.kanrisuru_spec_files" }
|
28
|
-
|
29
27
|
after do
|
30
28
|
host.disconnect
|
31
29
|
end
|
32
30
|
|
33
31
|
after(:all) do
|
34
|
-
host_json = TestHosts.host(os_name)
|
35
32
|
host = Kanrisuru::Remote::Host.new(
|
36
33
|
host: host_json['hostname'],
|
37
34
|
username: host_json['username'],
|
38
35
|
keys: [host_json['ssh_key']]
|
39
36
|
)
|
40
37
|
|
41
|
-
host.rmdir(
|
38
|
+
host.rmdir(spec_dir)
|
42
39
|
host.disconnect
|
43
40
|
end
|
44
41
|
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::System do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,22 +2,20 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json, spec_dir|
|
6
|
+
RSpec.describe Kanrisuru::Core::File do
|
7
7
|
context "with #{os_name}" do
|
8
8
|
before(:all) do
|
9
|
-
host_json = TestHosts.host(os_name)
|
10
9
|
host = Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
12
11
|
username: host_json['username'],
|
13
12
|
keys: [host_json['ssh_key']]
|
14
13
|
)
|
15
14
|
|
16
|
-
host.mkdir(
|
15
|
+
host.mkdir(spec_dir, silent: true)
|
17
16
|
host.disconnect
|
18
17
|
end
|
19
18
|
|
20
|
-
let(:host_json) { TestHosts.host(os_name) }
|
21
19
|
let(:host) do
|
22
20
|
Kanrisuru::Remote::Host.new(
|
23
21
|
host: host_json['hostname'],
|
@@ -26,21 +24,18 @@ RSpec.describe Kanrisuru::Core::File do
|
|
26
24
|
)
|
27
25
|
end
|
28
26
|
|
29
|
-
let(:spec_dir) { "#{host_json['home']}/.kanrisuru_spec_files" }
|
30
|
-
|
31
27
|
after do
|
32
28
|
host.disconnect
|
33
29
|
end
|
34
30
|
|
35
31
|
after(:all) do
|
36
|
-
host_json = TestHosts.host(os_name)
|
37
32
|
host = Kanrisuru::Remote::Host.new(
|
38
33
|
host: host_json['hostname'],
|
39
34
|
username: host_json['username'],
|
40
35
|
keys: [host_json['ssh_key']]
|
41
36
|
)
|
42
37
|
|
43
|
-
host.rmdir(
|
38
|
+
host.rmdir(spec_dir)
|
44
39
|
host.disconnect
|
45
40
|
end
|
46
41
|
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::User do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -19,7 +18,6 @@ RSpec.describe Kanrisuru::Core::User do
|
|
19
18
|
end
|
20
19
|
|
21
20
|
after(:all) do
|
22
|
-
host_json = TestHosts.host(os_name)
|
23
21
|
host = Kanrisuru::Remote::Host.new(
|
24
22
|
host: host_json['hostname'],
|
25
23
|
username: host_json['username'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os(only: %w[fedora rhel centos]) do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::Yum do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os(only: %w[sles opensuse]) do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Core::Zypper do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Remote::Cpu do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Remote::Env do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -1,9 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
TestHosts.each_os do |os_name. host_json|
|
4
|
+
RSpec.describe Kanrisuru::Remote::Fstab do
|
5
5
|
context "with #{os_name}" do
|
6
|
-
let(:host_json) { TestHosts.host(os_name) }
|
7
6
|
let(:host) do
|
8
7
|
Kanrisuru::Remote::Host.new(
|
9
8
|
host: host_json['hostname'],
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Remote::Host do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
described_class.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name|
|
6
|
+
RSpec.describe Kanrisuru::Remote::Memory do
|
7
7
|
context "with #{os_name}" do
|
8
8
|
let(:host_json) { TestHosts.host(os_name) }
|
9
9
|
let(:host) do
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
TestHosts.each_os do |os_name, host_json|
|
6
|
+
RSpec.describe Kanrisuru::Remote::Os do
|
7
7
|
context "with #{os_name}" do
|
8
|
-
let(:host_json) { TestHosts.host(os_name) }
|
9
8
|
let(:host) do
|
10
9
|
Kanrisuru::Remote::Host.new(
|
11
10
|
host: host_json['hostname'],
|
@@ -1,29 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
READ_FILE_SIZE = 25_000
|
8
|
-
end
|
3
|
+
module Kanrisuru
|
4
|
+
module Remote
|
5
|
+
Class.new(File) do
|
6
|
+
READ_FILE_SIZE = 25_000
|
9
7
|
end
|
10
8
|
end
|
9
|
+
end
|
11
10
|
|
12
|
-
|
11
|
+
TestHosts.each_os do |os_name, host_json, spec_dir|
|
12
|
+
RSpec.describe Kanrisuru::Remote::File do
|
13
13
|
context "with #{os_name}" do
|
14
14
|
before(:all) do
|
15
|
-
host_json = TestHosts.host(os_name)
|
16
15
|
host = Kanrisuru::Remote::Host.new(
|
17
16
|
host: host_json['hostname'],
|
18
17
|
username: host_json['username'],
|
19
18
|
keys: [host_json['ssh_key']]
|
20
19
|
)
|
21
20
|
|
22
|
-
host.mkdir(
|
21
|
+
host.mkdir(spec_dir, silent: true)
|
23
22
|
host.disconnect
|
24
23
|
end
|
25
24
|
|
26
|
-
let(:host_json) { TestHosts.host(os_name) }
|
27
25
|
let(:host) do
|
28
26
|
Kanrisuru::Remote::Host.new(
|
29
27
|
host: host_json['hostname'],
|
@@ -32,22 +30,18 @@ RSpec.describe Kanrisuru::Remote::File do
|
|
32
30
|
)
|
33
31
|
end
|
34
32
|
|
35
|
-
let(:spec_dir) { "#{host_json['home']}/.kanrisuru_spec_files" }
|
36
|
-
|
37
33
|
after do
|
38
34
|
host.disconnect
|
39
35
|
end
|
40
36
|
|
41
37
|
after(:all) do
|
42
|
-
host_json = TestHosts.host(os_name)
|
43
38
|
host = Kanrisuru::Remote::Host.new(
|
44
39
|
host: host_json['hostname'],
|
45
40
|
username: host_json['username'],
|
46
41
|
keys: [host_json['ssh_key']]
|
47
42
|
)
|
48
43
|
|
49
|
-
host.rmdir(
|
50
|
-
host.rmdir("#{host_json['home']}/extract-tar-files") if host.dir?("#{host_json['home']}/extract-tar-files")
|
44
|
+
host.rmdir(spec_dir)
|
51
45
|
host.disconnect
|
52
46
|
end
|
53
47
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'simplecov'
|
4
|
-
SimpleCov.start
|
5
|
-
|
6
4
|
require 'simplecov-cobertura'
|
7
|
-
|
5
|
+
|
6
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
|
7
|
+
SimpleCov::Formatter::HTMLFormatter,
|
8
|
+
SimpleCov::Formatter::CoberturaFormatter
|
9
|
+
])
|
10
|
+
|
11
|
+
SimpleCov.use_merging true
|
12
|
+
SimpleCov.command_name("kanrisuru-tests" + (ENV['TEST_ENV_NUMBER'] || ''))
|
13
|
+
|
14
|
+
SimpleCov.start
|
8
15
|
|
9
16
|
require 'kanrisuru'
|
10
17
|
|
@@ -21,6 +28,8 @@ RSpec.configure do |config|
|
|
21
28
|
# Disable RSpec exposing methods globally on `Module` and `main`
|
22
29
|
config.disable_monkey_patching!
|
23
30
|
|
31
|
+
config.silence_filter_announcements = true if ENV['TEST_ENV_NUMBER']
|
32
|
+
|
24
33
|
config.expect_with :rspec do |c|
|
25
34
|
c.syntax = :expect
|
26
35
|
end
|
data/spec/unit/command_spec.rb
CHANGED
@@ -28,4 +28,22 @@ RSpec.describe Kanrisuru::Command do
|
|
28
28
|
expect(command).to respond_to(:append_flag)
|
29
29
|
expect(command).to respond_to(:append_valid_exit_code)
|
30
30
|
end
|
31
|
+
|
32
|
+
it 'does not append nil array values' do
|
33
|
+
command = described_class.new('hello')
|
34
|
+
command.append_array(nil)
|
35
|
+
expect(command.raw_command).to eq('hello')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'appends string array values' do
|
39
|
+
command = described_class.new('ls')
|
40
|
+
command.append_array('/etc')
|
41
|
+
expect(command.raw_command).to eq('ls /etc')
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'appends array values' do
|
45
|
+
command = described_class.new('ls')
|
46
|
+
command.append_array(['/proc/', '/etc', '/var', '/dev'])
|
47
|
+
expect(command.raw_command).to eq('ls /proc/ /etc /var /dev')
|
48
|
+
end
|
31
49
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kanrisuru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
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-12-
|
11
|
+
date: 2021-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: parallel_tests
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.7'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rspec
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,6 +184,9 @@ files:
|
|
170
184
|
- lib/kanrisuru/logger.rb
|
171
185
|
- lib/kanrisuru/mode.rb
|
172
186
|
- lib/kanrisuru/os_package.rb
|
187
|
+
- lib/kanrisuru/os_package/collection.rb
|
188
|
+
- lib/kanrisuru/os_package/define.rb
|
189
|
+
- lib/kanrisuru/os_package/include.rb
|
173
190
|
- lib/kanrisuru/remote.rb
|
174
191
|
- lib/kanrisuru/remote/cluster.rb
|
175
192
|
- lib/kanrisuru/remote/cpu.rb
|
@@ -191,6 +208,7 @@ files:
|
|
191
208
|
- spec/functional/core/apt_spec.rb
|
192
209
|
- spec/functional/core/archive_spec.rb
|
193
210
|
- spec/functional/core/find_spec.rb
|
211
|
+
- spec/functional/core/mount_spec.rb
|
194
212
|
- spec/functional/core/path_spec.rb
|
195
213
|
- spec/functional/core/socket_spec.rb
|
196
214
|
- spec/functional/core/stat_spec.rb
|
@@ -278,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
278
296
|
- !ruby/object:Gem::Version
|
279
297
|
version: '0'
|
280
298
|
requirements: []
|
281
|
-
rubygems_version: 3.
|
299
|
+
rubygems_version: 3.2.32
|
282
300
|
signing_key:
|
283
301
|
specification_version: 4
|
284
302
|
summary: Manage remote servers over ssh with ruby.
|