Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

First steps of JSON to YAML #182

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
FROM gists/lighttpd:latest
FROM alpine:latest AS json
RUN apk --no-cache add python3
RUN mkdir -p build/node-data
RUN cat src/node-data/links.yaml | python3 scripts/yaml2json.py > build/node-data/links.json
RUN cat src/node-data/nodes.yaml | python3 scripts/yaml2json.py > build/node-data/nodes.json

COPY build /var/www

FROM gists/lighttpd:latest
COPY build /var/www
7 changes: 7 additions & 0 deletions scripts/yaml2json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python

import simplejson
import sys
import yaml

print yaml.dump(simplejson.loads(str(sys.stdin.read())), default_flow_style=False)
43 changes: 43 additions & 0 deletions src/node-data/links.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
- from: HackPGH
to: 97 South 23rd Street
type: wifi
- from: Caliguiri Building
to: Winton St. and Craighead St
type: wifi
- from: HackPGH
to: Polska Szkola
type: wifi
- from: Paramount Film Exchange
to: Polska Szkola
type: wifi
- from: ABC Storage Redirect
to: 97 South 23rd Street
type: wifi
- from: Paramount Film Exchange
to: Penguino Labs
type: wifi
- from: HackPGH
to: Finello Pavilion
type: wifi
- from: HackPGH
to: Morse Gardens
type: wifi
- from: Morse Gardens
to: Finello Pavilion
type: wifi
- from: HackPGH
to: McClain Street Redirect
type: wifi
- from: 1733 Arlington Ave, South Side Slopes
to: 125 Locust Street, Mt Oliver, PA 15210
type: wifi
- from: Caliguiri Building
to: 1415 Milan Ave
type: wifi
- from: Crookline Data Center
to: 1415 Milan Ave
type: wifi
- from: Subfortress
to: 125 Locust Street, Mt Oliver, PA 15210
type: wifi