kanrisuru 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -1
  3. data/CHANGELOG.md +9 -0
  4. data/README.md +13 -88
  5. data/kanrisuru.gemspec +1 -0
  6. data/lib/kanrisuru/command.rb +7 -0
  7. data/lib/kanrisuru/core/archive.rb +11 -35
  8. data/lib/kanrisuru/core/file.rb +4 -11
  9. data/lib/kanrisuru/core/find.rb +2 -6
  10. data/lib/kanrisuru/core/mount.rb +14 -15
  11. data/lib/kanrisuru/core/stream.rb +1 -2
  12. data/lib/kanrisuru/core/zypper.rb +6 -23
  13. data/lib/kanrisuru/os_package/collection.rb +58 -0
  14. data/lib/kanrisuru/os_package/define.rb +34 -0
  15. data/lib/kanrisuru/os_package/include.rb +163 -0
  16. data/lib/kanrisuru/os_package.rb +3 -245
  17. data/lib/kanrisuru/remote/fstab.rb +1 -1
  18. data/lib/kanrisuru/result.rb +5 -4
  19. data/lib/kanrisuru/version.rb +1 -1
  20. data/spec/functional/core/archive_spec.rb +2 -1
  21. data/spec/functional/core/mount_spec.rb +121 -0
  22. data/spec/helper/stub_network.rb +1 -1
  23. data/spec/helper/test_hosts.rb +11 -1
  24. data/spec/integration/core/apt_spec.rb +2 -3
  25. data/spec/integration/core/archive_spec.rb +8 -13
  26. data/spec/integration/core/disk_spec.rb +2 -3
  27. data/spec/integration/core/dmi_spec.rb +2 -3
  28. data/spec/integration/core/file_spec.rb +4 -13
  29. data/spec/integration/core/find_spec.rb +2 -3
  30. data/spec/integration/core/group_spec.rb +2 -3
  31. data/spec/integration/core/ip_spec.rb +2 -3
  32. data/spec/integration/core/path_spec.rb +2 -3
  33. data/spec/integration/core/socket_spec.rb +2 -4
  34. data/spec/integration/core/stat_spec.rb +2 -3
  35. data/spec/integration/core/stream_spec.rb +6 -9
  36. data/spec/integration/core/system_spec.rb +2 -3
  37. data/spec/integration/core/transfer_spec.rb +4 -9
  38. data/spec/integration/core/user_spec.rb +2 -4
  39. data/spec/integration/core/yum_spec.rb +2 -3
  40. data/spec/integration/core/zypper_spec.rb +2 -3
  41. data/spec/integration/remote/cpu_spec.rb +2 -3
  42. data/spec/integration/remote/env_spec.rb +2 -3
  43. data/spec/integration/remote/fstab_spec.rb +2 -3
  44. data/spec/integration/remote/host_spec.rb +2 -3
  45. data/spec/integration/remote/memory_spec.rb +2 -2
  46. data/spec/integration/remote/os_spec.rb +2 -3
  47. data/spec/integration/remote/remote_file_spec.rb +9 -15
  48. data/spec/spec_helper.rb +12 -3
  49. data/spec/unit/command_spec.rb +18 -0
  50. metadata +21 -3
@@ -2,22 +2,20 @@
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
- RSpec.describe Kanrisuru::Core::Archive do
6
- TestHosts.each_os do |os_name|
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("#{host_json['home']}/.kanrisuru_spec_files", silent: true)
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("#{host_json['home']}/.kanrisuru_spec_files")
44
- host.rmdir("#{host_json['home']}/extract-tar-files") if host.dir?("#{host_json['home']}/extract-tar-files")
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("#{host_json['home']}/extract-tar-files", silent: true)
130
- host.tar('extract', 'archive.tar', directory: "#{host_json['home']}/extract-tar-files")
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: "#{host_json['home']}/extract-tar-files")
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
- RSpec.describe Kanrisuru::Core::Disk do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::Dmi do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::File do
6
- TestHosts.each_os do |os_name|
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("#{host_json['home']}/.kanrisuru_spec_files", silent: true)
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("#{host_json['home']}/.kanrisuru_spec_files", force: true, recursive: true)
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
- RSpec.describe Kanrisuru::Core::Find do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::Group do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::IP do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::Path do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::Socket do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::Stat do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::Stream do
4
- TestHosts.each_os do |os_name|
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("#{host_json['home']}/.kanrisuru_spec_files", silent: true)
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("#{host_json['home']}/.kanrisuru_spec_files")
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
- RSpec.describe Kanrisuru::Core::System do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::File do
6
- TestHosts.each_os do |os_name|
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("#{host_json['home']}/.kanrisuru_spec_files", silent: true)
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("#{host_json['home']}/.kanrisuru_spec_files")
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
- RSpec.describe Kanrisuru::Core::User do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Core::Yum do
6
- TestHosts.each_os(only: %w[fedora rhel centos]) do |os_name|
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
- RSpec.describe Kanrisuru::Core::Zypper do
6
- TestHosts.each_os(only: %w[sles opensuse]) do |os_name|
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
- RSpec.describe Kanrisuru::Remote::Cpu do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Remote::Env do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Remote::Fstab do
4
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Remote::Host do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Remote::Memory do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Remote::Os do
6
- TestHosts.each_os do |os_name|
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
- RSpec.describe Kanrisuru::Remote::File do
4
- module Kanrisuru
5
- module Remote
6
- Class.new(File) do
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
- TestHosts.each_os do |os_name|
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("#{host_json['home']}/.kanrisuru_spec_files", silent: true)
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("#{host_json['home']}/.kanrisuru_spec_files")
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
- SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
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
@@ -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.11.1
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-04 00:00:00.000000000 Z
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.1.2
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.