@atomist/sample-sdm
Version:
Sample Atomist automation for software delivery
69 lines • 3.83 kB
JavaScript
;
/*
* Copyright © 2018 Atomist, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const automation_client_1 = require("@atomist/automation-client");
const sdm_pack_sonarqube_1 = require("@atomist/sdm-pack-sonarqube");
const slackReviewListener_1 = require("@atomist/sdm/code/review/slackReviewListener");
const graphGoalsToSlack_1 = require("@atomist/sdm/goal/graph/graphGoalsToSlack");
const dryRunEditorSupport_1 = require("@atomist/sdm/pack/dry-run/dryRunEditorSupport");
const sloc_1 = require("@atomist/sdm/pack/sloc/sloc");
const addHeader_1 = require("../commands/editors/license/addHeader");
const postToDeploymentsChannel_1 = require("../listener/deployment/postToDeploymentsChannel");
const capitalizer_1 = require("../listener/issue/capitalizer");
const requestDescription_1 = require("../listener/issue/requestDescription");
const thankYouYouRock_1 = require("../listener/issue/thankYouYouRock");
const publishNewRepo_1 = require("../listener/repo/publishNewRepo");
const codeMetrics_1 = require("../pack/codemetrics/codeMetrics");
/**
* Set up team policies independent of specific stacks
* @param {SoftwareDeliveryMachine} sdm
*/
function addTeamPolicies(sdm) {
sdm
.addNewIssueListeners(requestDescription_1.requestDescription, capitalizer_1.capitalizer)
.addClosedIssueListeners(thankYouYouRock_1.thankYouYouRock)
.addGoalsSetListeners(graphGoalsToSlack_1.GraphGoalsToSlack)
.addReviewListeners(slackReviewListener_1.slackReviewListener())
.addEditors(addHeader_1.AddApacheLicenseHeaderEditor)
.addNewRepoWithCodeActions(publishNewRepo_1.PublishNewRepo)
.addDeploymentListeners(postToDeploymentsChannel_1.PostToDeploymentsChannel)
.addUserJoiningChannelListeners(je => je.addressChannels(`Welcome, ${je.joinEvent.user.screenName}`));
// .addFingerprintDifferenceListeners(diff1)
sdm.addExtensionPacks(dryRunEditorSupport_1.DryRunEditing, sloc_1.Sloc);
if (sdm.configuration.sdm.sonar && sdm.configuration.sdm.sonar.enabled) {
automation_client_1.logger.info("Enabling SonarQube integration");
sdm.addExtensionPacks(sdm_pack_sonarqube_1.SonarQubeSupport);
}
else {
automation_client_1.logger.info("SonarQube integration not enabled");
}
const pub = (fp) => __awaiter(this, void 0, void 0, function* () {
// ("METRICS ARE\n" + JSON.stringify(fp.fingerprint));
});
sdm.addExtensionPacks(codeMetrics_1.codeMetrics(pub));
// sdm.addPushReactions(shutDownDeliveryIf(EverySecondOneGoesThrough));
}
exports.addTeamPolicies = addTeamPolicies;
//# sourceMappingURL=teamPolicies.js.map