rune-workshop

A web ui to make runes
git clone git://jb55.com/rune-workshop
Log | Files | Refs | README

sync-schemas.xonsh (672B)


      1 #!/usr/bin/env xonsh
      2 
      3 import os
      4 import json
      5 import sys
      6 
      7 # fetch latest
      8 rm -rf lightning-master lightning.tar.gz
      9 curl -sL https://github.com/ElementsProject/lightning/archive/master.tar.gz > lightning.tar.gz
     10 tar xf lightning.tar.gz
     11 
     12 schemas = $(ls -1 lightning-master/doc/schemas/*.request.json).strip().split("\n")
     13 
     14 out = {}
     15 for schema in schemas:
     16 	filename = os.path.basename(schema)
     17 	[method,_,_] = filename.split(".")
     18 	with open(schema) as f:
     19 		content = "".join(f.readlines())
     20 		out[method] = json.loads(content)
     21 
     22 
     23 print("Writing schemas.json", file=sys.stderr)
     24 
     25 with open("schemas.json", "w") as f:
     26 	f.write(json.dumps(out))
     27 
     28 rm -rf lightning-master lightning.tar.gz