Example #1
0
def unmarshall(path, default = None):
	"custom unmarshaller with yaml support"
	def _unmarshall_yaml(path):
		with open(path, "r") as fp:
			return yaml.load(fp)
	return fckit.unmarshall(
		path = path,
		default = default,
		helpers = {".yml": _unmarshall_yaml})
Example #2
0
def unmarshall(path, default=None):
    "custom unmarshaller with yaml support"

    def _unmarshall_yaml(path):
        with open(path, "r") as fp:
            return yaml.load(fp)

    return fckit.unmarshall(path=path,
                            default=default,
                            helpers={".yml": _unmarshall_yaml})
Example #3
0
def main(args = None):
	opts = docopt.docopt(
		doc = __doc__,
		argv = args)
	try:
		if opts["--no-color"]:
			fckit.disable_colors()
		if opts["--verbose"]:
			fckit.enable_tracing()
		if opts["setup"]:
			setup(
				toolid = opts["TOOLID"],
				settings = opts["SETTING"],
				manifests = MANIFESTS)
		else:
			bs = BuildStack(
				preferences = fckit.unmarshall("~/buildstack.json"),
				profileid = opts["--profile"],
				manifests = MANIFESTS,
				path = opts["--file"] or opts["--directory"])
			switch = {
				"get": lambda value: bs.get(requirementid = value),
				"clean": lambda _: bs.clean(),
				"compile": lambda _: bs.compile(),
				"run": lambda value: bs.run(entrypointid = value),
				"test": lambda _: bs.test(),
				"release": lambda value: bs.release(
					partid = value,
					message = opts["--message"]),
				"package": lambda value: bs.package(formatid = value),
				"publish": lambda value: bs.publish(repositoryid = value),
				"install": lambda value: bs.install(inventoryid = value),
				"uninstall": lambda value: bs.uninstall(inventoryid = value),
			}
			for target in opts["TARGETS"]:
				key, _, value = target.partition(":")
				if key in switch:
					switch[key](value)
				else:
					raise Error(target, "unknown target, call --help for details")
			bs.flush()
	except fckit.Error as exc:
		raise SystemExit(fckit.red(exc))