Skip to content

Commit

Permalink
Merge pull request #36 from PeaceMonster/dev
Browse files Browse the repository at this point in the history
Add functions to list library
  • Loading branch information
aslanix authored Aug 23, 2024
2 parents 1fff4a0 + f4a173d commit 44c944d
Show file tree
Hide file tree
Showing 34 changed files with 2,374 additions and 3 deletions.
59 changes: 59 additions & 0 deletions examples/raft-troupe/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
MKID=node $(TROUPE)/rt/built/p2p/mkid.mjs
MKALIASES=node $(TROUPE)/rt/built/p2p/mkaliases.js
START=$(TROUPE)/network.sh
LOCAL=$(TROUPE)/local.sh

LIBS := $(shell find libs -type f)
TESTS := $(shell find tests -type f)

run: build/raft_troupe.trp
$(LOCAL) ./build/raft_troupe.trp

build/raft_troupe.trp: node.trp $(LIBS) $(TESTS)
python build.py node.trp

zero.listener1:
$(START) zero.trp --id=ids/node1.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener2:
$(START) zero.trp --id=ids/node2.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener3:
$(START) zero.trp --id=ids/node3.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener4:
$(START) zero.trp --id=ids/node4.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener5:
$(START) zero.trp --id=ids/node5.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener6:
$(START) zero.trp --id=ids/node6.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener7:
$(START) zero.trp --id=ids/node7.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener8:
$(START) zero.trp --id=ids/node8.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener9:
$(START) zero.trp --id=ids/node9.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener10:
$(START) zero.trp --id=ids/node10.json --rspawn=true --aliases=aliases.json --stdiolev={} #
zero.listener11:
$(START) zero.trp --id=ids/node11.json --rspawn=true --aliases=aliases.json --stdiolev={} #

raft.dialer: build/raft_troupe.trp
$(START) ./build/raft_troupe.trp --id=ids/raft-dialer.json --aliases=aliases.json

test.dialer:
$(START) test.trp --id=ids/raft-dialer.json --aliases=aliases.json # --debug --debugp2p


create-network-identifiers:
mkdir -p ids
$(MKID) --outfile=ids/raft-dialer.json
$(MKID) --outfile=ids/node1.json
$(MKID) --outfile=ids/node2.json
$(MKID) --outfile=ids/node3.json
$(MKID) --outfile=ids/node4.json
$(MKID) --outfile=ids/node5.json
$(MKID) --outfile=ids/node6.json
$(MKID) --outfile=ids/node7.json
$(MKID) --outfile=ids/node8.json
$(MKID) --outfile=ids/node9.json
$(MKID) --outfile=ids/node10.json
$(MKID) --outfile=ids/node11.json
$(MKALIASES) --include ids/raft-dialer.json --include ids/node1.json --include ids/node2.json --include ids/node3.json --include ids/node4.json --include ids/node5.json --include ids/node6.json --include ids/node7.json --include ids/node8.json --include ids/node9.json --include ids/node10.json --include ids/node11.json --outfile aliases.json
1 change: 1 addition & 0 deletions examples/raft-troupe/aliases.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"raft-dialer":"12D3KooWDRik7kYXVNES7GVo9GcujxPttNqwLHoHmdp19wLSVrgc","node1":"12D3KooWEqiFsAJDFucPu8p77jLkDx1EgpL1UjFCbttiULEvEQRj","node2":"12D3KooWEvWUngvpYBp4asiHJqM7BpWGzH3ykv9P8JiUDKMyPQV6","node3":"12D3KooWDWGgz9tm3zg7C6HaqsCaztKtp4QGKD6S7a7TL8u3dkRA","node4":"12D3KooWDpfXNjRh22FFJgUcc4g8FqMxrVTfeNRDST2g56aYRtRE","node5":"12D3KooWRQkHssDfdeCNvitXY1rh1HaQ6rHJ67Lx3fkVQQ2puZVG","node6":"12D3KooWBFEAgdHniZbaciJPv62evrZbz78sh69cHw8DNYMWeTTb","node7":"12D3KooWHsMaKdPcSwN2pydP7ZX9arQTgAFukCgiFLJ9jgvukkxz","node8":"12D3KooWLNFHoDDHgiTd4QkJ7FNMBC79iY8G1t1Vyr6CNR7ZeCqM","node9":"12D3KooWCS1nVjpAJPFZrz9DkHHEMTpuXzDaFJh8zt4bzBtod6Jb","node10":"12D3KooWLCW72v8mRZAxa1YNRtVkJrVuCSDmy1yt1wnPB1NH894e","node11":"12D3KooWA7Promv3T6AR7BNmaudfjkdtRc3mxkJoqgDCbyhjmoyZ"}
34 changes: 34 additions & 0 deletions examples/raft-troupe/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python

import re
import sys

if len(sys.argv) < 2:
print("Needs file to build")
exit(1)

src = open(sys.argv[1], 'r')
dest = open("build/raft_troupe.trp", 'w')

print("Building:" + sys.argv[1])

for line in src.readlines():
dest.write(line)
match = re.search('(?<=\#IMPORT ).*\.trp', line)
if match is None:
continue

with open(match.group(0), 'r') as f:
print("Importing: " + match.group(0))
exportgroup = re.search(
'(\(\* ?EXPORT START ?\*\)\n)((.|\n)*)(\(\* ?EXPORT END ?\*\))', f.read())
if exportgroup is None:
for li in f.readlines():
dest.write(li)
else:
for li in exportgroup.group(2):
dest.write(li)
dest.write("(* END OF " + match.group(0) + " *)\n")

src.close()
dest.close()
Loading

0 comments on commit 44c944d

Please sign in to comment.