Skip to content

Commit

Permalink
Releasing with Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Oct 1, 2013
1 parent d4aac6d commit a092244
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .gitignore
@@ -1,3 +1,5 @@
bin/asciinema
tmp
*.pyc
pkg/*.tar.gz
pkg/*.tar.bz2
pkg/*.zip
60 changes: 56 additions & 4 deletions 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
Expand All @@ -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

0 comments on commit a092244

Please sign in to comment.