<commit_before>require "language/go"

class DockerMachine < Formula
  desc "Create Docker hosts locally and on cloud providers"
  homepage "https://docs.docker.com/machine"
  url "https://github.com/docker/machine.git",
    :tag => "v0.7.0",
    :revision => "a650a404fc3e006fea17b12615266168db79c776"

  head "https://github.com/docker/machine.git"

  bottle do
    cellar :any_skip_relocation
    sha256 "86d9ec6859f7fde204cb91dae32156ecaef8a2212d30d259ec28277404e6b673" => :el_capitan
    sha256 "aa181f63f646a447fb68f0d6961a5baf7a136354d59918da63701cbaf10ed2de" => :yosemite
    sha256 "eeffcd5720a79489fb93dba2fa7f1e8bc7f4b1824f51dae885c10833a9dca33c" => :mavericks
  end

  depends_on "go" => :build
  depends_on "automake" => :build

  def install
    ENV["GOBIN"] = bin
    ENV["GOPATH"] = buildpath
    ENV["GOHOME"] = buildpath

    path = buildpath/"src/github.com/docker/machine"
    path.install Dir["*"]

    Language::Go.stage_deps resources, buildpath/"src"

    cd path do
      system "make", "build"
      bin.install Dir["bin/*"]
      bash_completion.install Dir["contrib/completion/bash/*.bash"]
    end
  end

  test do
    assert_match /#{version}/, shell_output(bin/"docker-machine --version")<commit_msg>docker-machine: add launchd script<commit_after>require "language/go"

class DockerMachine < Formula
  desc "Create Docker hosts locally and on cloud providers"
  homepage "https://docs.docker.com/machine"
  url "https://github.com/docker/machine.git",
    :tag => "v0.7.0",
    :revision => "a650a404fc3e006fea17b12615266168db79c776"

  head "https://github.com/docker/machine.git"

  bottle do
    cellar :any_skip_relocation
    sha256 "86d9ec6859f7fde204cb91dae32156ecaef8a2212d30d259ec28277404e6b673" => :el_capitan
    sha256 "aa181f63f646a447fb68f0d6961a5baf7a136354d59918da63701cbaf10ed2de" => :yosemite
    sha256 "eeffcd5720a79489fb93dba2fa7f1e8bc7f4b1824f51dae885c10833a9dca33c" => :mavericks
  end

  depends_on "go" => :build
  depends_on "automake" => :build

  def install
    ENV["GOBIN"] = bin
    ENV["GOPATH"] = buildpath
    ENV["GOHOME"] = buildpath

    path = buildpath/"src/github.com/docker/machine"
    path.install Dir["*"]

    Language::Go.stage_deps resources, buildpath/"src"

    cd path do
      system "make", "build"
      bin.install Dir["bin/*"]
      bash_completion.install Dir["contrib/completion/bash/*.bash"]
    end
  end

  plist_options :manual => "docker-machine start"

  def plist; <<-EOS.undent
     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
     <plist version="1.0">
       <dict>
         <key>EnvironmentVariables</key>
         <dict>
             <key>PATH</key>
             <string>/usr/bin:/bin:/usr/sbin:/sbin:#{HOMEBREW_PREFIX}/bin</string>
         </dict>
         <key>Label</key>
         <string>#{plist_name}</string>
         <key>ProgramArguments</key>
         <array>
             <string>#{opt_bin}/docker-machine</string>
             <string>start</string>
             <string>default</string>
         </array>
         <key>RunAtLoad</key>
         <true/>
         <key>WorkingDirectory</key>
         <string>#{HOMEBREW_PREFIX}</string>
       </dict>
     </plist>
     EOS
  end

  test do
    assert_match /#{version}/, shell_output(bin/"docker-machine --version")
{'fraction_non_alphanumeric': 0.1349112426035503, 'fraction_numerical': 0.09319526627218935, 'mean_word_length': 3.268939393939394, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 1, '>': 53, 'https://': 6, 'lorem ipsum': 0, 'www.': 1, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5291905', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1232, 'n_words': 197}