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["--directory"]: fckit.chdir(opts["--directory"]) role = Role() targets = Targets( role = role, exclude = opts["--exclude"].split(","), warning_flags = opts["--warnings"].split(","), repository_url = opts["--repository"]) for key in opts["TARGETS"]: fckit.trace("at %s" % key) targets[key].build() if os.path.exists(targets["check"].path): with open(targets["check"].path, "r") as fp: print fckit.magenta(fp.read()) except fckit.Error as exc: raise SystemExit(fckit.red(exc))
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))
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["--directory"]: fckit.chdir(opts["--directory"]) role = Role() targets = Targets(role=role, exclude=opts["--exclude"].split(","), warning_flags=opts["--warnings"].split(","), repository_url=opts["--repository"]) for key in opts["TARGETS"]: fckit.trace("at %s" % key) targets[key].build() if os.path.exists(targets["check"].path): with open(targets["check"].path, "r") as fp: print fckit.magenta(fp.read()) except fckit.Error as exc: raise SystemExit(fckit.red(exc))
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["-E"]: def warning(*strings): raise Error(": ".join(strings)) globals()["warning"] = warning warning_flags = opts["--warnings"].split(",") if opts["--warnings"] else () role = Role(opts["--directory"]) ################## # show lifecycle # ################## show_phony_tgt = fckit.BuildTarget( path = "show", phony = True, callback = lambda sources: show(role)) ################## # init lifecycle # ################## manifest_file_tgt = fckit.BuildTarget( path = role.meta_path, callback = lambda path, sources: write_manifest(path)) ################### # clean lifecycle # ################### clean_phony_tgt = fckit.BuildTarget( path = "clean", phony = True, callback = lambda sources: clean(role)) ##################### # publish lifecycle # ##################### readme_file_tgt = fckit.BuildTarget( path = role.readme_path, sources = (manifest_file_tgt,), callback = lambda path, sources: write_readme(role)) maintask_file_tgt = fckit.BuildTarget( path = role.maintask_path, sources = (manifest_file_tgt,), callback = lambda path, sources: write_maintask(role)) dist_phony_tgt = fckit.BuildTarget( path = "dist", phony = True, sources = (readme_file_tgt, maintask_file_tgt), callback = lambda sources: None) check_phony_tgt = fckit.BuildTarget( path = "check", phony = True, sources = (dist_phony_tgt,), callback = lambda sources: check( role = role, warning_flags = warning_flags)) package_file_tgt = fckit.BuildTarget( path = role.package_path, callback = lambda path, sources: package(role)) publish_phony_tgt = fckit.BuildTarget( path = "publish", phony = True, sources = (package_file_tgt,), callback = lambda sources: publish(sources[0], opts["--repository"])) switch = { "show": show_phony_tgt, "init": manifest_file_tgt, "dist": dist_phony_tgt, "clean": clean_phony_tgt, "check": check_phony_tgt, "package": package_file_tgt, "publish": publish_phony_tgt, } for target in opts["TARGETS"]: if target in switch: fckit.trace("at", target) switch[target].build() else: raise Error(target, "no such target") except fckit.Error as exc: raise SystemExit(fckit.red(exc))