summaryrefslogtreecommitdiff
path: root/lib/leap_cli/macros/files.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-07-20 12:22:31 -0700
committerelijah <elijah@riseup.net>2016-07-20 12:22:31 -0700
commit2d6bfce47b3f50d2b058b938ad9b42a7cd2e3142 (patch)
tree098a820f27be37973295e32a07b30c05b991aab4 /lib/leap_cli/macros/files.rb
parentd6b064672d49e421e34f2165513178ffa7cee8ab (diff)
minor (improve readability of deploy message by showing correct rsync paths)
Diffstat (limited to 'lib/leap_cli/macros/files.rb')
-rw-r--r--lib/leap_cli/macros/files.rb27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/leap_cli/macros/files.rb b/lib/leap_cli/macros/files.rb
index 04c94edf..602fdddb 100644
--- a/lib/leap_cli/macros/files.rb
+++ b/lib/leap_cli/macros/files.rb
@@ -79,19 +79,26 @@ module LeapCli
#
# file_path(:dkim_priv_key) {generate_dkim_key}
#
- # notes:
+ # Notes:
#
- # * argument 'path' is relative to Path.provider/files or
- # Path.provider_base/files
- # * the path returned by this method is absolute
- # * the path stored for use later by rsync is relative to Path.provider
- # * if the path does not exist locally, but exists in provider_base,
+ # * Argument 'path' must be relative to Path.provider/files or
+ # Path.provider_base/files. It is OK for the path to be prefixed with
+ # with 'files/', this prefix will be ignored.
+ #
+ # * The path returned by this method is an absolute path on the server.
+ #
+ # * The path stored for use later by rsync is relative to the local
+ # Path.provider. It should always be prefixed with 'files/'
+ #
+ # * If the path does not exist locally, but exists in provider_base,
# then the default file from provider_base is copied locally. this
# is required for rsync to work correctly.
#
+ # NOTE: this is an aweful way to do this. It would be better
+ # to rsync twice.
+ #
def remote_file_path(path, options={}, &block)
local_path = local_file_path(path, options, &block)
-
return nil if local_path.nil?
# if file is under Path.provider_base, we must copy the default file to
@@ -110,9 +117,11 @@ module LeapCli
end
relative_path = Path.relative_path(local_path)
- relative_path.sub!(/^files\//, '') # remove "files/" prefix
@node.file_paths << relative_path
- return File.join(Leap::Platform.files_dir, relative_path)
+ return File.join(
+ Leap::Platform.files_dir,
+ relative_path.sub(/^files\//, '')
+ )
end
# deprecated