module Jekyll
  class Command
    def self.globs(source, destination)
      Dir.chdir(source) do
        dirs = Dir['*'].select { |x| File.directory?(x) }
        dirs -= [destination]
        dirs = dirs.map { |x| "#{x}/**/*" }
        dirs += ['*']
      end
    end
  end
end

module Jekyll
  class Command
    def self.globs(source, destination)
      Dir.chdir(source) do
        dirs = Dir['*'].select { |x| File.directory?(x) }
        dirs -= [destination, File.realpath(destination), File.basename(destination)]
        dirs = dirs.map { |x| "#{x}/**/*" }
        dirs += ['*']
      end
    end
  end
end

Fix bug where Command.globs didn't delete the destination directory. There was often a mix between absolute and relative paths and in the previous version, the destination argument was usually an absolute path where the glob array (from Dir['*']) was a relative path.
Fix bug where Command.globs didn't delete the destination directory.
There was often a mix between absolute and relative paths and in the
previous version, the destination argument was usually an absolute
path where the glob array (from Dir['*']) was a relative path.
