def api(self, name, info, host='localhost:8000', udp=False): if udp: print(['API (UDP)', name, info]) self.udp_socket.sendto(json.dumps(info), (udp_host, udp_port)) else: print(['API' if udp else '', name, info]) url = 'http://%s/api/v0/%s.json' % (host, name) j = simpleGet(url, GET={'json': json.dumps(info)}, verbose=True) return json.loads(j)
def main(): for (type, filename) in (('js', 'dotmuncher.js'), ('css', 'dotmuncher.css')): destDir = '%s/static/%s' % (REPO, type) check_call(['mkdir', '-p', destDir]) sys.stdout.write('%s... ' % filename) data = simpleGet('http://localhost:8000/static/%s/%s' % (type, filename)) if type == 'js': #data = pj.api.closureCompile(data, 'simple') data = pj.api.closureCompile(data, 'pretty') #sys.path.append('TODO/gordian-minifier') #import gordian_minifier #data = gordian_minifier.minify(data) destPath = '%s/%s' % (destDir, filename) with open(destPath, 'wb') as f: f.write(data) sys.stdout.write('done.\n')
def main(): for (type, filename) in ( ('js', 'dotmuncher.js'), ('css', 'dotmuncher.css')): destDir = '%s/static/%s' % (REPO, type) check_call(['mkdir', '-p', destDir]) sys.stdout.write('%s... ' % filename) data = simpleGet('http://localhost:8000/static/%s/%s' % (type, filename)) if type == 'js': #data = pj.api.closureCompile(data, 'simple') data = pj.api.closureCompile(data, 'pretty') #sys.path.append('TODO/gordian-minifier') #import gordian_minifier #data = gordian_minifier.minify(data) destPath = '%s/%s' % (destDir, filename) with open(destPath, 'wb') as f: f.write(data) sys.stdout.write('done.\n')