kiip 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kiip/tasks/symlink_task.rb +12 -3
- data/lib/kiip/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93e5818f0a0325b3bcf27992b9625999ee7fd84b
|
4
|
+
data.tar.gz: 680475d12c6fff02f03712998dd18f3737c31d64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff4a62f82c33481ac4b599aff38ca7b820190dad8fd48ee6b09b9f6cf103189a0066973c06d06806767c4d5ad60d02b02f8481dbac92abd8199e7d9a51f73b67
|
7
|
+
data.tar.gz: 510ff324195741f64c08702b83495fa2af27bd02d584e457b5168975695a331a42a38fb9bef0b7a2b3800c1f2417572304866bc017e058aec314eb3b961f793c
|
@@ -21,10 +21,16 @@ module Kiip::Tasks
|
|
21
21
|
# actually execute the task
|
22
22
|
def exec!
|
23
23
|
return initialize! unless File.exists? target
|
24
|
+
if File.symlink? source
|
25
|
+
return if File.readlink(source) == target
|
24
26
|
|
25
|
-
|
27
|
+
if cli.agree "#{source} already exists, linking to #{File.readlink(source)}. Replace?"
|
28
|
+
remove_source
|
29
|
+
end
|
30
|
+
end
|
26
31
|
|
27
|
-
|
32
|
+
|
33
|
+
return create_symlink_from_source_to_target unless File.exists? source
|
28
34
|
|
29
35
|
if cli.agree "#{source} already exists. Replace with symlink?"
|
30
36
|
remove_source
|
@@ -55,7 +61,10 @@ module Kiip::Tasks
|
|
55
61
|
end
|
56
62
|
|
57
63
|
def remove_source
|
58
|
-
|
64
|
+
# only force on real directories
|
65
|
+
do_force = !File.symlink?(source) and File.directory?(source)
|
66
|
+
|
67
|
+
FileUtils.rm(source, verbose: is_verbose, noop: is_dry, force: do_force)
|
59
68
|
end
|
60
69
|
|
61
70
|
def move_source_to_target
|
data/lib/kiip/version.rb
CHANGED