How to use the @atomist/sdm.metadata function in @atomist/sdm

To help you get started, we’ve selected a few @atomist/sdm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atomist / sdm-pack-aspect / lib / machine / aspectSupport.ts View on Github external
}, ...toArray(options.taggers) || []);
    const aspects = [...toArray(options.aspects || []), ...scoringAspects, tagAspect]
        .map(aspect => makeVirtualProjectAware(aspect, options.virtualProjectFinder));

    // Default the two display methods with some sensible defaults
    aspects.forEach(a => {
        if (!a.toDisplayableFingerprint) {
            a.toDisplayableFingerprint = fp => JSON.stringify(fp.data);
        }
        if (!a.toDisplayableFingerprintName) {
            a.toDisplayableFingerprintName = fn => fn;
        }
    });

    return {
        ...metadata(),
        configure: sdm => {
            const cfg = sdm.configuration;
            const analysisTracking = new AnalysisTracker();

            if (isInLocalMode()) {
                // If we're in local mode, expose analyzer commands and
                // HTTP endpoints
                const analyzer = createAnalyzer(
                    aspects,
                    options.virtualProjectFinder || exports.DefaultVirtualProjectFinder);

                sdm.addCommand(analyzeGitHubByQueryCommandRegistration(analyzer, analysisTracking));
                sdm.addCommand(analyzeGitHubOrganizationCommandRegistration(analyzer, analysisTracking));
                sdm.addCommand(analyzeLocalCommandRegistration(analyzer, analysisTracking));
            } else {
                // Add command to calculate fingerprints as part of the initial onboarding
github atomist / sdm-core / lib / pack / info / exposeInfo.ts View on Github external
export function infoSupport(): ExtensionPack {
    return {
        ...metadata("info"),
        configure: sdm => {
            sdm.addCommand(selfDescribeCommand(sdm));
        },
    };
}
github atomist / sdm-core / lib / pack / universal-generator / generatorSupport.ts View on Github external
export function universalGeneratorSupport(options: UniversalGeneratorSupportOptions): ExtensionPack {
    return {
        ...metadata(),
        configure: sdm => {
            toArray(options.generators)
                .map(g => universalGenerator(sdm, g, toArray(options.transformsAndParameters || [])))
                .forEach(g => sdm.addGeneratorCommand(g));
        },
    };
}
github atomist / sdm-core / lib / pack / notification / notification.ts View on Github external
export function notificationSupport(options: NotificationOptions = {}): ExtensionPack {
    return {
        ...metadata("notification"),
        configure: sdm => {

            const updateGoalCommand = updateGoalStateCommand();
            updateGoalCommand.name = `${updateGoalCommand.name}ForNotifications`;
            sdm.addCommand(updateGoalCommand);

            const optsToUse: NotificationOptions = {
                destination: defaultDestinationFactory,
                notification: defaultNotificationFactory(updateGoalCommand),
                ...options,
            };

            sdm.addGoalCompletionListener(notifyGoalCompletionListener(optsToUse));
        },
    };
}
github atomist / sdm-core / lib / pack / goal-state / goalState.ts View on Github external
export function goalStateSupport(options?: GoalStateOptions): ExtensionPack {
    return {
        ...metadata("goal-state"),
        configure: sdm => {
            if (isInLocalMode()) {
                logger.warn("Setting goal state is not available in local mode.");
                logger.warn("Resetting goals does not work in local mode. Use `atomist trigger post-commit` instead.");
            } else {
                sdm.addCommand(setGoalStateCommand(sdm));
                sdm.addCommand(resetGoalsCommand(sdm));
                sdm.addCommand(cancelGoalSetsCommand(sdm));
                sdm.addCommand(listPendingGoalSetsCommand(sdm));

                if ((cluster.isMaster || !_.get(sdm.configuration, "cluster.enabled")) &&
                    !process.env.ATOMIST_ISOLATED_GOAL &&
                    !!options && !!options.cancellation && !!options.cancellation.enabled) {
                    logger.debug(`Timeout based goal cancellation enabled for this SDM`);
                    sdm.addTriggeredListener({
                        trigger: { interval: 1000 * 30 },
github atomist / sdm-core / lib / pack / freeze / deploymentFreeze.ts View on Github external
export function deploymentFreeze(dsm: DeploymentStatusManager): ExtensionPack {
    return {
        ...metadata("deployment-freeze"),
        configure: sdm => {
            sdm.addCommand(
                freezeCommand(dsm))
                .addCommand(unfreezeCommand(dsm));
            sdm.addGoalImplementation("ExplainDeploymentFreezeGoal",
                ExplainDeploymentFreezeGoal,
                executeSendMessageToSlack("*Attention*: Not deploying as deployment is currently frozen :no_entry:"));
        },
    };
}
github atomist / sdm-pack-spring / lib / spring.ts View on Github external
export function springSupport(options: SpringSupportOptions): ExtensionPack {
    return {
        ...metadata(),
        configure: sdm => {
            sdm
                .addCodeTransformCommand(AddMavenDependency)
                .addCodeTransformCommand(AddSpringBootStarter)
                .addCodeTransformCommand(addSpringBootActuator())
                .addCodeTransformCommand(ApplySecuredWebAppGuide)
                .addCodeTransformCommand(tryToUpgradeSpringBootVersion(options))
                .addFirstPushListener(
                    tagRepo(unifiedTagger(
                        springBootTagger,
                        gradleTagger,
                        mavenTagger,
                        ),
                    ),
                );
            if (!!options.inspectGoal) {
github atomist / sdm-pack-aspect / lib / machine / aspectSupport.ts View on Github external
if (options.secureWeb === undefined) {
        options.secureWeb = !isInLocalMode();
    }

    const aboutTheApi = api(resultStore, aspectRegistry, options.secureWeb);

    if (!isInLocalMode() && !options.exposeWeb) {
        return {
            routesToSuggestOnStartup: aboutTheApi.routesToSuggestOnStartup,
            customizers: [aboutTheApi.customizer],
        };
    }

    const aboutStaticPages = addWebAppRoutes(aspectRegistry, resultStore, analysisTracking, configuration.http.client.factory,
        options.instanceMetadata || metadata());

    return {
        routesToSuggestOnStartup:
            [...aboutStaticPages.routesToSuggestOnStartup,
            ...aboutTheApi.routesToSuggestOnStartup],
        customizers: [aboutStaticPages.customizer, aboutTheApi.customizer],
    };
}