diff --git a/.gitignore b/.gitignore index 0a0e4a91b..decd7d55f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ -bin/asciinema tmp *.pyc +pkg/*.tar.gz +pkg/*.tar.bz2 +pkg/*.zip diff --git a/Makefile b/Makefile index 5f7f955fa..ac05be5d2 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,58 @@ -all: build +NAME=asciinema +VERSION=0.9.1 +AUTHOR=sickill +URL=https://github.com/$(AUTHOR)/$(NAME) -build: bin/asciinema +DIRS=bin +INSTALL_DIRS=`find $(DIRS) -type d 2>/dev/null` +INSTALL_FILES=`find $(DIRS) -type f 2>/dev/null` + +PKG_DIR=pkg +PKG_NAME=$(NAME)-$(VERSION) +PKG=$(PKG_DIR)/$(PKG_NAME).tar.gz +SIG=$(PKG).asc + +PREFIX?=/usr/local + +pkg: + mkdir $(PKG_DIR) + +download: pkg + wget -O $(PKG) $(URL)/archive/v$(VERSION).tar.gz + +$(SIG): $(PKG) + gpg --sign --detach-sign --armor $(PKG) + git add $(PKG).asc + git commit $(PKG).asc -m "Added PGP signature for v$(VERSION)" + git push + +verify: $(PKG) $(SIG) + gpg --verify $(SIG) $(PKG) + +clean: + rm -f $(PKG) $(SIG) + +all: $(PKG) $(SIG) + +update-bin: bin/asciinema + git add bin/asciinema + git commit bin/asciinema -m "Update bin/asciinema for $(VERSION) release" + git push + +tag: + git tag -s -m "Releasing $(VERSION)" v$(VERSION) + git push --tags + +sign: $(SIG) + +release: update-bin tag download sign + +install: + for dir in $(INSTALL_DIRS); do mkdir -p $(PREFIX)/$$dir; done + for file in $(INSTALL_FILES); do cp $$file $(PREFIX)/$$file; done + +uninstall: + for file in $(INSTALL_FILES); do rm -f $(PREFIX)/$$file; done bin/asciinema: tmp/asciinema.zip echo '#!/usr/bin/env python2' > bin/asciinema @@ -10,9 +62,9 @@ bin/asciinema: tmp/asciinema.zip tmp/asciinema.zip: src/* src/commands/* mkdir -p tmp rm -f tmp/asciinema.zip - cd src && zip -r ../tmp/asciinema.zip `find . -name \*.py` + cd src && zip -r - `find . -name \*.py` >../tmp/asciinema.zip test: PYTHONPATH=tests nosetests `find tests -name "*_test.py"` -.PHONY: test +.PHONY: download sign verify clean test tag release install uninstall all