-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathgenerate.coffee
34 lines (24 loc) · 973 Bytes
/
generate.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env coffee
fs = require 'fs'
wintersmith = require 'wintersmith'
request = require 'request'
url = "http://localhost:25565/api/2/call?json=%5B%7B%22name%22%3A%22jsonapi.methods%22%2C%22key%22%3A%22059d32c621cee00c7990857d17cbd5f9730c77735dbf905654f90124d2cbaa9f%22%2C%22username%22%3A%22admin%22%2C%22arguments%22%3A%5B%5D%2C%22tag%22%3A%221%22%7D%5D"
cmd = process.argv.pop()
if ['build', 'preview', 'build_locals'].indexOf(cmd) is -1
cmd = 'build'
env = null
if cmd isnt "build_locals"
env = wintersmith __dirname + '/config.json'
# perform basic setup (pull in new readme, etc)
if cmd is "build"
env.build (err) ->
throw err if err
console.log 'Done!'
else if cmd is "preview"
env.preview (err, server) ->
throw err if err
console.log 'Server Running!'
else if cmd is "build_locals"
console.log "build_locals"
request url, (err, response, body) ->
fs.writeFileSync 'locals.json', JSON.stringify(methods: JSON.parse(body)[0].success)