def populate(from: :auto)
      return if populated
      fail "Cannot populate without 'site'" if site.nil?

      case from
      when :auto
        if site.respond_to?(:repository) ? site.repository : nil
          populate from: :repository
        else
          populate from: :source
        end
      when :repository
        fail "Cannot populate without 'reference'" if reference.empty?
        repo.extract directory, reference: reference
        @populated = true
      when :source
        source = site.source.nil? ? '.' : site.source
        Utils.copy_directory source, directory, exclude: options[:copy_exclude]
        @populated = true
      end

      self
    end
def populate(from: :auto)
      return if populated
      fail "Cannot populate without 'site'" if site.nil?

      case from
      when :auto
        if site.respond_to?(:repository) ? site.repository : nil
          populate from: :repository
        else
          populate from: :source
        end
      when :repository
        fail "Cannot populate without 'reference'" if reference.empty?
        repo.extract directory, reference: reference
        @populated = true
      when :source
        source = site.source.nil? ? '.' : site.source
        Utils.copy_directory source, directory, exclude: options[:copy_exclude]
        @populated = true
      end

      self
    end
Extracts the site's files from repository to the working directory.
 @return [Environment] the current environment instance