```ruby
require 'shellwords'
require 'travis/build/addons/base'

module Travis
  module Build
    class Addons
      class Hosts < Base
        SUPER_USER_SAFE = true
        HOSTS_FILE = '/etc/hosts'
        TEMP_HOSTS_FILE = '/tmp/hosts'

        def after_prepare
          sh.fold 'hosts.before' do
            sh.echo ""
            sh.cmd "cat #{HOSTS_FILE}"
          end
          sh.fold 'hosts' do
            sh.cmd "sed -e 's/^\\(127\\.0\\.0\\.1.*\\)$/\\1 #{hosts}/' #{HOSTS_FILE} > #{TEMP_HOSTS_FILE}"
            sh.cmd "cat #{TEMP_HOSTS_FILE} | sudo tee #{HOSTS_FILE} > /dev/null"
          end
          sh.fold 'hosts.after' do
            sh.echo ""
            sh.cmd "cat #{HOSTS_FILE}"
          end
        end

        private

          def hosts
            Array(config).join(' ').shellescape
          end
      end
    end
  end
end
```

Add newline after host file to fix fold
user
```ruby
require 'shellwords'
require 'travis/build/addons/base'

module Travis
  module Build
    class Addons
      class Hosts < Base
        SUPER_USER_SAFE = true
        HOSTS_FILE = '/etc/hosts'
        TEMP_HOSTS_FILE = '/tmp/hosts'

        def after_prepare
          sh.fold 'hosts.before' do
            sh.echo ""
            sh.cmd "cat #{HOSTS_FILE}"
            sh.echo ""
          end
          sh.fold 'hosts' do
            sh.cmd "sed -e 's/^\\(127\\.0\\.0\\.1.*\\)$/\\1 #{hosts}/' #{HOSTS_FILE} > #{TEMP_HOSTS_FILE}"
            sh.cmd "cat #{TEMP_HOSTS_FILE} | sudo tee #{HOSTS_FILE} > /dev/null"
          end
          sh.fold 'hosts.after' do
            sh.echo ""
            sh.cmd "cat #{HOSTS_FILE}"
            sh.echo ""
          end
        end

        private

          def hosts
            Array(config).join(' ').shellescape
          end
      end
    end
  end
end
```
assistant