Browse Source

Test

marches
Josh Gordon 4 years ago
parent
commit
c90a0bca03
  1. 2
      Worlds/WM_COSI/log.json
  2. 1
      Worlds/WM_COSI/logs.json
  3. 4
      Worlds/WM_COSI/logs/3.txt
  4. 37
      app/updateLogJSON.py

2
Worlds/WM_COSI/log.json

@ -1 +1 @@
{"Writing Bash": "2.txt", "Raiding Cosi": "1.txt"}
{"This tests a git hook": "3.txt", "Raiding Cosi": "1.txt", "Writing Bash": "2.txt"}

1
Worlds/WM_COSI/logs.json

@ -1 +0,0 @@
{}

4
Worlds/WM_COSI/logs/3.txt

@ -0,0 +1,4 @@
Name: This tests a git hook
Blah
Blah
data

37
app/updateLogJSON.py

@ -1,10 +1,41 @@
import os
import json
import sys
import json
fpath = sys.argv[1]
logfile = '/'.join(fpath.split("/")[:-1])[:-1]+".json"
print(logfile)
fname = fpath.split("/")[-1]
print(fname)
#print(fname)
with open(fpath) as f:
lines = f.read().split("\n")
name = lines[0][6:]
#print(name)
logLines = []
lf = open("./"+logfile,'r')
log = json.load(lf)
log[name] = fname
#print(log)
lf.close()
lf = open("./"+logfile,'w')
json.dump(log,lf)
lf.close()
"""
with open(logfile,'rw') as log:
numl=0
for l in log.read().split("\n"):
logLines.append(l)
numl+=1
logLines.insert(numl-1,"\"{}\" : \"{}\"".format(name,fname))
log.seek(0)
log.truncate()
for l in logLines:
print(l)
log.write(l+"\n")
"""
Loading…
Cancel
Save