From: elijah Date: Mon, 11 Feb 2013 02:02:14 +0000 (-0800) Subject: fix file_path so that nested files are copied correctly X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=b57bd7654615aa501d1e7ad662aaabd70c11620a;p=leap%2Fleap_cli.git fix file_path so that nested files are copied correctly --- diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb index f75bcb9..b0e3017 100644 --- a/lib/leap_cli/config/object.rb +++ b/lib/leap_cli/config/object.rb @@ -249,7 +249,7 @@ module LeapCli # * 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, then the default file from - # provider_base is copied locally. + # provider_base is copied locally. this is required for rsync to work correctly. # def file_path(path) if path.is_a? Symbol @@ -257,12 +257,14 @@ module LeapCli end actual_path = Path.find_file(path) if actual_path.nil? + Util::log 2, :missing, path nil else if actual_path =~ /^#{Regexp.escape(Path.provider_base)}/ # if file is under Path.provider_base, we must copy the default file to # to Path.provider in order for rsync to be able to sync the file. local_provider_path = actual_path.sub(/^#{Regexp.escape(Path.provider_base)}/, Path.provider) + FileUtils.mkdir_p File.dirname(local_provider_path) FileUtils.cp_r actual_path, local_provider_path Util.log :created, Path.relative_path(local_provider_path) actual_path = local_provider_path