about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-02-25 02:45:40 +0100
committerhut <hut@lavabit.com>2010-02-25 02:45:47 +0100
commite9e4b4ffa4b4865c46acbebfc7ef2083bfac0210 (patch)
tree881e838f20c2025321409b23157b8e4af1f4eea2
parenta5d9423cad0a112564447b2519208b9ec5354665 (diff)
downloadranger-e9e4b4ffa4b4865c46acbebfc7ef2083bfac0210.tar.gz
added Makefile
-rw-r--r--Makefile39
-rwxr-xr-xall_tests.py10
-rwxr-xr-xmake_doc.py28
3 files changed, 48 insertions, 29 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..c2393415
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+PYTHON = python
+DOCDIR = doc/pydoc
+CWD = $(shell pwd)
+
+.PHONY: all clean doc cleandoc edit push test commit install
+
+all: clean test
+
+doc: cleandoc
+	mkdir -p $(DOCDIR)
+	cd $(DOCDIR); \
+		$(PYTHON) -c 'import pydoc, sys; \
+		sys.path[0] = "$(CWD)"; \
+		pydoc.writedocs("$(CWD)")'
+
+install:
+	@less -XF INSTALL
+
+cleandoc:
+	test -d $(DOCDIR) && rm -f $(DOCDIR)/*.html
+
+clean:
+	find . -regex .\*.pyc$ | xargs rm
+
+test:
+	./all_tests.py
+
+edit:
+	@vi ranger.py $(shell find ranger test -regex .\*py$ )
+
+push:
+	@for repo in $(shell git remote); do \
+		echo "Pushing to $$repo..."; \
+		git push $$repo master; \
+		git push $$repo -f hut; \
+	done
+
+commit:
+	@git citool
diff --git a/all_tests.py b/all_tests.py
index 33b16f7f..6693b870 100755
--- a/all_tests.py
+++ b/all_tests.py
@@ -3,6 +3,12 @@
 if __name__ == '__main__':
 	import unittest
 	from test import *
+	from sys import exit, argv
+
+	try:
+		verbosity = int(argv[1])
+	except IndexError:
+		verbosity = 2
 
 	tests = []
 	for key, val in vars().copy().items():
@@ -10,4 +16,6 @@ if __name__ == '__main__':
 			tests.extend(v for k,v in vars(val).items() if type(v) == type)
 
 	suite = unittest.TestSuite(map(unittest.makeSuite, tests))
-	unittest.TextTestRunner(verbosity=2).run(suite)
+	result = unittest.TextTestRunner(verbosity=verbosity).run(suite)
+	if len(result.errors) + len(result.failures) > 0:
+		exit(1)
diff --git a/make_doc.py b/make_doc.py
deleted file mode 100755
index d59ac73b..00000000
--- a/make_doc.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/python
-"""Generate pydoc documentation and move it to the doc directory.
-THIS WILL DELETE ALL EXISTING HTML FILES IN THAT DIRECTORY, so don't
-store important content there."""
-
-import pydoc, os, sys
-if __name__ == '__main__':
-	docdir = 'doc/pydoc'
-	os.chdir(sys.path[0])
-	try: os.mkdir(docdir)
-	except: pass
-
-
-	for fname in os.listdir(docdir):
-		if fname.endswith('.html'):
-			os.remove(os.path.join(docdir, fname))
-
-	pydoc.writedocs('.')
-	pydoc.writedoc('curses')
-	pydoc.writedoc('curses.ascii')
-	pydoc.writedoc('os')
-	pydoc.writedoc('os.path')
-	pydoc.writedoc('sys')
-
-	for fname in os.listdir('.'):
-		if fname.endswith('.html'):
-			os.rename(fname, os.path.join(docdir, fname))
-