Skip to content

Instantly share code, notes, and snippets.

@innovid-rnd
Last active March 13, 2018 08:41
Show Gist options
  • Save innovid-rnd/d7f8a2802481cd22fa2e63478981766e to your computer and use it in GitHub Desktop.
Save innovid-rnd/d7f8a2802481cd22fa2e63478981766e to your computer and use it in GitHub Desktop.
class SomeCli < Formula
include Language::Python::Virtualenv
desc "A script that travels back in time and ..."
homepage "https://bitbucket.org/innovid/repo-name-with-the-script-to-install/src/HEAD/directory/"
version "0.19"
url "git@bitbucket.org:innovid/repo-name-with-the-script-to-install.git", :using => :git
resource "boto3" do
url "https://pypi.python.org/packages/32/08/42eae36fc58bb0b2da92c6fe2a274efec6c8bfe4f964bcdd1dddb9b6477a/boto3-1.5.36.tar.gz"
sha256 "5d7c47dbd14e6bbf1bee26da878091f31320bbb58aa72c5b08a8bf13c644d66e"
end
#... more python dependencies here ....
resource "altgraph" do
url "https://pypi.python.org/packages/ff/e5/c4d83ca50043951eec43449aa74f4aa4fde1695f901dcf9d213efea3abb1/altgraph-0.15.tar.gz"
sha256 "fc28b986a68fde8d3ff0e6d6ba3fbdd2cd562d11d45ef7c7735fbd826c9eec2e"
end
depends_on "python@2"
depends_on "coreutils"
def install
virtualenv_install_with_resources
create_wrapper
bin.install "time_travel.py"
bin.install "secret"
#bin.install ... more python files here ...
bin.install "some-cli"
end
private def create_wrapper
wrapper = '#!/usr/bin/env bash
SCRIPT=$(greadlink -f $0)
SCRIPTPATH=`dirname ${SCRIPT}`
echo "SCRIPTPATH:${SCRIPTPATH}"
source $SCRIPTPATH/../libexec/bin/activate
export BANANA="$SCRIPTPATH/banana"
python $SCRIPTPATH/script.py "$@"'
File.write('some-cli', wrapper)
end
test do
create_wrapper
# asserting our formula logic works.
assert_equal %w(some-cli Library), Dir.glob("*")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment