kanrisuru 0.9.1 → 0.11.1

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CONTRIBUTING.md +9 -9
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +7 -8
  4. data/.gitignore +3 -1
  5. data/CHANGELOG.md +151 -130
  6. data/CODE_OF_CONDUCT.md +10 -10
  7. data/README.md +8 -3
  8. data/kanrisuru.gemspec +2 -1
  9. data/lib/kanrisuru/core/archive.rb +6 -5
  10. data/lib/kanrisuru/core/disk.rb +0 -3
  11. data/lib/kanrisuru/core/dmi.rb +1 -1
  12. data/lib/kanrisuru/core/file.rb +2 -2
  13. data/lib/kanrisuru/core/find.rb +4 -5
  14. data/lib/kanrisuru/core/socket.rb +2 -1
  15. data/lib/kanrisuru/core/stream.rb +1 -1
  16. data/lib/kanrisuru/core/zypper.rb +3 -3
  17. data/lib/kanrisuru/remote/cpu.rb +5 -1
  18. data/lib/kanrisuru/remote/env.rb +8 -0
  19. data/lib/kanrisuru/remote/fstab.rb +4 -4
  20. data/lib/kanrisuru/util.rb +1 -1
  21. data/lib/kanrisuru/version.rb +1 -1
  22. data/spec/functional/core/apt_spec.rb +22 -30
  23. data/spec/functional/core/archive_spec.rb +169 -0
  24. data/spec/functional/core/find_spec.rb +94 -113
  25. data/spec/functional/core/socket_spec.rb +23 -28
  26. data/spec/functional/core/stream_spec.rb +12 -12
  27. data/spec/functional/core/transfer_spec.rb +108 -131
  28. data/spec/functional/core/yum_spec.rb +58 -83
  29. data/spec/functional/remote/cluster_spec.rb +12 -3
  30. data/spec/functional/remote/cpu_spec.rb +104 -0
  31. data/spec/functional/remote/env_spec.rb +48 -0
  32. data/spec/helper/stub_network.rb +57 -14
  33. data/spec/integration/core/file_spec.rb +0 -1
  34. data/spec/integration/core/find_spec.rb +1 -0
  35. data/spec/integration/core/system_spec.rb +0 -1
  36. data/spec/integration/core/zypper_spec.rb +3 -3
  37. data/spec/{functional → integration}/os_package_spec.rb +0 -0
  38. data/spec/spec_helper.rb +3 -0
  39. data/spec/unit/command_spec.rb +31 -0
  40. data/spec/unit/core/apt_spec.rb +20 -0
  41. data/spec/unit/core/archive_spec.rb +20 -0
  42. data/spec/unit/core/disk_spec.rb +23 -0
  43. data/spec/unit/core/dmi_spec.rb +20 -0
  44. data/spec/unit/core/file_spec.rb +35 -0
  45. data/spec/unit/core/find_spec.rb +21 -1
  46. data/spec/unit/core/group_spec.rb +24 -0
  47. data/spec/unit/core/ip_spec.rb +20 -0
  48. data/spec/unit/core/path_spec.rb +25 -0
  49. data/spec/unit/core/socket_spec.rb +20 -0
  50. data/spec/unit/core/stat_spec.rb +27 -0
  51. data/spec/unit/core/system_spec.rb +35 -0
  52. data/spec/unit/core/transfer_spec.rb +22 -0
  53. data/spec/unit/core/user_spec.rb +25 -0
  54. data/spec/unit/core/yum_spec.rb +20 -0
  55. data/spec/unit/core/zypper_spec.rb +20 -0
  56. data/spec/unit/mode_spec.rb +33 -2
  57. data/spec/unit/remote/cluster_spec.rb +36 -0
  58. data/spec/unit/remote/cpu_spec.rb +3 -4
  59. data/spec/unit/remote/env_spec.rb +17 -0
  60. data/spec/unit/{fstab_spec.rb → remote/fstab_spec.rb} +0 -0
  61. data/spec/unit/util_spec.rb +13 -0
  62. metadata +26 -5
@@ -10,7 +10,7 @@ module Kanrisuru
10
10
  os_define :linux, :find
11
11
 
12
12
  FilePath = Struct.new(:path)
13
- REGEX_TYPES = ['emacs', 'posix-awk', 'posix-basic', 'posix-egrep', 'posix-extended']
13
+ REGEX_TYPES = %w[emacs posix-awk posix-basic posix-egrep posix-extended].freeze
14
14
 
15
15
  def find(opts = {})
16
16
  paths = opts[:paths]
@@ -66,9 +66,7 @@ module Kanrisuru
66
66
  command.append_arg('-mmin', opts[:mmin])
67
67
 
68
68
  if Kanrisuru::Util.present?(opts[:regex_type])
69
- unless REGEX_TYPES.include?(opts[:regex_type])
70
- raise ArgumentError, 'invalid regex type'
71
- end
69
+ raise ArgumentError, 'invalid regex type' unless REGEX_TYPES.include?(opts[:regex_type])
72
70
 
73
71
  command.append_arg('-regextype', opts[:regex_type])
74
72
  end
@@ -77,7 +75,8 @@ module Kanrisuru
77
75
 
78
76
  if size.instance_of?(String)
79
77
  regex = Regexp.new(/^([-+])?(\d+)([bcwkMG])*$/)
80
- raise ArgumentError, "invalid size string: '#{@size}'" unless regex.match?(size)
78
+ raise ArgumentError, "invalid size string: '#{@size}'" unless regex.match?(size)
79
+
81
80
  command.append_arg('-size', size)
82
81
  elsif size.instance_of?(Integer)
83
82
  command.append_arg('-size', size)
@@ -59,7 +59,8 @@ module Kanrisuru
59
59
  command.append_flag('-w', opts[:raw])
60
60
 
61
61
  if Kanrisuru::Util.present?(family)
62
- raise ArgumentError, 'invalid family type' if !NETWORK_FAMILIES.include?(family)
62
+ raise ArgumentError, 'invalid family type' unless NETWORK_FAMILIES.include?(family)
63
+
63
64
  command.append_arg('-f', family)
64
65
  end
65
66
 
@@ -95,7 +95,7 @@ module Kanrisuru
95
95
  command.append_flag('-b', opts[:number_nonblank])
96
96
  command.append_flag('-A', opts[:show_all])
97
97
 
98
- files = files.instance_of?(String) ? [files] : files
98
+ files = [files] if files.instance_of?(String)
99
99
  command << files.join(' ')
100
100
 
101
101
  append_file(command, opts)
@@ -278,7 +278,7 @@ module Kanrisuru
278
278
 
279
279
  repos = opts[:repos]
280
280
  if Kanrisuru::Util.present?(repos)
281
- repos = repos.instance_of?(String) ? [repos] : repos
281
+ repos = [repos] if repos.instance_of?(String)
282
282
  command << repos.join(' ')
283
283
  end
284
284
 
@@ -374,7 +374,7 @@ module Kanrisuru
374
374
 
375
375
  services = opts[:services]
376
376
  if Kanrisuru::Util.present?(services)
377
- services = services.instance_of?(Array) ? services : [services]
377
+ services = [services] if services.instance_of?(String)
378
378
  command << services.join(' ')
379
379
  end
380
380
 
@@ -392,7 +392,7 @@ module Kanrisuru
392
392
 
393
393
  services = opts[:services]
394
394
  if Kanrisuru::Util.present?(services)
395
- services = services.instance_of?(String) ? [services] : services
395
+ services = [services] if services.instance_of?(String)
396
396
  command << services.join(' ')
397
397
  end
398
398
 
@@ -27,6 +27,10 @@ module Kanrisuru
27
27
  load_average[2]
28
28
  end
29
29
 
30
+ def architecture
31
+ @cpu_architecture.architecture
32
+ end
33
+
30
34
  def sockets
31
35
  @cpu_architecture.sockets
32
36
  end
@@ -103,7 +107,7 @@ module Kanrisuru
103
107
  @cpu_architecture.flags
104
108
  end
105
109
 
106
- def hyperthreading?
110
+ def hyperthreading?
107
111
  threads_per_core > 1
108
112
  end
109
113
 
@@ -25,6 +25,14 @@ module Kanrisuru
25
25
  string
26
26
  end
27
27
 
28
+ def count
29
+ @env.count
30
+ end
31
+
32
+ def delete(key)
33
+ @env.delete(key.to_s.upcase)
34
+ end
35
+
28
36
  def [](key)
29
37
  @env[key.to_s.upcase]
30
38
  end
@@ -255,7 +255,7 @@ module Kanrisuru
255
255
  end
256
256
 
257
257
  result = @host.blkid(device: @device)
258
- @uuid = result.success? ? result.uuid : nil
258
+ @uuid = result.success? ? result[0].uuid : nil
259
259
  end
260
260
 
261
261
  def parse_uuid(fsline)
@@ -269,15 +269,15 @@ module Kanrisuru
269
269
  end
270
270
 
271
271
  result = @host.blkid(device: @device)
272
- @label = result.success? ? result.label : nil
272
+ @label = result.success? ? result[0].label : nil
273
273
  end
274
274
 
275
275
  def parse_dev(fsline)
276
276
  @device = fsline
277
277
  result = @host.blkid(device: @device)
278
278
 
279
- @label = result.success? ? result.label : nil
280
- @uuid = result.success? ? result.uuid : nil
279
+ @label = result.success? ? result[0].label : nil
280
+ @uuid = result.success? ? result[0].uuid : nil
281
281
  end
282
282
  end
283
283
 
@@ -24,7 +24,7 @@ module Kanrisuru
24
24
  Kanrisuru.logger.info do
25
25
  'DEPRECATION WARNING: string_join_array will be removed in the upcoming major release. Use array_join_string instead.'
26
26
  end
27
-
27
+
28
28
  array = arg.instance_of?(String) ? [arg] : arg
29
29
  array.join(field)
30
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kanrisuru
4
- VERSION = '0.9.1'
4
+ VERSION = '0.11.1'
5
5
  end
@@ -22,10 +22,9 @@ RSpec.describe Kanrisuru::Core::Apt do
22
22
  it 'prepares apt list command' do
23
23
  expect_command(host.apt('list'), 'apt list')
24
24
  expect_command(host.apt('list',
25
- installed: true,
26
- upgradeable: true,
27
- all_versions: true,
28
- ), 'apt list --installed --upgradeable --all-versions')
25
+ installed: true,
26
+ upgradeable: true,
27
+ all_versions: true), 'apt list --installed --upgradeable --all-versions')
29
28
 
30
29
  expect_command(host.apt('list', package_name: 'nginx'), 'apt list -a nginx')
31
30
  end
@@ -43,28 +42,22 @@ RSpec.describe Kanrisuru::Core::Apt do
43
42
  end
44
43
 
45
44
  it 'prepares apt install command' do
46
- expect_command(host.apt('install',
47
- packages: 'nginx'
48
- ),
49
- 'apt-get install -y nginx'
50
- )
51
-
52
- expect_command(host.apt('install',
53
- packages: 'monit',
54
- no_upgrade: true,
55
- reinstall: true
56
- ),
57
- 'apt-get install -y --no-upgrade --reinstall monit'
58
- )
59
-
60
- expect_command(host.apt('install',
61
- packages: ['build-essential', 'manpages-dev'],
62
- only_upgrade: true,
63
- ),
64
- 'apt-get install -y --only-upgrade build-essential manpages-dev'
65
- )
45
+ expect_command(host.apt('install',
46
+ packages: 'nginx'),
47
+ 'apt-get install -y nginx')
48
+
49
+ expect_command(host.apt('install',
50
+ packages: 'monit',
51
+ no_upgrade: true,
52
+ reinstall: true),
53
+ 'apt-get install -y --no-upgrade --reinstall monit')
54
+
55
+ expect_command(host.apt('install',
56
+ packages: %w[build-essential manpages-dev],
57
+ only_upgrade: true),
58
+ 'apt-get install -y --only-upgrade build-essential manpages-dev')
66
59
  end
67
-
60
+
68
61
  it 'prepares apt remove command' do
69
62
  expect_command(host.apt('remove', packages: ['python']), 'apt-get remove -y python')
70
63
  end
@@ -82,15 +75,14 @@ RSpec.describe Kanrisuru::Core::Apt do
82
75
  end
83
76
 
84
77
  it 'prepares apt show command' do
85
- expect_command(host.apt('show', packages: 'ruby'), 'apt show -a ruby')
86
- end
78
+ expect_command(host.apt('show', packages: 'ruby'), 'apt show -a ruby')
79
+ end
87
80
 
88
81
  it 'prepares apt clean command' do
89
- expect_command(host.apt('clean'), 'apt-get clean')
82
+ expect_command(host.apt('clean'), 'apt-get clean')
90
83
  end
91
84
 
92
85
  it 'prepares apt autoclean command' do
93
- expect_command(host.apt('autoclean'), 'apt-get autoclean')
86
+ expect_command(host.apt('autoclean'), 'apt-get autoclean')
94
87
  end
95
-
96
88
  end
@@ -0,0 +1,169 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe Kanrisuru::Core::Apt do
6
+ before(:all) do
7
+ StubNetwork.stub!
8
+ StubNetwork.stub_command!(:realpath) do |_args|
9
+ Kanrisuru::Core::Path::FilePath.new(directory)
10
+ end
11
+ end
12
+
13
+ after(:all) do
14
+ StubNetwork.unstub_command!(:realpath)
15
+ StubNetwork.unstub!
16
+ end
17
+
18
+ let(:host) do
19
+ Kanrisuru::Remote::Host.new(
20
+ host: 'localhost',
21
+ username: 'ubuntu',
22
+ keys: ['id_rsa']
23
+ )
24
+ end
25
+
26
+ let(:directory) { '/home/ubuntu/dir' }
27
+
28
+ it 'prepares tar list command' do
29
+ %w[list t].each do |action_variant|
30
+ expect_command(host.tar(action_variant, 'file.txt'),
31
+ 'tar --restrict -f file.txt -t')
32
+
33
+ expect_command(host.tar(action_variant, '~/file.txt',
34
+ compress: 'bzip2',
35
+ directory: directory,
36
+ occurrence: 1,
37
+ label: true,
38
+ multi_volume: true),
39
+ 'tar --restrict -C /home/ubuntu/dir -f ~/file.txt -j -t --occurrence 1 --label --multi-volume')
40
+ end
41
+ end
42
+
43
+ it 'prepares tar extract command' do
44
+ %w[extract get x].each do |action_variant|
45
+ expect_command(host.tar(action_variant, 'archive.tar'),
46
+ 'tar --restrict -f archive.tar -x')
47
+
48
+ expect_command(host.tar(action_variant, 'archive.tar',
49
+ compress: 'xz',
50
+ directory: directory,
51
+ occurrence: 2,
52
+ no_same_owner: true,
53
+ no_same_permissions: true,
54
+ no_selinux: true,
55
+ no_xattrs: true,
56
+ multi_volume: true,
57
+ label: true,
58
+ skip_old_files: true,
59
+ overwrite: true,
60
+ overwrite_dir: true,
61
+ unlink_first: true,
62
+ recursive_unlink: true,
63
+ paths: 'file.txt'),
64
+ 'tar --restrict -C /home/ubuntu/dir -f archive.tar -J -x --occurrence 2 --no-same-owner --no-same-permissions --no-selinux --no-xattrs --multi-volume --label --skip-old-files --overwrite --overwrite-dir --unlink-first --recursive-unlink file.txt')
65
+
66
+ expect_command(host.tar(action_variant, 'archive.tar',
67
+ preserve_permissions: true,
68
+ same_owners: true,
69
+ one_file_system: true,
70
+ keep_old_files: true,
71
+ paths: ['file1.txt', 'file2.txt']),
72
+ 'tar --restrict -f archive.tar -x --preserve-permissions --same-owner --one-file-system --keep-old-files file1.txt file2.txt')
73
+ end
74
+ end
75
+
76
+ it 'prepares tar create command' do
77
+ %w[create c].each do |action_variant|
78
+ expect_command(host.tar(action_variant, 'archive.lzma', compress: 'lzma'),
79
+ 'tar --restrict -f archive.lzma --lzma -c')
80
+ expect_command(host.tar(action_variant, 'archive.gz'), 'tar --restrict -f archive.gz -c')
81
+
82
+ expect_command(host.tar(action_variant, 'archive.gz',
83
+ directory: directory,
84
+ compress: 'gzip',
85
+ exclude: 'file2.txt',
86
+ paths: 'file1.txt'),
87
+ 'tar --restrict -C /home/ubuntu/dir -f archive.gz -z -c --exclude=file2.txt file1.txt')
88
+
89
+ expect_command(host.tar(action_variant, 'archive.gz',
90
+ compress: 'gzip',
91
+ exclude: ['file2.txt', 'file4.txt'],
92
+ paths: ['file1.txt', 'file3.txt']),
93
+ 'tar --restrict -f archive.gz -z -c --exclude=file2.txt --exclude=file4.txt file1.txt file3.txt')
94
+ end
95
+ end
96
+
97
+ it 'prepares tar append command' do
98
+ %w[append r].each do |action_variant|
99
+ expect_command(host.tar(action_variant, 'archive.tar'), 'tar --restrict -f archive.tar -r')
100
+
101
+ expect_command(host.tar(action_variant, 'archive.tar',
102
+ directory: directory,
103
+ paths: 'main.conf'),
104
+ 'tar --restrict -C /home/ubuntu/dir -f archive.tar -r main.conf')
105
+
106
+ expect_command(host.tar(action_variant, 'archive.tar',
107
+ paths: ['main.conf', 'main2.conf']),
108
+ 'tar --restrict -f archive.tar -r main.conf main2.conf')
109
+ end
110
+ end
111
+
112
+ it 'prepares tar concat command' do
113
+ %w[catenate concat A].each do |action_variant|
114
+ expect_command(host.tar(action_variant, 'archive.tar'), 'tar --restrict -f archive.tar -A')
115
+ expect_command(host.tar(action_variant, 'archive.tar',
116
+ directory: directory,
117
+ paths: 'archive2.tar'),
118
+ 'tar --restrict -C /home/ubuntu/dir -f archive.tar -A archive2.tar')
119
+
120
+ expect_command(host.tar(action_variant, 'archive.tar',
121
+ directory: directory,
122
+ paths: ['archive2.tar', 'archive3.tar']),
123
+ 'tar --restrict -C /home/ubuntu/dir -f archive.tar -A archive2.tar archive3.tar')
124
+ end
125
+ end
126
+
127
+ it 'prepares tar update command' do
128
+ %w[update u].each do |action_variant|
129
+ expect_command(host.tar(action_variant, 'archive',
130
+ paths: 'file1.txt'),
131
+ 'tar --restrict -f archive -u file1.txt')
132
+
133
+ expect_command(host.tar(action_variant, 'archive',
134
+ directory: directory,
135
+ paths: ['file1.txt', 'file2.txt']),
136
+ 'tar --restrict -C /home/ubuntu/dir -f archive -u file1.txt file2.txt')
137
+ end
138
+ end
139
+
140
+ it 'prepares tar diff command' do
141
+ %w[diff compare d].each do |action_variant|
142
+ expect_command(host.tar(action_variant, 'archive.tar', directory: directory),
143
+ 'tar --restrict -C /home/ubuntu/dir -f archive.tar -d')
144
+ expect_command(host.tar(action_variant, 'archive.tar',
145
+ directory: directory,
146
+ occurrence: 4),
147
+ 'tar --restrict -C /home/ubuntu/dir -f archive.tar -d --occurrence 4')
148
+ end
149
+ end
150
+
151
+ it 'prepares tar delete command' do
152
+ expect_command(host.tar('delete', 'archive.tar', paths: 'file1.txt'),
153
+ 'tar --restrict -f archive.tar --delete file1.txt')
154
+ expect_command(host.tar('delete', 'archive.tar',
155
+ paths: ['file1.txt', 'file2.txt'],
156
+ occurrence: 3),
157
+ 'tar --restrict -f archive.tar --delete --occurrence 3 file1.txt file2.txt')
158
+ end
159
+
160
+ it 'prepares invalid tar command' do
161
+ expect do
162
+ host.tar('abc', 'file1.txt')
163
+ end.to raise_error(ArgumentError)
164
+
165
+ expect do
166
+ host.tar('create', 'archive.tar', compress: 'xip')
167
+ end.to raise_error(ArgumentError)
168
+ end
169
+ end
@@ -20,150 +20,131 @@ RSpec.describe Kanrisuru::Core::Find do
20
20
  end
21
21
 
22
22
  it 'prepares find command' do
23
- expect_command(host.find, "find")
23
+ expect_command(host.find, 'find')
24
24
 
25
- expect_command(host.find(follow: 'never'), "find -P")
26
- expect_command(host.find(follow: 'always'), "find -L")
27
- expect_command(host.find(follow: 'command'), "find -H")
25
+ expect_command(host.find(follow: 'never'), 'find -P')
26
+ expect_command(host.find(follow: 'always'), 'find -L')
27
+ expect_command(host.find(follow: 'command'), 'find -H')
28
28
 
29
- expect_command(host.find(paths: '/etc'), "find /etc")
30
- expect_command(host.find(paths: ['/etc', '/var', '/home']), "find /etc /var /home")
29
+ expect_command(host.find(paths: '/etc'), 'find /etc')
30
+ expect_command(host.find(paths: ['/etc', '/var', '/home']), 'find /etc /var /home')
31
31
 
32
- expect {
32
+ expect do
33
33
  host.find(paths: 1)
34
- }.to raise_error(ArgumentError)
35
-
36
- expect_command(host.find(paths: '/',
37
- executable: true,
38
- empty: true,
39
- readable: true,
40
- writeable: true,
41
- nogroup: true,
42
- nouser: true,
43
- mount: true
44
- ),
45
- "find / -executable -empty -readable -nogroup -nouser -mount"
46
- )
47
-
48
- expect_command(host.find(paths: '/',
49
- path: "/lib",
50
- name: '*.so',
51
- gid: 0,
52
- uid: 0,
53
- user: 'root',
54
- group: 'root',
55
- links: 2,
56
- mindepth: 0,
57
- maxdepth: 100
58
- ),
59
- "find / -path /lib -name *.so -gid 0 -uid 0 -user root -group root -links 2 -maxdepth 100 -mindepth 0"
60
- )
34
+ end.to raise_error(ArgumentError)
35
+
36
+ expect_command(host.find(paths: '/',
37
+ executable: true,
38
+ empty: true,
39
+ readable: true,
40
+ writeable: true,
41
+ nogroup: true,
42
+ nouser: true,
43
+ mount: true),
44
+ 'find / -executable -empty -readable -nogroup -nouser -mount')
45
+
46
+ expect_command(host.find(paths: '/',
47
+ path: '/lib',
48
+ name: '*.so',
49
+ gid: 0,
50
+ uid: 0,
51
+ user: 'root',
52
+ group: 'root',
53
+ links: 2,
54
+ mindepth: 0,
55
+ maxdepth: 100),
56
+ 'find / -path /lib -name *.so -gid 0 -uid 0 -user root -group root -links 2 -maxdepth 100 -mindepth 0')
61
57
 
62
58
  expect_command(host.find(paths: '/var/log',
63
- atime: '+1',
64
- ctime: '+2',
65
- mtime: '+3',
66
- amin: '100',
67
- cmin: '200',
68
- mmin: '300'
69
- ),
70
- "find /var/log -atime +1 -ctime +2 -mtime +3 -amin 100 -cmin 200 -mmin 300"
71
- )
59
+ atime: '+1',
60
+ ctime: '+2',
61
+ mtime: '+3',
62
+ amin: '100',
63
+ cmin: '200',
64
+ mmin: '300'),
65
+ 'find /var/log -atime +1 -ctime +2 -mtime +3 -amin 100 -cmin 200 -mmin 300')
72
66
 
73
67
  expect_command(host.find(
74
- paths: '/dev',
75
- regex: '/dev/tty[0-9]*'
76
- ),
77
- "find /dev -regex '/dev/tty[0-9]*'"
78
- )
68
+ paths: '/dev',
69
+ regex: '/dev/tty[0-9]*'
70
+ ),
71
+ "find /dev -regex '/dev/tty[0-9]*'")
79
72
 
80
73
  expect_command(host.find(
81
- paths: '/dev',
82
- regex_type: 'posix-egrep',
83
- regex: '/dev/tty[0-9]*'
84
- ),
85
- "find /dev -regextype posix-egrep -regex '/dev/tty[0-9]*'"
86
- )
74
+ paths: '/dev',
75
+ regex_type: 'posix-egrep',
76
+ regex: '/dev/tty[0-9]*'
77
+ ),
78
+ "find /dev -regextype posix-egrep -regex '/dev/tty[0-9]*'")
87
79
 
88
80
  expect_command(host.find(
89
- paths: '/var/log',
90
- size: 100
91
- ),
92
- "find /var/log -size 100"
93
- )
81
+ paths: '/var/log',
82
+ size: 100
83
+ ),
84
+ 'find /var/log -size 100')
94
85
 
95
86
  expect_command(host.find(
96
- paths: '/var/log',
97
- size: "100"
98
- ),
99
- "find /var/log -size 100"
100
- )
101
-
102
- expect {
103
- host.find(size: "100n")
104
- }.to raise_error(ArgumentError)
87
+ paths: '/var/log',
88
+ size: '100'
89
+ ),
90
+ 'find /var/log -size 100')
91
+
92
+ expect do
93
+ host.find(size: '100n')
94
+ end.to raise_error(ArgumentError)
105
95
 
106
96
  expect_command(host.find(
107
- paths: '/var/log',
108
- size: "-100k"
109
- ),
110
- "find /var/log -size -100k"
111
- )
97
+ paths: '/var/log',
98
+ size: '-100k'
99
+ ),
100
+ 'find /var/log -size -100k')
112
101
 
113
102
  expect_command(host.find(
114
- paths: '/var/log',
115
- size: "+10M"
116
- ),
117
- "find /var/log -size +10M"
118
- )
103
+ paths: '/var/log',
104
+ size: '+10M'
105
+ ),
106
+ 'find /var/log -size +10M')
119
107
 
120
108
  expect_command(host.find(
121
- paths: "/dev",
122
- type: 'directory'
123
- ),
124
- "find /dev -type d"
125
- )
109
+ paths: '/dev',
110
+ type: 'directory'
111
+ ),
112
+ 'find /dev -type d')
126
113
 
127
114
  expect_command(host.find(
128
- paths: "/dev",
129
- type: 'file'
130
- ),
131
- "find /dev -type f"
132
- )
115
+ paths: '/dev',
116
+ type: 'file'
117
+ ),
118
+ 'find /dev -type f')
133
119
 
134
120
  expect_command(host.find(
135
- paths: "/dev",
136
- type: 'symlinks'
137
- ),
138
- "find /dev -type l"
139
- )
121
+ paths: '/dev',
122
+ type: 'symlinks'
123
+ ),
124
+ 'find /dev -type l')
140
125
 
141
126
  expect_command(host.find(
142
- paths: "/dev",
143
- type: 'block'
144
- ),
145
- "find /dev -type b"
146
- )
127
+ paths: '/dev',
128
+ type: 'block'
129
+ ),
130
+ 'find /dev -type b')
147
131
 
148
132
  expect_command(host.find(
149
- paths: "/dev",
150
- type: 'character'
151
- ),
152
- "find /dev -type c"
153
- )
133
+ paths: '/dev',
134
+ type: 'character'
135
+ ),
136
+ 'find /dev -type c')
154
137
 
155
138
  expect_command(host.find(
156
- paths: "/dev",
157
- type: 'pipe'
158
- ),
159
- "find /dev -type p"
160
- )
139
+ paths: '/dev',
140
+ type: 'pipe'
141
+ ),
142
+ 'find /dev -type p')
161
143
 
162
144
  expect_command(host.find(
163
- paths: "/dev",
164
- type: 'socket'
165
- ),
166
- "find /dev -type s"
167
- )
145
+ paths: '/dev',
146
+ type: 'socket'
147
+ ),
148
+ 'find /dev -type s')
168
149
  end
169
150
  end