trash_lib 1.0.0 → 1.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/trash/version.rb +1 -1
- data/lib/trash.rb +6 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a95f6070a2a39e218dff3d06852dbb0f784bf613d5648a616bc39e7104892a74
|
4
|
+
data.tar.gz: 7542becd9922251f1bc6fb42079ad5296d1e9af5b611c07816fbe7de338217cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a54b265683be7bf27b888a3853188cb49b48fc470cea83fe5497aa0091b396640356fe534aec999733565bb01e0aab44304e3f52c1732c11a21fa511b840858f
|
7
|
+
data.tar.gz: 825344d5b5c066b83af8bbc7762e0c46a143d0905053f5b77abe5fdc88d393e0e241f2c6e26511b9c6f92f2cda4390e18932f1920b956a84a7e81af19da03009
|
data/CHANGELOG.md
CHANGED
data/lib/trash/version.rb
CHANGED
data/lib/trash.rb
CHANGED
@@ -25,7 +25,7 @@ module Trash
|
|
25
25
|
|
26
26
|
# Restore file to original path.
|
27
27
|
def restore
|
28
|
-
FileUtils.move
|
28
|
+
FileUtils.move(path, origin, secure: true) # FIXME
|
29
29
|
delete_info
|
30
30
|
|
31
31
|
nil
|
@@ -33,7 +33,7 @@ module Trash
|
|
33
33
|
|
34
34
|
# Permanently delete the file.
|
35
35
|
def delete
|
36
|
-
FileUtils.remove_entry_secure
|
36
|
+
FileUtils.remove_entry_secure(path, force: true)
|
37
37
|
delete_info
|
38
38
|
|
39
39
|
nil
|
@@ -50,7 +50,7 @@ module Trash
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def delete_info
|
53
|
-
FileUtils.remove_entry_secure
|
53
|
+
FileUtils.remove_entry_secure(info_path, force: true)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -72,8 +72,8 @@ module Trash
|
|
72
72
|
trash_name = trash_name(path)
|
73
73
|
trash_path = File.join(TRASH_FILE_PATH, trash_name)
|
74
74
|
|
75
|
-
FileUtils.move
|
76
|
-
make_trash_info trash_name
|
75
|
+
FileUtils.move(path, trash_path, secure: true)
|
76
|
+
make_trash_info(path, trash_name)
|
77
77
|
|
78
78
|
Entry.new trash_path
|
79
79
|
end
|
@@ -108,7 +108,7 @@ module Trash
|
|
108
108
|
trash_name
|
109
109
|
end
|
110
110
|
|
111
|
-
def make_trash_info(trash_name)
|
111
|
+
def make_trash_info(path, trash_name)
|
112
112
|
File.open(File.join(TRASH_INFO_PATH, "#{trash_name}.trashinfo"), 'w') do |file|
|
113
113
|
file.write <<~TRASH_INFO
|
114
114
|
[Trash Info]
|
@@ -121,5 +121,3 @@ module Trash
|
|
121
121
|
|
122
122
|
private_constant :Entry, :TRASH_PATH, :TRASH_FILE_PATH, :TRASH_INFO_PATH
|
123
123
|
end
|
124
|
-
|
125
|
-
pp Trash.list
|