class RakeCompilerDock::DockerCheck

def help_text

def help_text
  help = []
  if !ok? && docker_client_avail? && !doma_avail? && !b2d_avail?
    help << red("Docker client tools work, but connection to the local docker server failed.")
    case host_os
    when /linux/
      help << yellow("Please make sure the docker daemon is running.")
      help << ""
      help << yellow("On Ubuntu/Debian:")
      help << "   sudo service docker start"
      help << yellow("or")
      help << "   sudo service docker.io start"
      help << ""
      help << yellow("On Fedora/Centos/RHEL")
      help << "   sudo systemctl start docker"
      help << ""
      help << yellow("On SuSE")
      help << "   sudo systemctl start docker"
      help << ""
      help << yellow("Then re-check with '") + white("docker version") + yellow("'")
      help << yellow("or have a look at our FAQs: http://git.io/vm8AL")
    else
      help << yellow("    Please check why '") + white("docker version") + yellow("' fails")
      help << yellow("    or have a look at our FAQs: http://git.io/vm8AL")
    end
  elsif !ok? && !doma_avail? && !b2d_avail?
    case host_os
    when /mingw|mswin/
      help << red("Docker is not available.")
      help << yellow("Please download and install the docker-toolbox:")
      help << yellow("    https://www.docker.com/docker-toolbox")
    when /linux/
      help << red("Neither Docker nor Podman is available.")
      help << ""
      help << yellow("Install Docker on Ubuntu/Debian:")
      help << "    sudo apt-get install docker.io"
      help << ""
      help << yellow("Install Docker on Fedora/Centos/RHEL")
      help << "    sudo yum install docker"
      help << "    sudo systemctl start docker"
      help << ""
      help << yellow("Install Docker on SuSE")
      help << "    sudo zypper install docker"
      help << "    sudo systemctl start docker"
    when /darwin/
      help << red("Docker is not available.")
      help << yellow("Please install docker-machine per homebrew:")
      help << "    brew cask install virtualbox"
      help << "    brew install docker"
      help << "    brew install docker-machine"
      help << ""
      help << yellow("or download and install the official docker-toolbox:")
      help << yellow("    https://www.docker.com/docker-toolbox")
    else
      help << red("Docker is not available.")
    end
  elsif doma_avail?
    if !ok? && !doma_create_ok?
      help << red("docker-machine is installed but machine couldn't be created.")
      help << ""
      help << yellow("    Please check why '") + white("docker-machine create") + yellow("' fails")
      help << yellow("    or have a look at our FAQs: http://git.io/vRzIg")
    elsif !ok? && !doma_start_ok?
      help << red("docker-machine is installed but couldn't be started.")
      help << ""
      help << yellow("    Please check why '") + white("docker-machine start") + yellow("' fails.")
      help << yellow("    You might need to re-init with '") + white("docker-machine rm") + yellow("'")
      help << yellow("    or have a look at our FAQs: http://git.io/vRzIg")
    elsif !ok? && !doma_env_ok?
        help << red("docker-machine is installed and started, but 'docker-machine env' failed.")
        help << ""
        help << yellow("You might try to regenerate TLS certificates with:")
        help << "    docker-machine regenerate-certs #{machine_name}"
    elsif !ok? && !doma_pwd_ok?
      help << red("docker-machine can not mount the current working directory.")
      help << ""
      case host_os
      when /mingw|mswin/
        help << yellow("    Please move to a diretory below C:\\Users")
      when /darwin/
        help << yellow("    Please move to a diretory below /Users")
      end
    elsif !ok?
      help << red("docker-machine is installed and started, but 'docker version' failed.")
      help << ""
      if doma_has_env?
        help << yellow("    Please copy and paste following environment variables to your terminal")
        help += @doma_env_text.each_line.reject{|l| l=~/\s*#/ }.map{|l| "        #{l.chomp}" }
        help << yellow("    and check why '") + white("docker version") + yellow("' fails.")
      else
        help << yellow("    Please check why '") + white("docker version") + yellow("' fails.")
      end
      help << yellow("    You might also have a look at our FAQs: http://git.io/vRzIg")
    end
  elsif b2d_avail?
    if !ok? && !b2d_init_ok?
      help << red("boot2docker is installed but couldn't be initialized.")
      help << ""
      help << yellow("    Please check why '") + white("boot2docker init") + yellow("' fails")
      help << yellow("    or have a look at our FAQs: http://git.io/vm8Nr")
    elsif !ok? && !b2d_start_ok?
      help << red("boot2docker is installed but couldn't be started.")
      help << ""
      help << yellow("    Please check why '") + white("boot2docker start") + yellow("' fails.")
      help << yellow("    You might need to re-init with '") + white("boot2docker delete") + yellow("'")
      help << yellow("    or have a look at our FAQs: http://git.io/vm8Nr")
    elsif !ok? && !doma_pwd_ok?
      help << red("boot2docker can not mount the current working directory.")
      help << ""
      case host_os
      when /mingw|mswin/
        help << yellow("    Please move to a diretory below C:\\Users")
      when /darwin/
        help << yellow("    Please move to a diretory below /Users")
      end
    elsif !ok? && b2d_start_ok?
      help << red("boot2docker is installed and started, but 'docker version' failed.")
      help << ""
      if b2d_start_has_env?
        help << yellow("    Please copy and paste above environment variables to your terminal")
        help << yellow("    and check why '") + white("docker version") + yellow("' fails.")
      else
        help << yellow("    Please check why '") + white("docker version") + yellow("' fails.")
      end
      help << yellow("    You might need to re-init with '") + white("boot2docker delete") + yellow("'")
      help << yellow("    or have a look at our FAQs: http://git.io/vm8Nr")
    end
  end
  help.join("\n")
end