def all_files_under(source, options = {})
      excludes = Array(options[:exclude]).map do |exclude|
        [exclude, "#{exclude}/*"]
      end.flatten

      source_files = glob(File.join(source, "**/*"))
      source_files = source_files.reject do |source_file|
        basename = relative_path_for(source_file, source)
        excludes.any? { |exclude| File.fnmatch?(exclude, basename, File::FNM_DOTMATCH) }
      end
    end
def all_files_under(source, options = {})
      excludes = Array(options[:exclude]).map do |exclude|
        [exclude, "#{exclude}/*"]
      end.flatten

      source_files = glob(File.join(source, "**/*"))
      source_files = source_files.reject do |source_file|
        basename = relative_path_for(source_file, source)
        excludes.any? { |exclude| File.fnmatch?(exclude, basename, File::FNM_DOTMATCH) }
      end
    end
Glob for all files under a given path/pattern, removing Ruby's
 dumb idea to include +'.'+ and +'..'+ as entries.

 @param [String] source
   the path or glob pattern to get all files from

 @option options [String, Array<String>] :exclude
   a file, folder, or globbing pattern of files to ignore when syncing

 @return [Array<String>]
   the list of all files