@atomist/sample-sdm
Version:
Sample Atomist automation for software delivery
67 lines • 3.59 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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const projectEditorOps_1 = require("@atomist/automation-client/operations/edit/projectEditorOps");
const appendOrCreate_1 = require("@atomist/sdm/util/project/appendOrCreate");
const fileCopy_1 = require("@atomist/sdm/util/project/fileCopy");
const addDependencyEditor_1 = require("@atomist/spring-automation/commands/editor/maven/addDependencyEditor");
const automation_client_1 = require("@atomist/automation-client");
const decorators_1 = require("@atomist/automation-client/decorators");
const editModes_1 = require("@atomist/automation-client/operations/edit/editModes");
const SentryDependency = {
group: "io.sentry",
artifact: "sentry-spring",
version: "1.7.5",
};
const sentryYaml = dsn => `\nraven:
dsn: '${dsn}'`;
function addSentryEditor(dsn) {
return projectEditorOps_1.chainEditors(addDependencyEditor_1.addDependencyEditor(SentryDependency),
// tslint:disable-next-line:max-line-length
fileCopy_1.copyFileFromUrl("https://raw.githubusercontent.com/sdm-org/cd20/dc16c15584d77db6cf9a70fdcb4d7bebe24113d5/src/main/java/com/atomist/SentryConfiguration.java", "src/main/java/com/atomist/SentryConfiguration.java"), appendOrCreate_1.appendOrCreateFileContent({ toAppend: sentryYaml(dsn), path: "src/main/resources/application.yml" }), appendOrCreate_1.appendOrCreateFileContent({ toAppend: sentryYaml(dsn), path: "src/test/resources/application.yml" }));
}
let AddSentryParams = class AddSentryParams {
};
__decorate([
automation_client_1.Parameter(),
__metadata("design:type", String)
], AddSentryParams.prototype, "dsn", void 0);
AddSentryParams = __decorate([
decorators_1.Parameters()
], AddSentryParams);
exports.AddSentryParams = AddSentryParams;
/**
* Command to add Sentry support to the current project
* @type {HandleCommand<EditOneOrAllParameters>}
*/
exports.AddSentry = {
createEditor: params => addSentryEditor(params.dsn),
name: "AddSentry",
paramsMaker: AddSentryParams,
editMode: () => new editModes_1.PullRequest(`add-sentry-${new Date().getTime()}`, "Add Sentry support", "Adds Sentry (Raven) APM support"),
intent: "add sentry",
};
//# sourceMappingURL=addSentryEditor.js.map