diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Formula/cheat.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Library/Formula/cheat.rb b/Library/Formula/cheat.rb new file mode 100644 index 000000000..74b52527a --- /dev/null +++ b/Library/Formula/cheat.rb @@ -0,0 +1,42 @@ +require "formula" + +class Cheat < Formula + homepage "https://github.com/chrisallenlane/cheat" + url "https://github.com/chrisallenlane/cheat/archive/2.0.9.tar.gz" + sha1 "cf4a76badd8d0e58c9299037703ba4abbd2217df" + head "https://github.com/chrisallenlane/cheat.git" + + depends_on :python if MacOS.version <= :snow_leopard + + resource "docopt" do + url "https://pypi.python.org/packages/source/d/docopt/docopt-0.6.1.tar.gz" + sha1 "3d0ad1cf495d2c801327042e02d67b4ee4b85cd4" + end + + resource "Pygments" do + url "https://pypi.python.org/packages/source/P/Pygments/Pygments-1.6.tar.gz" + sha1 "53d831b83b1e4d4f16fec604057e70519f9f02fb" + end + + def install + ENV["PYTHONPATH"] = lib+"python2.7/site-packages" + ENV.prepend_create_path "PYTHONPATH", libexec+"lib/python2.7/site-packages" + + install_args = [ "setup.py", "install", "--prefix=#{libexec}" ] + + %w[docopt Pygments].each do |r| + resource(r).stage { system "python", *install_args } + end + + system "python", "setup.py", "install", "--prefix=#{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 |
