Skip to content

Commit f891948

Browse files
committed
Hello, world!
0 parents  commit f891948

20 files changed

+604
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
src/_build/
2+
*.native
3+
*.byte

.ocamlinit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(* begin mk topgen *)
2+
#thread
3+
#directory "src/_build"
4+
(* end *)

.ocp-indent

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
strict_with=auto
2+
max_indent=2

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Topple
2+
3+
Topple is a small script for running commands associated with vertices of a graph with versions in order.
4+
Most likely, the vertices of the graph are subprojects in a big project and an edge from A to B means A depends on B.
5+
6+
**Most of the time, the right tool for that sort of thing is Make.**
7+
I wrote this partly for fun and partly because I actually thought it'd help me save some time with a project (it did!).
8+
9+
Suppose you have the graph (stored in `_topple`):
10+
11+
A --> B --> C
12+
\
13+
\--> D --> E
14+
15+
... some commands associated with A, B, C, D, and E, their current versions, and their versions at the last time you ran the command.
16+
17+
Suppose the version of B, stored in `B/.topple-version`, is different than the version of B from when you last ran `topple`.
18+
Topple keeps track of this in `.topple-status`.
19+
Then `topple` will run the commands for B, C, and D, then E.
20+
21+
The `_topple` file for the example above might look like this:
22+
23+
# A comment.
24+
25+
A:
26+
# Some commands for A.
27+
28+
B: A
29+
# Some commands for B.
30+
31+
C: B
32+
# Some commands for C.
33+
34+
D: B
35+
# Some commands for D.
36+
37+
E: A B D
38+
# Not necessary to list A and B (because D depends on them).
39+
40+
Looks suspiciously like a Makefile!
41+
42+
If these commands create files whose modification times you can easily compare to determine whether or not you want to rerun the commands for a vertex (say, if B's output is newer than C's, we want to rerun the commands for C), then **you should use Make**.
43+
44+
Topple will be a little more annoying because you have to specify that a vertex has a new version yourself.
45+
A new version might come in when you `git pull`, along with sources modified by your teammate.
46+
Of course, you yourself can increase the version by running `topup` or `topup <path>`.
47+
48+
When you run `topple` in the directory with a `_topple` file it'll rebuild everything downstream of the vertex with the new version.
49+
50+
# Installing
51+
52+
Topple is written in OCaml. If you have OPAM,
53+
54+
git clone https://github.com/jonathanyc/topple.git
55+
opam pin add topple topple
56+
57+
... should both install dependencies and install `topple` and `topup` to your `$PATH`.

_car

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# The project name. Used to name library files, the top binary, and the docdir.
2+
project = "topple"
3+
# The ocamlfind package name.
4+
package = "topple"
5+
# A list of ocamlfind packages required by this project.
6+
requires = [
7+
"unix",
8+
9+
"toml",
10+
"pcre",
11+
"batteries",
12+
13+
"utop",
14+
]
15+
# A list of additional flags to pass to ocamlbuild.
16+
flags = []

example/.topple-status

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
gamma yDRv3FO85Ggji1Fgp1bmS8bBTrKVg9ud
2+
alpha aKk2vMZkVKWtSsVKerzpb1PxLgkZKRAv
3+
beta itwNhXAzy5A7nonBMAb8iOXv6j7FTmgj

example/_topple

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
alpha: beta gamma
2+
echo "rebuilding alpha"
3+
4+
beta: gamma
5+
echo "rebuilding beta"
6+
7+
gamma:
8+
echo "rebuilding gamma"

example/alpha/.topple-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aKk2vMZkVKWtSsVKerzpb1PxLgkZKRAv

example/beta/.topple-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
itwNhXAzy5A7nonBMAb8iOXv6j7FTmgj

example/gamma/.topple-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
yDRv3FO85Ggji1Fgp1bmS8bBTrKVg9ud

0 commit comments

Comments
 (0)