def main(argv=None): argv = argv or sys.argv[1:] p = argparse.ArgumentParser() p.add_argument("scenario", help="Path to the YAML scenario file.") ns = p.parse_args(argv) scenario = Scenario.from_yaml(ns.scenario) print_rules(scenario.request, scenario.remote_repositories, scenario.installed_repository)
def main(argv=None): argv = argv or sys.argv[1:] p = argparse.ArgumentParser() p.add_argument("scenario", help="Path to the YAML scenario file.") p.add_argument("--print-ids", action="store_true") ns = p.parse_args(argv) scenario = Scenario.from_yaml(ns.scenario) solve_and_print(scenario.request, scenario.remote_repositories, scenario.installed_repository, ns.print_ids)
def main(argv=None): argv = argv or sys.argv[1:] default_composer_root = os.path.expanduser( os.path.join("~/src/projects/composer-git") ) p = argparse.ArgumentParser() p.add_argument("scenario", help="Path to the YAML scenario file.") p.add_argument("templates", help="PHP templates.", nargs="+") p.add_argument("--composer-root", help="Composer root.", default=default_composer_root) ns = p.parse_args(argv) remote_definition = "remote.json" installed_definition = "installed.json" scenario = Scenario.from_yaml(ns.scenario) template_variables = scenario_to_php_template_variables(scenario, remote_definition, installed_definition) template_variables["composer_bootstrap"] = os.path.join( ns.composer_root, "src", "bootstrap.php" ) for template in ns.templates: suffix = ".in" assert template.endswith(suffix), \ "Templates should end w/ the {0!r} suffix".format(suffix) with open(template, "rt") as fpin: output = template[:-len(suffix)] with open(output, "wt") as fpout: data = jinja2.Template(fpin.read()).render(**template_variables) fpout.write(data)
def main(argv=None): argv = argv or sys.argv[1:] default_composer_root = os.path.expanduser( os.path.join("~/src/projects/composer-git")) p = argparse.ArgumentParser() p.add_argument("scenario", help="Path to the YAML scenario file.") p.add_argument("templates", help="PHP templates.", nargs="+") p.add_argument("--composer-root", help="Composer root.", default=default_composer_root) ns = p.parse_args(argv) remote_definition = "remote.json" installed_definition = "installed.json" scenario = Scenario.from_yaml(ns.scenario) template_variables = scenario_to_php_template_variables( scenario, remote_definition, installed_definition) template_variables["composer_bootstrap"] = os.path.join( ns.composer_root, "src", "bootstrap.php") for template in ns.templates: suffix = ".in" assert template.endswith(suffix), \ "Templates should end w/ the {0!r} suffix".format(suffix) with open(template, "rt") as fpin: output = template[:-len(suffix)] with open(output, "wt") as fpout: data = jinja2.Template( fpin.read()).render(**template_variables) fpout.write(data)