class Cheat < Formula desc "Create and view interactive cheat sheets for *nix commands" homepage "https://github.com/chrisallenlane/cheat" url "https://github.com/chrisallenlane/cheat/archive/2.1.10.tar.gz" sha256 "e2620ffa0b37154d07e18aeb3e10edc786709cc582e8f710e46cb2d46097537b" head "https://github.com/chrisallenlane/cheat.git" bottle do cellar :any sha256 "d9f5898a743c725bcf6619f427c0df4ca29e8092742b7424720ec1f90cb286ea" => :yosemite sha256 "d6a10fadd0f461c9cd49471de8c06cb21efcd80f3e5b175e5acc56735bab4468" => :mavericks sha256 "ade889c77c1bf84693c8ee38daab29e59c2ba94ff44c5db3a4d4ed7b6f522f23" => :mountain_lion end depends_on :python if MacOS.version <= :snow_leopard resource "docopt" do url "https://pypi.python.org/packages/source/d/docopt/docopt-0.6.2.tar.gz" sha256 "49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491" end resource "Pygments" do url "https://pypi.python.org/packages/source/P/Pygments/Pygments-2.0.2.tar.gz" sha256 "7320919084e6dac8f4540638a46447a3bd730fca172afc17d2c03eed22cf4f51" end def install ENV["PYTHONPATH"] = lib+"python2.7/site-packages" ENV.prepend_create_path "PYTHONPATH", libexec+"lib/python2.7/site-packages" resources.each do |r| r.stage { system "python", *Language::Python.setup_install_args(libexec) } end system "python", *Language::Python.setup_install_args(prefix) bash_completion.install "cheat/autocompletion/cheat.bash" zsh_completion.install "cheat/autocompletion/cheat.zsh" => "_cheat" bin.env_script_all_files(libexec+"bin", :PYTHONPATH => ENV["PYTHONPATH"]) end test do system "#{bin}/cheat", "tar" end end