kanrisuru 0.8.11 → 0.8.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/lib/kanrisuru/core/file.rb +12 -3
- data/lib/kanrisuru/version.rb +1 -1
- data/spec/functional/core/file_spec.rb +23 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96b168459e76c64aa511a58fc43d0d777d5d783874e47a24c373dd6da2ef3ff4
|
4
|
+
data.tar.gz: 461c0236448253694f369cfc1b7757f61aeb0a4e0af3841cea62b6297d862c14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d8b47306256c698e30c7950fc18a59551fb156b14bc6e077df323a27832af8125f567213ec066ec1c8e5f7295411a0a113823ef4a6c97df0bbf5a6d753fc851
|
7
|
+
data.tar.gz: 5152a07e2d3580c4de9fb477d36c8de6f1d3fae3a6e234a6c3a80318524cb8ae6fefaebd984501f63b3b5de79350c2d9b53eac92b133453aebd1c47ba4323619
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
## Kanrisuru 0.8.12 (October 3, 20201)
|
2
|
+
* Refactor `rmdir` command to only work on empty directories.
|
3
|
+
|
1
4
|
## Kanrisuru 0.8.11 (October 1, 20201)
|
2
|
-
* Allow `Kanrisuru::Mode` as mode option in mkdir method.
|
5
|
+
* Allow `Kanrisuru::Mode` as mode type option in mkdir method.
|
3
6
|
|
4
7
|
## Kanrisuru 0.8.10 (August 24, 20201)
|
5
8
|
* Fix bug with rspec test case.
|
data/lib/kanrisuru/core/file.rb
CHANGED
@@ -206,10 +206,19 @@ module Kanrisuru
|
|
206
206
|
Kanrisuru::Result.new(command)
|
207
207
|
end
|
208
208
|
|
209
|
-
def rmdir(
|
210
|
-
|
209
|
+
def rmdir(paths, opts = {})
|
210
|
+
paths = [paths] if paths.instance_of?(String)
|
211
|
+
paths.each do |path|
|
212
|
+
raise ArgumentError, "Can't delete root path" if path == '/' || realpath(path).path == '/'
|
213
|
+
end
|
211
214
|
|
212
|
-
|
215
|
+
command = Kanrisuru::Command.new("rmdir #{paths.join(' ')}")
|
216
|
+
command.append_flag('--ignore-fail-on-non-empty', opts[:silent])
|
217
|
+
command.append_flag('--parents', opts[:parents])
|
218
|
+
|
219
|
+
execute_shell(command)
|
220
|
+
|
221
|
+
Kanrisuru::Result.new(command)
|
213
222
|
end
|
214
223
|
|
215
224
|
def mkdir(path, opts = {})
|
data/lib/kanrisuru/version.rb
CHANGED
@@ -40,8 +40,8 @@ RSpec.describe Kanrisuru::Core::File do
|
|
40
40
|
keys: [host_json['ssh_key']]
|
41
41
|
)
|
42
42
|
|
43
|
-
host.
|
44
|
-
host.
|
43
|
+
host.rm("#{host_json['home']}/.kanrisuru_spec_files", force: true, recursive: true)
|
44
|
+
host.rm("#{host_json['home']}/extract-tar-files", force: true, recursive: true) if host.dir?("#{host_json['home']}/extract-tar-files")
|
45
45
|
host.disconnect
|
46
46
|
end
|
47
47
|
|
@@ -322,6 +322,27 @@ RSpec.describe Kanrisuru::Core::File do
|
|
322
322
|
expect(host.empty_file?(path)).to eq(false)
|
323
323
|
end
|
324
324
|
|
325
|
+
it 'removes directories' do
|
326
|
+
result = host.mkdir("#{spec_dir}/directory/1", silent: true)
|
327
|
+
expect(result).to be_success
|
328
|
+
|
329
|
+
result = host.mkdir("#{spec_dir}/directory/2", silent: true)
|
330
|
+
expect(result).to be_success
|
331
|
+
|
332
|
+
result = host.mkdir("#{spec_dir}/directory/3", silent: true)
|
333
|
+
expect(result).to be_success
|
334
|
+
|
335
|
+
result = host.rmdir(["#{spec_dir}/directory/1", "#{spec_dir}/directory/2"])
|
336
|
+
expect(result).to be_success
|
337
|
+
|
338
|
+
## Can't delete non empty dir
|
339
|
+
result = host.rmdir("#{spec_dir}/directory")
|
340
|
+
expect(result).to be_failure
|
341
|
+
|
342
|
+
result = host.rmdir("#{spec_dir}/directory/3")
|
343
|
+
expect(result).to be_success
|
344
|
+
end
|
345
|
+
|
325
346
|
it 'counts a file' do
|
326
347
|
result = host.wc('/etc/hosts')
|
327
348
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kanrisuru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.12
|
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-10-
|
11
|
+
date: 2021-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|