Esempio n. 1
0
def compile(source, full_path):
	log.info('compile %s' % full_path)
	if not source:
		source = dir_index_tools.gettest(full_path)
	else:
		source = source.encode("utf-8")

	out, errors = execute(source, full_path)
	if not out:
		raise Exception('CoffeeScript compilation error ...')

	return out
Esempio n. 2
0
def compile(source, path, full_path):

	args = shlex.split("%s -c -b -s -p" % COFFEESCRIPT_EXECUTABLE)
	if not source:
		source = dir_index_tools.gettest(full_path)
	else:
		source = source.encode('utf-8')

	p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
	out, errors = p.communicate(source)

	coffee_name, js_name = coffee2js(full_path)
	full_path = full_path.replace(coffee_name, js_name)
	if os.path.exists(full_path):
		os.remove(full_path)

	if out:
		dir_index_tools.savetest(out.decode("utf-8"), full_path)

	#return errors
	return path.replace(coffee_name, js_name) if path else None
Esempio n. 3
0
def get_url(path):
	fullpath = os.path.join(path, settings.SPEC_URL_FILE_NAME)
	if os.path.exists(fullpath):
		return tools.gettest(fullpath)
Esempio n. 4
0
def uploadContentToRemote(url, fullpath, path, ctx):
	log.debug('upload content %s', fullpath)
	content = tools.gettest(fullpath)
	return sendContentToRemote(path, content, url, ctx)