@atomist/sdm-pack-spring
Version:
Atomist software delivery machine extension pack for Spring and Spring Boot applications
45 lines • 1.85 kB
JavaScript
;
/*
* Copyright © 2019 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const sdm_1 = require("@atomist/sdm");
const _ = require("lodash");
const pushTests_1 = require("../../../java/pushtest/pushTests");
/**
* Autofix to invoke the Spring team's spring-format via the
* Atomist executable JAR wrapper (https://github.com/atomist/spring-format).
* The JAR wrapper must be available at the path under
* sdm.spring.formatJar or the FORMAT_JAR environment variable on the system on which the
* current SDM is running.
*/
function springFormat(configuration) {
const formatJarPath = _.get(configuration, "sdm.spring.formatJar") || process.env.FORMAT_JAR;
if (!formatJarPath) {
throw new Error("'sdm.spring.formatJar' configuration property or FORMAT_JAR environment variable must be set to use spring-format");
}
return {
name: "Spring format",
pushTest: pushTests_1.IsJava,
transform: sdm_1.spawnCodeTransform([{
// Format will run on current directory, which will be project root
command: "java",
args: ["-jar", formatJarPath],
},
]),
};
}
exports.springFormat = springFormat;
//# sourceMappingURL=springFormat.js.map