kanrisuru 0.11.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -1
  3. data/CHANGELOG.md +26 -6
  4. data/README.md +19 -91
  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/dmi.rb +1 -1
  9. data/lib/kanrisuru/core/file.rb +4 -11
  10. data/lib/kanrisuru/core/find.rb +2 -6
  11. data/lib/kanrisuru/core/mount.rb +14 -15
  12. data/lib/kanrisuru/core/stream.rb +1 -2
  13. data/lib/kanrisuru/core/zypper.rb +6 -23
  14. data/lib/kanrisuru/os_package/collection.rb +58 -0
  15. data/lib/kanrisuru/os_package/define.rb +34 -0
  16. data/lib/kanrisuru/os_package/include.rb +163 -0
  17. data/lib/kanrisuru/os_package.rb +3 -245
  18. data/lib/kanrisuru/remote/fstab.rb +1 -1
  19. data/lib/kanrisuru/result.rb +5 -4
  20. data/lib/kanrisuru/version.rb +1 -1
  21. data/spec/functional/core/archive_spec.rb +2 -1
  22. data/spec/functional/core/mount_spec.rb +121 -0
  23. data/spec/functional/remote/cpu_spec.rb +1 -1
  24. data/spec/functional/result_spec.rb +150 -0
  25. data/spec/{hosts.json → helper/hosts.json} +0 -0
  26. data/spec/helper/simplecov.rb +21 -0
  27. data/spec/helper/stub_network.rb +20 -20
  28. data/spec/helper/test_hosts.rb +12 -2
  29. data/spec/integration/core/apt/debian_spec.rb +9 -0
  30. data/spec/integration/core/apt/ubuntu_spec.rb +9 -0
  31. data/spec/integration/core/archive/centos_spec.rb +9 -0
  32. data/spec/integration/core/archive/debian_spec.rb +9 -0
  33. data/spec/integration/core/archive/fedora_spec.rb +9 -0
  34. data/spec/integration/core/archive/opensuse_spec.rb +9 -0
  35. data/spec/integration/core/archive/rhel_spec.rb +9 -0
  36. data/spec/integration/core/archive/sles_spec.rb +9 -0
  37. data/spec/integration/core/archive/ubuntu_spec.rb +9 -0
  38. data/spec/integration/core/disk/centos_spec.rb +9 -0
  39. data/spec/integration/core/disk/debian_spec.rb +9 -0
  40. data/spec/integration/core/disk/fedora_spec.rb +9 -0
  41. data/spec/integration/core/disk/opensuse_spec.rb +9 -0
  42. data/spec/integration/core/disk/rhel_spec.rb +9 -0
  43. data/spec/integration/core/disk/sles_spec.rb +9 -0
  44. data/spec/integration/core/disk/ubuntu_spec.rb +9 -0
  45. data/spec/integration/core/dmi/centos_spec.rb +9 -0
  46. data/spec/integration/core/dmi/debian_spec.rb +9 -0
  47. data/spec/integration/core/dmi/fedora_spec.rb +9 -0
  48. data/spec/integration/core/dmi/opensuse_spec.rb +9 -0
  49. data/spec/integration/core/dmi/rhel_spec.rb +9 -0
  50. data/spec/integration/core/dmi/sles_spec.rb +9 -0
  51. data/spec/integration/core/dmi/ubuntu_spec.rb +9 -0
  52. data/spec/integration/core/file/centos_spec.rb +9 -0
  53. data/spec/integration/core/file/debian_spec.rb +9 -0
  54. data/spec/integration/core/file/fedora_spec.rb +9 -0
  55. data/spec/integration/core/file/opensuse_spec.rb +9 -0
  56. data/spec/integration/core/file/rhel_spec.rb +9 -0
  57. data/spec/integration/core/file/sles_spec.rb +9 -0
  58. data/spec/integration/core/file/ubuntu_spec.rb +9 -0
  59. data/spec/integration/core/find/centos_spec.rb +9 -0
  60. data/spec/integration/core/find/debian_spec.rb +9 -0
  61. data/spec/integration/core/find/fedora_spec.rb +9 -0
  62. data/spec/integration/core/find/opensuse_spec.rb +9 -0
  63. data/spec/integration/core/find/rhel_spec.rb +9 -0
  64. data/spec/integration/core/find/sles_spec.rb +9 -0
  65. data/spec/integration/core/find/ubuntu_spec.rb +9 -0
  66. data/spec/integration/core/group/centos_spec.rb +9 -0
  67. data/spec/integration/core/group/debian_spec.rb +9 -0
  68. data/spec/integration/core/group/fedora_spec.rb +9 -0
  69. data/spec/integration/core/group/opensuse_spec.rb +9 -0
  70. data/spec/integration/core/group/rhel_spec.rb +9 -0
  71. data/spec/integration/core/group/sles_spec.rb +9 -0
  72. data/spec/integration/core/group/ubuntu_spec.rb +9 -0
  73. data/spec/integration/core/ip/centos_spec.rb +9 -0
  74. data/spec/integration/core/ip/debian_spec.rb +9 -0
  75. data/spec/integration/core/ip/fedora_spec.rb +9 -0
  76. data/spec/integration/core/ip/opensuse_spec.rb +9 -0
  77. data/spec/integration/core/ip/rhel_spec.rb +9 -0
  78. data/spec/integration/core/ip/sles_spec.rb +9 -0
  79. data/spec/integration/core/ip/ubuntu_spec.rb +9 -0
  80. data/spec/integration/core/path/centos_spec.rb +9 -0
  81. data/spec/integration/core/path/debian_spec.rb +9 -0
  82. data/spec/integration/core/path/fedora_spec.rb +9 -0
  83. data/spec/integration/core/path/opensuse_spec.rb +9 -0
  84. data/spec/integration/core/path/rhel_spec.rb +9 -0
  85. data/spec/integration/core/path/sles_spec.rb +9 -0
  86. data/spec/integration/core/path/ubuntu_spec.rb +9 -0
  87. data/spec/integration/core/socket/centos_spec.rb +9 -0
  88. data/spec/integration/core/socket/debian_spec.rb +9 -0
  89. data/spec/integration/core/socket/fedora_spec.rb +9 -0
  90. data/spec/integration/core/socket/opensuse_spec.rb +9 -0
  91. data/spec/integration/core/socket/rhel_spec.rb +9 -0
  92. data/spec/integration/core/socket/sles_spec.rb +9 -0
  93. data/spec/integration/core/socket/ubuntu_spec.rb +9 -0
  94. data/spec/integration/core/stat/centos_spec.rb +9 -0
  95. data/spec/integration/core/stat/debian_spec.rb +9 -0
  96. data/spec/integration/core/stat/fedora_spec.rb +9 -0
  97. data/spec/integration/core/stat/opensuse_spec.rb +9 -0
  98. data/spec/integration/core/stat/rhel_spec.rb +9 -0
  99. data/spec/integration/core/stat/sles_spec.rb +9 -0
  100. data/spec/integration/core/stat/ubuntu_spec.rb +9 -0
  101. data/spec/integration/core/stream/centos_spec.rb +9 -0
  102. data/spec/integration/core/stream/debian_spec.rb +9 -0
  103. data/spec/integration/core/stream/fedora_spec.rb +9 -0
  104. data/spec/integration/core/stream/opensuse_spec.rb +9 -0
  105. data/spec/integration/core/stream/rhel_spec.rb +9 -0
  106. data/spec/integration/core/stream/sles_spec.rb +9 -0
  107. data/spec/integration/core/stream/ubuntu_spec.rb +9 -0
  108. data/spec/integration/core/system/centos_spec.rb +9 -0
  109. data/spec/integration/core/system/debian_spec.rb +9 -0
  110. data/spec/integration/core/system/fedora_spec.rb +9 -0
  111. data/spec/integration/core/system/opensuse_spec.rb +9 -0
  112. data/spec/integration/core/system/rhel_spec.rb +9 -0
  113. data/spec/integration/core/system/sles_spec.rb +9 -0
  114. data/spec/integration/core/system/ubuntu_spec.rb +9 -0
  115. data/spec/integration/core/transfer/centos_spec.rb +9 -0
  116. data/spec/integration/core/transfer/debian_spec.rb +9 -0
  117. data/spec/integration/core/transfer/fedora_spec.rb +9 -0
  118. data/spec/integration/core/transfer/opensuse_spec.rb +9 -0
  119. data/spec/integration/core/transfer/rhel_spec.rb +9 -0
  120. data/spec/integration/core/transfer/sles_spec.rb +9 -0
  121. data/spec/integration/core/transfer/ubuntu_spec.rb +9 -0
  122. data/spec/integration/core/user/centos_spec.rb +9 -0
  123. data/spec/integration/core/user/debian_spec.rb +9 -0
  124. data/spec/integration/core/user/fedora_spec.rb +9 -0
  125. data/spec/integration/core/user/opensuse_spec.rb +9 -0
  126. data/spec/integration/core/user/rhel_spec.rb +9 -0
  127. data/spec/integration/core/user/sles_spec.rb +9 -0
  128. data/spec/integration/core/user/ubuntu_spec.rb +9 -0
  129. data/spec/integration/core/yum/centos_spec.rb +9 -0
  130. data/spec/integration/core/yum/fedora_spec.rb +9 -0
  131. data/spec/integration/core/yum/rhel_spec.rb +9 -0
  132. data/spec/integration/core/zypper/opensuse_spec.rb +9 -0
  133. data/spec/integration/core/zypper/sles_spec.rb +9 -0
  134. data/spec/integration/remote/cluster/ubuntu_spec.rb +9 -0
  135. data/spec/integration/remote/cpu/centos_spec.rb +9 -0
  136. data/spec/integration/remote/cpu/debian_spec.rb +9 -0
  137. data/spec/integration/remote/cpu/fedora_spec.rb +9 -0
  138. data/spec/integration/remote/cpu/opensuse_spec.rb +9 -0
  139. data/spec/integration/remote/cpu/rhel_spec.rb +9 -0
  140. data/spec/integration/remote/cpu/sles_spec.rb +9 -0
  141. data/spec/integration/remote/cpu/ubuntu_spec.rb +9 -0
  142. data/spec/integration/remote/env/centos_spec.rb +9 -0
  143. data/spec/integration/remote/env/debian_spec.rb +9 -0
  144. data/spec/integration/remote/env/fedora_spec.rb +9 -0
  145. data/spec/integration/remote/env/opensuse_spec.rb +9 -0
  146. data/spec/integration/remote/env/rhel_spec.rb +9 -0
  147. data/spec/integration/remote/env/sles_spec.rb +9 -0
  148. data/spec/integration/remote/env/ubuntu_spec.rb +9 -0
  149. data/spec/integration/remote/fstab/centos_spec.rb +9 -0
  150. data/spec/integration/remote/fstab/debian_spec.rb +9 -0
  151. data/spec/integration/remote/fstab/fedora_spec.rb +9 -0
  152. data/spec/integration/remote/fstab/opensuse_spec.rb +9 -0
  153. data/spec/integration/remote/fstab/rhel_spec.rb +9 -0
  154. data/spec/integration/remote/fstab/sles_spec.rb +9 -0
  155. data/spec/integration/remote/fstab/ubuntu_spec.rb +9 -0
  156. data/spec/integration/remote/host/centos_spec.rb +9 -0
  157. data/spec/integration/remote/host/debian_spec.rb +9 -0
  158. data/spec/integration/remote/host/fedora_spec.rb +9 -0
  159. data/spec/integration/remote/host/opensuse_spec.rb +9 -0
  160. data/spec/integration/remote/host/rhel_spec.rb +9 -0
  161. data/spec/integration/remote/host/sles_spec.rb +9 -0
  162. data/spec/integration/remote/host/ubuntu_spec.rb +9 -0
  163. data/spec/integration/remote/memory/centos_spec.rb +9 -0
  164. data/spec/integration/remote/memory/debian_spec.rb +9 -0
  165. data/spec/integration/remote/memory/fedora_spec.rb +9 -0
  166. data/spec/integration/remote/memory/opensuse_spec.rb +9 -0
  167. data/spec/integration/remote/memory/rhel_spec.rb +9 -0
  168. data/spec/integration/remote/memory/sles_spec.rb +9 -0
  169. data/spec/integration/remote/memory/ubuntu_spec.rb +9 -0
  170. data/spec/integration/remote/os/centos_spec.rb +9 -0
  171. data/spec/integration/remote/os/debian_spec.rb +9 -0
  172. data/spec/integration/remote/os/fedora_spec.rb +9 -0
  173. data/spec/integration/remote/os/opensuse_spec.rb +9 -0
  174. data/spec/integration/remote/os/rhel_spec.rb +9 -0
  175. data/spec/integration/remote/os/sles_spec.rb +9 -0
  176. data/spec/integration/remote/os/ubuntu_spec.rb +9 -0
  177. data/spec/integration/remote/remote_file/centos_spec.rb +9 -0
  178. data/spec/integration/remote/remote_file/debian_spec.rb +9 -0
  179. data/spec/integration/remote/remote_file/fedora_spec.rb +9 -0
  180. data/spec/integration/remote/remote_file/opensuse_spec.rb +9 -0
  181. data/spec/integration/remote/remote_file/rhel_spec.rb +9 -0
  182. data/spec/integration/remote/remote_file/sles_spec.rb +9 -0
  183. data/spec/integration/remote/remote_file/ubuntu_spec.rb +9 -0
  184. data/spec/spec_helper.rb +4 -4
  185. data/spec/support/shared_examples/integration/core/apt.rb +117 -0
  186. data/spec/support/shared_examples/integration/core/archive.rb +221 -0
  187. data/spec/support/shared_examples/integration/core/disk.rb +91 -0
  188. data/spec/support/shared_examples/integration/core/dmi.rb +34 -0
  189. data/spec/support/shared_examples/integration/core/file.rb +357 -0
  190. data/spec/support/shared_examples/integration/core/find.rb +50 -0
  191. data/spec/support/shared_examples/integration/core/group.rb +62 -0
  192. data/spec/support/shared_examples/integration/core/ip.rb +68 -0
  193. data/spec/support/shared_examples/integration/core/path.rb +90 -0
  194. data/spec/support/shared_examples/integration/core/socket.rb +27 -0
  195. data/spec/support/shared_examples/integration/core/stat.rb +95 -0
  196. data/spec/support/shared_examples/integration/core/stream.rb +112 -0
  197. data/spec/support/shared_examples/integration/core/system.rb +155 -0
  198. data/spec/support/shared_examples/integration/core/transfer.rb +101 -0
  199. data/spec/support/shared_examples/integration/core/user.rb +72 -0
  200. data/spec/support/shared_examples/integration/core/yum.rb +115 -0
  201. data/spec/support/shared_examples/integration/core/zypper.rb +196 -0
  202. data/spec/{integration/remote/cluster_spec.rb → support/shared_examples/integration/remote/cluster.rb} +2 -2
  203. data/spec/support/shared_examples/integration/remote/cpu.rb +38 -0
  204. data/spec/support/shared_examples/integration/remote/env_spec.rb +33 -0
  205. data/spec/support/shared_examples/integration/remote/fstab.rb +89 -0
  206. data/spec/support/shared_examples/integration/remote/host.rb +65 -0
  207. data/spec/support/shared_examples/integration/remote/memory.rb +27 -0
  208. data/spec/support/shared_examples/integration/remote/os.rb +60 -0
  209. data/spec/support/shared_examples/integration/remote/remote_file.rb +172 -0
  210. data/spec/unit/command_spec.rb +18 -0
  211. metadata +204 -30
  212. data/spec/integration/core/apt_spec.rb +0 -120
  213. data/spec/integration/core/archive_spec.rb +0 -228
  214. data/spec/integration/core/disk_spec.rb +0 -94
  215. data/spec/integration/core/dmi_spec.rb +0 -37
  216. data/spec/integration/core/file_spec.rb +0 -368
  217. data/spec/integration/core/find_spec.rb +0 -53
  218. data/spec/integration/core/group_spec.rb +0 -65
  219. data/spec/integration/core/ip_spec.rb +0 -71
  220. data/spec/integration/core/path_spec.rb +0 -93
  221. data/spec/integration/core/socket_spec.rb +0 -31
  222. data/spec/integration/core/stat_spec.rb +0 -98
  223. data/spec/integration/core/stream_spec.rb +0 -117
  224. data/spec/integration/core/system_spec.rb +0 -143
  225. data/spec/integration/core/transfer_spec.rb +0 -108
  226. data/spec/integration/core/user_spec.rb +0 -76
  227. data/spec/integration/core/yum_spec.rb +0 -118
  228. data/spec/integration/core/zypper_spec.rb +0 -199
  229. data/spec/integration/remote/cpu_spec.rb +0 -41
  230. data/spec/integration/remote/env_spec.rb +0 -36
  231. data/spec/integration/remote/fstab_spec.rb +0 -92
  232. data/spec/integration/remote/host_spec.rb +0 -68
  233. data/spec/integration/remote/memory_spec.rb +0 -29
  234. data/spec/integration/remote/os_spec.rb +0 -63
  235. data/spec/integration/remote/remote_file_spec.rb +0 -180
  236. data/spec/zz_reboot_spec.rb +0 -46
@@ -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.0
4
+ version: 0.13.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-07 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
@@ -200,37 +218,194 @@ files:
200
218
  - spec/functional/remote/cluster_spec.rb
201
219
  - spec/functional/remote/cpu_spec.rb
202
220
  - spec/functional/remote/env_spec.rb
221
+ - spec/functional/result_spec.rb
203
222
  - spec/helper/expect_helpers.rb
223
+ - spec/helper/hosts.json
224
+ - spec/helper/simplecov.rb
204
225
  - spec/helper/stub_network.rb
205
226
  - spec/helper/test_hosts.rb
206
- - spec/hosts.json
207
- - spec/integration/core/apt_spec.rb
208
- - spec/integration/core/archive_spec.rb
209
- - spec/integration/core/disk_spec.rb
210
- - spec/integration/core/dmi_spec.rb
211
- - spec/integration/core/file_spec.rb
212
- - spec/integration/core/find_spec.rb
213
- - spec/integration/core/group_spec.rb
214
- - spec/integration/core/ip_spec.rb
215
- - spec/integration/core/path_spec.rb
216
- - spec/integration/core/socket_spec.rb
217
- - spec/integration/core/stat_spec.rb
218
- - spec/integration/core/stream_spec.rb
219
- - spec/integration/core/system_spec.rb
220
- - spec/integration/core/transfer_spec.rb
221
- - spec/integration/core/user_spec.rb
222
- - spec/integration/core/yum_spec.rb
223
- - spec/integration/core/zypper_spec.rb
227
+ - spec/integration/core/apt/debian_spec.rb
228
+ - spec/integration/core/apt/ubuntu_spec.rb
229
+ - spec/integration/core/archive/centos_spec.rb
230
+ - spec/integration/core/archive/debian_spec.rb
231
+ - spec/integration/core/archive/fedora_spec.rb
232
+ - spec/integration/core/archive/opensuse_spec.rb
233
+ - spec/integration/core/archive/rhel_spec.rb
234
+ - spec/integration/core/archive/sles_spec.rb
235
+ - spec/integration/core/archive/ubuntu_spec.rb
236
+ - spec/integration/core/disk/centos_spec.rb
237
+ - spec/integration/core/disk/debian_spec.rb
238
+ - spec/integration/core/disk/fedora_spec.rb
239
+ - spec/integration/core/disk/opensuse_spec.rb
240
+ - spec/integration/core/disk/rhel_spec.rb
241
+ - spec/integration/core/disk/sles_spec.rb
242
+ - spec/integration/core/disk/ubuntu_spec.rb
243
+ - spec/integration/core/dmi/centos_spec.rb
244
+ - spec/integration/core/dmi/debian_spec.rb
245
+ - spec/integration/core/dmi/fedora_spec.rb
246
+ - spec/integration/core/dmi/opensuse_spec.rb
247
+ - spec/integration/core/dmi/rhel_spec.rb
248
+ - spec/integration/core/dmi/sles_spec.rb
249
+ - spec/integration/core/dmi/ubuntu_spec.rb
250
+ - spec/integration/core/file/centos_spec.rb
251
+ - spec/integration/core/file/debian_spec.rb
252
+ - spec/integration/core/file/fedora_spec.rb
253
+ - spec/integration/core/file/opensuse_spec.rb
254
+ - spec/integration/core/file/rhel_spec.rb
255
+ - spec/integration/core/file/sles_spec.rb
256
+ - spec/integration/core/file/ubuntu_spec.rb
257
+ - spec/integration/core/find/centos_spec.rb
258
+ - spec/integration/core/find/debian_spec.rb
259
+ - spec/integration/core/find/fedora_spec.rb
260
+ - spec/integration/core/find/opensuse_spec.rb
261
+ - spec/integration/core/find/rhel_spec.rb
262
+ - spec/integration/core/find/sles_spec.rb
263
+ - spec/integration/core/find/ubuntu_spec.rb
264
+ - spec/integration/core/group/centos_spec.rb
265
+ - spec/integration/core/group/debian_spec.rb
266
+ - spec/integration/core/group/fedora_spec.rb
267
+ - spec/integration/core/group/opensuse_spec.rb
268
+ - spec/integration/core/group/rhel_spec.rb
269
+ - spec/integration/core/group/sles_spec.rb
270
+ - spec/integration/core/group/ubuntu_spec.rb
271
+ - spec/integration/core/ip/centos_spec.rb
272
+ - spec/integration/core/ip/debian_spec.rb
273
+ - spec/integration/core/ip/fedora_spec.rb
274
+ - spec/integration/core/ip/opensuse_spec.rb
275
+ - spec/integration/core/ip/rhel_spec.rb
276
+ - spec/integration/core/ip/sles_spec.rb
277
+ - spec/integration/core/ip/ubuntu_spec.rb
278
+ - spec/integration/core/path/centos_spec.rb
279
+ - spec/integration/core/path/debian_spec.rb
280
+ - spec/integration/core/path/fedora_spec.rb
281
+ - spec/integration/core/path/opensuse_spec.rb
282
+ - spec/integration/core/path/rhel_spec.rb
283
+ - spec/integration/core/path/sles_spec.rb
284
+ - spec/integration/core/path/ubuntu_spec.rb
285
+ - spec/integration/core/socket/centos_spec.rb
286
+ - spec/integration/core/socket/debian_spec.rb
287
+ - spec/integration/core/socket/fedora_spec.rb
288
+ - spec/integration/core/socket/opensuse_spec.rb
289
+ - spec/integration/core/socket/rhel_spec.rb
290
+ - spec/integration/core/socket/sles_spec.rb
291
+ - spec/integration/core/socket/ubuntu_spec.rb
292
+ - spec/integration/core/stat/centos_spec.rb
293
+ - spec/integration/core/stat/debian_spec.rb
294
+ - spec/integration/core/stat/fedora_spec.rb
295
+ - spec/integration/core/stat/opensuse_spec.rb
296
+ - spec/integration/core/stat/rhel_spec.rb
297
+ - spec/integration/core/stat/sles_spec.rb
298
+ - spec/integration/core/stat/ubuntu_spec.rb
299
+ - spec/integration/core/stream/centos_spec.rb
300
+ - spec/integration/core/stream/debian_spec.rb
301
+ - spec/integration/core/stream/fedora_spec.rb
302
+ - spec/integration/core/stream/opensuse_spec.rb
303
+ - spec/integration/core/stream/rhel_spec.rb
304
+ - spec/integration/core/stream/sles_spec.rb
305
+ - spec/integration/core/stream/ubuntu_spec.rb
306
+ - spec/integration/core/system/centos_spec.rb
307
+ - spec/integration/core/system/debian_spec.rb
308
+ - spec/integration/core/system/fedora_spec.rb
309
+ - spec/integration/core/system/opensuse_spec.rb
310
+ - spec/integration/core/system/rhel_spec.rb
311
+ - spec/integration/core/system/sles_spec.rb
312
+ - spec/integration/core/system/ubuntu_spec.rb
313
+ - spec/integration/core/transfer/centos_spec.rb
314
+ - spec/integration/core/transfer/debian_spec.rb
315
+ - spec/integration/core/transfer/fedora_spec.rb
316
+ - spec/integration/core/transfer/opensuse_spec.rb
317
+ - spec/integration/core/transfer/rhel_spec.rb
318
+ - spec/integration/core/transfer/sles_spec.rb
319
+ - spec/integration/core/transfer/ubuntu_spec.rb
320
+ - spec/integration/core/user/centos_spec.rb
321
+ - spec/integration/core/user/debian_spec.rb
322
+ - spec/integration/core/user/fedora_spec.rb
323
+ - spec/integration/core/user/opensuse_spec.rb
324
+ - spec/integration/core/user/rhel_spec.rb
325
+ - spec/integration/core/user/sles_spec.rb
326
+ - spec/integration/core/user/ubuntu_spec.rb
327
+ - spec/integration/core/yum/centos_spec.rb
328
+ - spec/integration/core/yum/fedora_spec.rb
329
+ - spec/integration/core/yum/rhel_spec.rb
330
+ - spec/integration/core/zypper/opensuse_spec.rb
331
+ - spec/integration/core/zypper/sles_spec.rb
224
332
  - spec/integration/os_package_spec.rb
225
- - spec/integration/remote/cluster_spec.rb
226
- - spec/integration/remote/cpu_spec.rb
227
- - spec/integration/remote/env_spec.rb
228
- - spec/integration/remote/fstab_spec.rb
229
- - spec/integration/remote/host_spec.rb
230
- - spec/integration/remote/memory_spec.rb
231
- - spec/integration/remote/os_spec.rb
232
- - spec/integration/remote/remote_file_spec.rb
333
+ - spec/integration/remote/cluster/ubuntu_spec.rb
334
+ - spec/integration/remote/cpu/centos_spec.rb
335
+ - spec/integration/remote/cpu/debian_spec.rb
336
+ - spec/integration/remote/cpu/fedora_spec.rb
337
+ - spec/integration/remote/cpu/opensuse_spec.rb
338
+ - spec/integration/remote/cpu/rhel_spec.rb
339
+ - spec/integration/remote/cpu/sles_spec.rb
340
+ - spec/integration/remote/cpu/ubuntu_spec.rb
341
+ - spec/integration/remote/env/centos_spec.rb
342
+ - spec/integration/remote/env/debian_spec.rb
343
+ - spec/integration/remote/env/fedora_spec.rb
344
+ - spec/integration/remote/env/opensuse_spec.rb
345
+ - spec/integration/remote/env/rhel_spec.rb
346
+ - spec/integration/remote/env/sles_spec.rb
347
+ - spec/integration/remote/env/ubuntu_spec.rb
348
+ - spec/integration/remote/fstab/centos_spec.rb
349
+ - spec/integration/remote/fstab/debian_spec.rb
350
+ - spec/integration/remote/fstab/fedora_spec.rb
351
+ - spec/integration/remote/fstab/opensuse_spec.rb
352
+ - spec/integration/remote/fstab/rhel_spec.rb
353
+ - spec/integration/remote/fstab/sles_spec.rb
354
+ - spec/integration/remote/fstab/ubuntu_spec.rb
355
+ - spec/integration/remote/host/centos_spec.rb
356
+ - spec/integration/remote/host/debian_spec.rb
357
+ - spec/integration/remote/host/fedora_spec.rb
358
+ - spec/integration/remote/host/opensuse_spec.rb
359
+ - spec/integration/remote/host/rhel_spec.rb
360
+ - spec/integration/remote/host/sles_spec.rb
361
+ - spec/integration/remote/host/ubuntu_spec.rb
362
+ - spec/integration/remote/memory/centos_spec.rb
363
+ - spec/integration/remote/memory/debian_spec.rb
364
+ - spec/integration/remote/memory/fedora_spec.rb
365
+ - spec/integration/remote/memory/opensuse_spec.rb
366
+ - spec/integration/remote/memory/rhel_spec.rb
367
+ - spec/integration/remote/memory/sles_spec.rb
368
+ - spec/integration/remote/memory/ubuntu_spec.rb
369
+ - spec/integration/remote/os/centos_spec.rb
370
+ - spec/integration/remote/os/debian_spec.rb
371
+ - spec/integration/remote/os/fedora_spec.rb
372
+ - spec/integration/remote/os/opensuse_spec.rb
373
+ - spec/integration/remote/os/rhel_spec.rb
374
+ - spec/integration/remote/os/sles_spec.rb
375
+ - spec/integration/remote/os/ubuntu_spec.rb
376
+ - spec/integration/remote/remote_file/centos_spec.rb
377
+ - spec/integration/remote/remote_file/debian_spec.rb
378
+ - spec/integration/remote/remote_file/fedora_spec.rb
379
+ - spec/integration/remote/remote_file/opensuse_spec.rb
380
+ - spec/integration/remote/remote_file/rhel_spec.rb
381
+ - spec/integration/remote/remote_file/sles_spec.rb
382
+ - spec/integration/remote/remote_file/ubuntu_spec.rb
233
383
  - spec/spec_helper.rb
384
+ - spec/support/shared_examples/integration/core/apt.rb
385
+ - spec/support/shared_examples/integration/core/archive.rb
386
+ - spec/support/shared_examples/integration/core/disk.rb
387
+ - spec/support/shared_examples/integration/core/dmi.rb
388
+ - spec/support/shared_examples/integration/core/file.rb
389
+ - spec/support/shared_examples/integration/core/find.rb
390
+ - spec/support/shared_examples/integration/core/group.rb
391
+ - spec/support/shared_examples/integration/core/ip.rb
392
+ - spec/support/shared_examples/integration/core/path.rb
393
+ - spec/support/shared_examples/integration/core/socket.rb
394
+ - spec/support/shared_examples/integration/core/stat.rb
395
+ - spec/support/shared_examples/integration/core/stream.rb
396
+ - spec/support/shared_examples/integration/core/system.rb
397
+ - spec/support/shared_examples/integration/core/transfer.rb
398
+ - spec/support/shared_examples/integration/core/user.rb
399
+ - spec/support/shared_examples/integration/core/yum.rb
400
+ - spec/support/shared_examples/integration/core/zypper.rb
401
+ - spec/support/shared_examples/integration/remote/cluster.rb
402
+ - spec/support/shared_examples/integration/remote/cpu.rb
403
+ - spec/support/shared_examples/integration/remote/env_spec.rb
404
+ - spec/support/shared_examples/integration/remote/fstab.rb
405
+ - spec/support/shared_examples/integration/remote/host.rb
406
+ - spec/support/shared_examples/integration/remote/memory.rb
407
+ - spec/support/shared_examples/integration/remote/os.rb
408
+ - spec/support/shared_examples/integration/remote/remote_file.rb
234
409
  - spec/unit/command_spec.rb
235
410
  - spec/unit/core/apt_spec.rb
236
411
  - spec/unit/core/archive_spec.rb
@@ -256,7 +431,6 @@ files:
256
431
  - spec/unit/remote/fstab_spec.rb
257
432
  - spec/unit/template_spec.rb
258
433
  - spec/unit/util_spec.rb
259
- - spec/zz_reboot_spec.rb
260
434
  homepage: https://github.com/avamia/kanrisuru
261
435
  licenses:
262
436
  - MIT
@@ -278,7 +452,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
452
  - !ruby/object:Gem::Version
279
453
  version: '0'
280
454
  requirements: []
281
- rubygems_version: 3.1.2
455
+ rubygems_version: 3.2.32
282
456
  signing_key:
283
457
  specification_version: 4
284
458
  summary: Manage remote servers over ssh with ruby.
@@ -1,120 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Kanrisuru::Core::Apt do
6
- TestHosts.each_os(only: %w[debian ubuntu]) do |os_name|
7
- context "with #{os_name}" do
8
- let(:host_json) { TestHosts.host(os_name) }
9
- let(:host) do
10
- Kanrisuru::Remote::Host.new(
11
- host: host_json['hostname'],
12
- username: host_json['username'],
13
- keys: [host_json['ssh_key']]
14
- )
15
- end
16
-
17
- after do
18
- host.disconnect
19
- end
20
-
21
- it 'installs package' do
22
- host.su('root')
23
- result = host.apt('install', packages: %w[ffmpeg curl])
24
- expect(result).to be_success
25
-
26
- result = host.which('ffmpeg')
27
- expect(result).to be_success
28
- paths = result.map(&:path)
29
- expect(paths).to include(match('ffmpeg'))
30
-
31
- result = host.which('curl')
32
- expect(result).to be_success
33
- paths = result.map(&:path)
34
- expect(paths).to include(match('curl'))
35
- end
36
-
37
- it 'removes installed packages' do
38
- host.su('root')
39
- result = host.apt('remove', packages: ['ffmpeg'])
40
- expect(result).to be_success
41
- end
42
-
43
- it 'purges installed packages' do
44
- host.su('root')
45
- result = host.apt('purge', packages: ['ffmpeg'])
46
- expect(result).to be_success
47
- end
48
-
49
- it 'removes unused packages' do
50
- host.su('root')
51
- result = host.apt('autoremove')
52
- expect(result).to be_success
53
- end
54
-
55
- it 'cleans packages' do
56
- host.su('root')
57
- result = host.apt('clean')
58
- expect(result).to be_success
59
- end
60
-
61
- it 'autocleans packages' do
62
- host.su('root')
63
- result = host.apt('autoclean')
64
- expect(result).to be_success
65
- end
66
-
67
- it 'updates packages' do
68
- host.su('root')
69
- result = host.apt('update')
70
- expect(result).to be_success
71
- end
72
-
73
- it 'upgrades packages' do
74
- host.su('root')
75
- result = host.apt('upgrade')
76
- expect(result).to be_success
77
- end
78
-
79
- it 'fully upgrades packages' do
80
- host.su('root')
81
- result = host.apt('full-upgrade')
82
- expect(result).to be_success
83
- end
84
-
85
- it 'shows details of listed packages' do
86
- result = host.apt('show', packages: %w[wget curl git sudo])
87
- expect(result).to be_success
88
- end
89
-
90
- it 'lists all packages' do
91
- host.su('root')
92
- result = host.apt('list')
93
- expect(result).to be_success
94
- end
95
-
96
- it 'lists installed packages' do
97
- host.su('root')
98
- result = host.apt('list', installed: true)
99
- expect(result).to be_success
100
- end
101
-
102
- it 'lists upgradable packages' do
103
- host.su('root')
104
- result = host.apt('list', upgradable: true)
105
- expect(result).to be_success
106
- end
107
-
108
- it 'lists all versions for packages' do
109
- host.su('root')
110
- result = host.apt('list', all_versions: true)
111
- expect(result).to be_success
112
- end
113
-
114
- it 'searches packages' do
115
- result = host.apt('search', query: 'wget')
116
- expect(result).to be_success
117
- end
118
- end
119
- end
120
- end
@@ -1,228 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- RSpec.describe Kanrisuru::Core::Archive do
6
- TestHosts.each_os do |os_name|
7
- context "with #{os_name}" do
8
- before(:all) do
9
- host_json = TestHosts.host(os_name)
10
- host = Kanrisuru::Remote::Host.new(
11
- host: host_json['hostname'],
12
- username: host_json['username'],
13
- keys: [host_json['ssh_key']]
14
- )
15
-
16
- host.mkdir("#{host_json['home']}/.kanrisuru_spec_files", silent: true)
17
- host.disconnect
18
- end
19
-
20
- let(:host_json) { TestHosts.host(os_name) }
21
- let(:host) do
22
- Kanrisuru::Remote::Host.new(
23
- host: host_json['hostname'],
24
- username: host_json['username'],
25
- keys: [host_json['ssh_key']]
26
- )
27
- end
28
-
29
- let(:spec_dir) { "#{host_json['home']}/.kanrisuru_spec_files" }
30
-
31
- after do
32
- host.disconnect
33
- end
34
-
35
- after(:all) do
36
- host_json = TestHosts.host(os_name)
37
- host = Kanrisuru::Remote::Host.new(
38
- host: host_json['hostname'],
39
- username: host_json['username'],
40
- keys: [host_json['ssh_key']]
41
- )
42
-
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")
45
- host.disconnect
46
- end
47
-
48
- it 'tars an archive' do
49
- archive = 'archive.tar'
50
- archive2 = 'archive2.tar'
51
- directory = spec_dir
52
-
53
- host.touch("#{spec_dir}/test-file.txt")
54
- host.touch("#{spec_dir}/test1.txt")
55
- host.touch("#{spec_dir}/test2.txt")
56
- host.touch("#{spec_dir}/test3.txt")
57
-
58
- host.touch("#{spec_dir}/test1.config")
59
- host.touch("#{spec_dir}/test2.config")
60
- host.touch("#{spec_dir}/test3.config")
61
-
62
- host.cd(spec_dir)
63
- result = host.tar('create', archive, paths: ['*.txt'], exclude: 'test-file.txt', directory: directory)
64
-
65
- expect(result.success?).to eq(true)
66
-
67
- file = host.file("#{spec_dir}/#{archive}")
68
-
69
- expect(file.path).to eq("#{spec_dir}/archive.tar")
70
- expect(file.user).to eq(host_json['username'])
71
-
72
- case os_name
73
- when 'opensuse', 'sles'
74
- expect(file.group).to eq('users')
75
- else
76
- expect(file.group).to eq(host_json['username'])
77
- end
78
-
79
- result = host.tar('list', archive, directory: directory)
80
- expect(result.success?).to eq(true)
81
- paths = result.map(&:path)
82
- expect(paths.include?('test-file.txt')).to eq(false)
83
-
84
- result = host.tar('append', archive, paths: 'test-file.txt', directory: directory)
85
- expect(result.success?).to eq(true)
86
-
87
- result = host.tar('list', archive, directory: directory)
88
- paths = result.map(&:path)
89
-
90
- expect(paths.include?('test-file.txt')).to eq(true)
91
-
92
- result = host.tar('create', archive2, paths: '*.config', directory: directory)
93
- expect(result.success?).to eq(true)
94
-
95
- file = host.file("#{spec_dir}/#{archive2}")
96
-
97
- expect(file.path).to eq("#{spec_dir}/archive2.tar")
98
- expect(file.user).to eq(host_json['username'])
99
-
100
- case os_name
101
- when 'opensuse', 'sles'
102
- expect(file.group).to eq('users')
103
- else
104
- expect(file.group).to eq(host_json['username'])
105
- end
106
-
107
- result = host.tar('concat', archive, paths: archive2, directory: directory)
108
- expect(result.success?).to eq(true)
109
-
110
- result = host.tar('list', archive, directory: directory)
111
- expect(result.success?).to eq(true)
112
- paths = result.map(&:path)
113
-
114
- expect(paths.include?('test1.config')).to eq(true)
115
- expect(paths.include?('test2.config')).to eq(true)
116
- expect(paths.include?('test3.config')).to eq(true)
117
-
118
- result = host.tar('diff', archive, directory: directory)
119
- expect(result.success?).to eq(true)
120
-
121
- result = host.tar('delete', archive, directory: directory, paths: 'test2.config')
122
- expect(result.success?).to eq(true)
123
-
124
- result = host.tar('list', archive, directory: directory)
125
- expect(result.success?).to eq(true)
126
- paths = result.map(&:path)
127
- expect(paths.include?('test2.config')).to eq(false)
128
-
129
- host.mkdir("#{host_json['home']}/extract-tar-files", silent: true)
130
- host.tar('extract', 'archive.tar', directory: "#{host_json['home']}/extract-tar-files")
131
-
132
- result = host.ls(path: "#{host_json['home']}/extract-tar-files")
133
- paths = result.map(&:path)
134
-
135
- expect(paths.include?('test1.config')).to eq(true)
136
- expect(paths.include?('test3.config')).to eq(true)
137
- expect(paths.include?('test-file.txt')).to eq(true)
138
- expect(paths.include?('test1.txt')).to eq(true)
139
- expect(paths.include?('test2.txt')).to eq(true)
140
- expect(paths.include?('test3.txt')).to eq(true)
141
- end
142
-
143
- it 'compresses archive while tar' do
144
- archive = 'archive.tar'
145
- directory = spec_dir
146
-
147
- host.touch("#{spec_dir}/test1.log")
148
- host.touch("#{spec_dir}/test2.log")
149
- host.touch("#{spec_dir}/test3.log")
150
-
151
- host.cd(spec_dir)
152
- result = host.tar('create', "#{archive}.gz", compress: 'gzip', paths: ['*.log'], directory: directory)
153
- expect(result.success?).to eq(true)
154
-
155
- file = host.file("#{spec_dir}/#{archive}.gz")
156
- expect(file.path).to eq("#{spec_dir}/archive.tar.gz")
157
- expect(file.uid).to eq(1000)
158
-
159
- case os_name
160
- when 'opensuse', 'sles'
161
- expect(file.gid).to eq(100)
162
- else
163
- expect(file.gid).to eq(1000)
164
- end
165
-
166
- case os_name
167
- when 'debian', 'ubuntu'
168
- result = host.tar('create', "#{archive}.bz", compress: 'bzip2', paths: ['*.log'], directory: directory)
169
- expect(result.success?).to eq(true)
170
-
171
- file = host.file("#{spec_dir}/#{archive}.bz")
172
- expect(file.path).to eq("#{spec_dir}/archive.tar.bz")
173
- expect(file.uid).to eq(1000)
174
- expect(file.gid).to eq(1000)
175
- end
176
-
177
- # case os_name
178
- # when 'opensuse', 'sles'
179
- # expect(file.gid).to eq(100)
180
- # else
181
- # end
182
-
183
- case os_name
184
- when 'debian'
185
- ## no op
186
- else
187
- result = host.tar('create', "#{archive}.xz", compress: 'xz', paths: ['*.log'], directory: directory)
188
- expect(result.success?).to eq(true)
189
-
190
- file = host.file("#{spec_dir}/#{archive}.xz")
191
- expect(file.path).to eq("#{spec_dir}/archive.tar.xz")
192
- expect(file.uid).to eq(1000)
193
-
194
- case os_name
195
- when 'opensuse', 'sles'
196
- expect(file.gid).to eq(100)
197
- else
198
- expect(file.gid).to eq(1000)
199
- end
200
- end
201
-
202
- case os_name
203
- when 'centos', 'rhel', 'debian'
204
- ## no op
205
- else
206
- result = host.tar('create', "#{archive}.lzma", compress: 'lzma', paths: ['*.log'], directory: directory)
207
- expect(result.success?).to eq(true)
208
-
209
- file = host.file("#{spec_dir}/#{archive}.lzma")
210
- expect(file.path).to eq("#{spec_dir}/archive.tar.lzma")
211
- expect(file.uid).to eq(1000)
212
-
213
- case os_name
214
- when 'opensuse', 'sles'
215
- expect(file.gid).to eq(100)
216
- else
217
- expect(file.gid).to eq(1000)
218
- end
219
- end
220
-
221
- expect do
222
- host.tar('create', "#{archive}.lzop", compress: 'lzop', paths: ['*.log'],
223
- directory: directory)
224
- end.to raise_error(ArgumentError)
225
- end
226
- end
227
- end
228
- end