Esempio n. 1
0
def generate_custom_manifest(project_dir: Path) -> None:
    cli_logger.info(f"{bold_blue('Manifest Wizard')}")
    cli_logger.info("---------------")
    cli_logger.info("Create ethPM manifests for local projects.")

    contracts_dir = project_dir / "contracts"

    validate_solc_output(project_dir)
    solc_output_path = project_dir / SOLC_OUTPUT
    solc_output = json.loads(solc_output_path.read_text())["contracts"]

    builder_fns = (
        gen_package_name(),
        gen_version(),
        gen_manifest_version(),
        gen_description(),
        gen_license(),
        gen_authors(),
        gen_keywords(),
        gen_links(),
        *gen_contract_types_and_sources(solc_output, contracts_dir),
        *gen_deployments(solc_output),
        # todo: *gen_build_dependencies(),
        # todo: ipfs pinning support
        gen_validate_manifest(),
    )
    final_fns = (fn for fn in builder_fns if fn is not None)
    cli_logger.info(
        "Building your manifest. This could take a minute if you're pinning assets to IPFS."
    )
    manifest = b.build({}, *final_fns)
    write_manifest_to_disk(manifest, project_dir)
Esempio n. 2
0
def create_basic_manifest_cmd(args: argparse.Namespace) -> None:
    config = Config(args)
    validate_config_has_project_dir_attr(config)
    validate_solc_output(args.project_dir)
    if not args.package_name:
        raise ValidationError(
            "To automatically generate a basic manifest, you must provide a --package-name."
        )

    if not args.package_version:
        raise ValidationError(
            "To automatically generate a basic manifest, you must provide a --package-version."
        )
    generate_basic_manifest(args.package_name, args.package_version, args.project_dir)
Esempio n. 3
0
def generate_custom_manifest(project_dir: Path) -> None:
    cli_logger.info("Manifest Wizard")
    cli_logger.info("---------------")
    cli_logger.info("Create ethPM manifests for local projects.")
    cli_logger.info("Project directory must include solc output.")
    cli_logger.info("Follow the steps in the docs to generate solc output.")

    contracts_dir = project_dir / "contracts"

    validate_solc_output(project_dir)
    solc_output_path = project_dir / SOLC_OUTPUT
    solc_output = json.loads(solc_output_path.read_text())["contracts"]

    builder_fns = (
        gen_package_name(),
        gen_version(),
        gen_manifest_version(),
        gen_description(),
        gen_license(),
        gen_authors(),
        gen_keywords(),
        gen_links(),
        *gen_contract_types_and_sources(solc_output, contracts_dir),
        *gen_deployments(solc_output),
        # todo: *gen_build_dependencies(),
        # todo: ipfs pinning support
        # todo: workflow for adding a single field to existing manifest
        #   -- aka. extend existing manifest with a single deployment
        gen_validate_manifest(),
        b.write_to_disk(project_dir),
    )
    final_fns = (fn for fn in builder_fns if fn is not None)
    cli_logger.info(
        "Building your manifest. This could take a minute if you're pinning assets to IPFS."
    )
    manifest = b.build({}, *final_fns)
    cli_logger.info(
        f"Manifest successfully created and written to {project_dir}/{manifest['version']}.json."
    )
Esempio n. 4
0
def create_manifest_wizard_cmd(args: argparse.Namespace) -> None:
    config = Config(args)
    validate_config_has_project_dir_attr(config)
    validate_solc_output(args.project_dir)
    generate_custom_manifest(args.project_dir)