filander 0.5.0 → 0.5.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.
@@ -15,6 +15,7 @@ module Filander
|
|
15
15
|
def create_directory_for(destination = nil)
|
16
16
|
dest_dir = File.dirname(join_destination(destination))
|
17
17
|
|
18
|
+
return if Filander.behavior == :pretend
|
18
19
|
FileUtils.mkdir_p dest_dir unless File.exists?(dest_dir)
|
19
20
|
end
|
20
21
|
|
@@ -31,7 +32,7 @@ module Filander
|
|
31
32
|
skip = true
|
32
33
|
else
|
33
34
|
case Filander.behavior
|
34
|
-
when :force
|
35
|
+
when :force, :pretend
|
35
36
|
report :force, destination
|
36
37
|
when :skip
|
37
38
|
report :skip, destination
|
@@ -5,7 +5,7 @@ module Filander
|
|
5
5
|
def copy_directory(source, destination = source)
|
6
6
|
create_directory_for destination
|
7
7
|
filename = join_source(source)
|
8
|
-
raise "Source file `#{filename}' does not exist"
|
8
|
+
raise "Source file `#{filename}' does not exist" if !File.exists?(filename) && Filander.behavior != :pretend
|
9
9
|
|
10
10
|
dest = join_destination(destination)
|
11
11
|
with_report destination, entries(filename) do
|
@@ -5,7 +5,7 @@ module Filander
|
|
5
5
|
def copy_file(source, destination = source)
|
6
6
|
create_directory_for destination
|
7
7
|
filename = join_source(source)
|
8
|
-
raise "Source file `#{filename}' does not exist"
|
8
|
+
raise "Source file `#{filename}' does not exist" if !File.exists?(filename) && Filander.behavior != :pretend
|
9
9
|
|
10
10
|
content = File.read(filename) rescue nil
|
11
11
|
with_report destination, content do
|