plugins/pushes/ftp/push.rb in vagrant-unbundled-2.2.19.0 vs plugins/pushes/ftp/push.rb in vagrant-unbundled-2.3.2.0

- old
+ new

@@ -19,25 +19,25 @@ # Grab files early so if there's an exception or issue, we don't have to # wait and close the (S)FTP connection as well files = nil begin files = Hash[*all_files.flat_map do |file| - relative_path = relative_path_for(file, config.dir) + relative_path = relative_path_for(file, base_dir) destination = File.join(config.destination, relative_path) file = File.expand_path(file, env.root_path) [file, destination] end] rescue SystemStackError raise Errors::TooManyFiles end ftp = "#{config.username}@#{config.host}:#{config.destination}" - env.ui.info "Uploading #{env.root_path} to #{ftp}" + env.ui.info "Uploading #{files.length} files to #{env.root_path} to #{ftp}" connect do |ftp| files.each do |local, remote| - @logger.info "Uploading #{local} => #{remote}" + env.ui.info "Uploading #{local} => #{remote}" ftp.upload(local, remote) end end end @@ -52,21 +52,21 @@ # The list of all files that should be pushed by this push. This method # only returns **files**, not folders or symlinks! # @return [Array<String>] def all_files - files = glob("#{config.dir}/**/*") + includes_files + files = glob("#{base_dir}/**/*") + includes_files filter_excludes!(files, config.excludes) files.reject! { |f| !File.file?(f) } files end # The list of files to include in addition to those specified in `dir`. # @return [Array<String>] def includes_files includes = config.includes.flat_map do |i| - path = absolute_path_for(i, config.dir) + path = absolute_path_for(i, base_dir) [path, "#{path}/**/*"] end glob("{#{includes.join(",")}}") end @@ -118,9 +118,17 @@ # @return [String] def relative_path_for(path, parent) Pathname.new(path).relative_path_from(Pathname.new(parent)).to_s rescue ArgumentError return path + end + + def base_dir + if Pathname.new(config.dir).absolute? + config.dir + else + File.join(File.expand_path(env.root_path), config.dir) + end end end end end