class Pgcli < Formula desc "CLI for Postgres with auto-completion and syntax highlighting" homepage "http://pgcli.com/" url "https://pypi.python.org/packages/source/p/pgcli/pgcli-0.17.0.tar.gz" sha256 "b7a47405da61bc05dbceb28443e13965f322f58d942e119499976be19e2e2d44" bottle do cellar :any sha256 "e777938c9c25c9a3c0077a414d5d2ecf48e2fe91e769ce193d403308a36dc24a" => :yosemite sha256 "07a2a41835ae74229d7866d3cfb95bf4b3027c6eb0c55e73dfb3a747f635db54" => :mavericks sha256 "d6c8bf046088a100a2a9989c9406a5b590c733d0a29ea32a7eddc73f114a04b8" => :mountain_lion end depends_on :python if MacOS.version <= :snow_leopard depends_on "openssl" depends_on :postgresql resource "sqlparse" do url "https://pypi.python.org/packages/source/s/sqlparse/sqlparse-0.1.14.tar.gz" sha256 "e561e31853ab9f3634a1a2bd53035f9e47dfb203d56b33cc6569047ba087daf0" end resource "psycopg2" do url "https://pypi.python.org/packages/source/p/psycopg2/psycopg2-2.6.tar.gz" sha256 "c00afecb302a99a4f83dec9b055c4d1cc196926d62c8db015d68432df8118ca8" end resource "six" do url "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz" sha256 "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5" end resource "wcwidth" do url "https://pypi.python.org/packages/source/w/wcwidth/wcwidth-0.1.4.tar.gz" sha256 "906d3123045d77027b49fe912458e1a1e1d6ca1a51558a4bd9168d143b129d2b" end resource "Pygments" do url "https://pypi.python.org/packages/source/P/Pygments/Pygments-2.0.2.tar.gz" sha256 "7320919084e6dac8f4540638a46447a3bd730fca172afc17d2c03eed22cf4f51" end resource "click" do url "https://pypi.python.org/packages/source/c/click/click-4.0.tar.gz" sha256 "f49e03611f5f2557788ceeb80710b1c67110f97c5e6740b97edf70245eea2409" end resource "prompt_toolkit" do url "https://pypi.python.org/packages/source/p/prompt_toolkit/prompt_toolkit-0.37.tar.gz" sha256 "680f0abab097619e013c75f4fc234f7734ee888a483d9492e326ecd7883c6859" end def install ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages" %w[click prompt_toolkit psycopg2 sqlparse Pygments wcwidth six].each do |r| resource(r).stage do system "python", *Language::Python.setup_install_args(libexec/"vendor") end end ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python2.7/site-packages" system "python", *Language::Python.setup_install_args(libexec) bin.install Dir["#{libexec}/bin/*"] bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) end test do system bin/"pgcli", "--help" end end