@contrast/contrast 2.0.2-beta.3 → 2.0.2-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -1
- package/dist/audit/catalogueApplication/catalogueApplication.js +6 -10
- package/dist/audit/catalogueApplication/catalogueApplication.js.map +1 -0
- package/dist/audit/languageAnalysisEngine/commonApi.js +3 -6
- package/dist/audit/languageAnalysisEngine/commonApi.js.map +1 -0
- package/dist/audit/languageAnalysisEngine/filterProjectPath.js +1 -0
- package/dist/audit/languageAnalysisEngine/filterProjectPath.js.map +1 -0
- package/dist/audit/languageAnalysisEngine/getProjectRootFilenames.js +9 -12
- package/dist/audit/languageAnalysisEngine/getProjectRootFilenames.js.map +1 -0
- package/dist/audit/languageAnalysisEngine/sendSnapshot.js +15 -19
- package/dist/audit/languageAnalysisEngine/sendSnapshot.js.map +1 -0
- package/dist/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js +9 -9
- package/dist/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js.map +1 -0
- package/dist/audit/report/commonReportingFunctions.js +33 -48
- package/dist/audit/report/commonReportingFunctions.js.map +1 -0
- package/dist/audit/report/models/reportGuidanceModel.js +2 -5
- package/dist/audit/report/models/reportGuidanceModel.js.map +1 -0
- package/dist/audit/report/models/reportLibraryModel.js +3 -7
- package/dist/audit/report/models/reportLibraryModel.js.map +1 -0
- package/dist/audit/report/models/reportListModel.js +4 -9
- package/dist/audit/report/models/reportListModel.js.map +1 -0
- package/dist/audit/report/models/reportOutputModel.js +4 -9
- package/dist/audit/report/models/reportOutputModel.js.map +1 -0
- package/dist/audit/report/models/reportSeverityModel.js +2 -5
- package/dist/audit/report/models/reportSeverityModel.js.map +1 -0
- package/dist/audit/report/models/severityCountModel.js +3 -5
- package/dist/audit/report/models/severityCountModel.js.map +1 -0
- package/dist/audit/report/reportingFeature.js +27 -55
- package/dist/audit/report/reportingFeature.js.map +1 -0
- package/dist/audit/report/utils/reportUtils.js +28 -59
- package/dist/audit/report/utils/reportUtils.js.map +1 -0
- package/dist/audit/save.js +14 -16
- package/dist/audit/save.js.map +1 -0
- package/dist/cliConstants.js +17 -18
- package/dist/cliConstants.js.map +1 -0
- package/dist/commands/audit/auditConfig.js +7 -10
- package/dist/commands/audit/auditConfig.js.map +1 -0
- package/dist/commands/audit/auditController.js +9 -13
- package/dist/commands/audit/auditController.js.map +1 -0
- package/dist/commands/audit/help.js +23 -25
- package/dist/commands/audit/help.js.map +1 -0
- package/dist/commands/audit/processAudit.js +9 -12
- package/dist/commands/audit/processAudit.js.map +1 -0
- package/dist/commands/audit/saveFile.js +3 -6
- package/dist/commands/audit/saveFile.js.map +1 -0
- package/dist/commands/auth/auth.js +25 -24
- package/dist/commands/auth/auth.js.map +1 -0
- package/dist/commands/config/config.js +12 -13
- package/dist/commands/config/config.js.map +1 -0
- package/dist/commands/github/fingerprintConfig.js +8 -11
- package/dist/commands/github/fingerprintConfig.js.map +1 -0
- package/dist/commands/github/processFingerprint.js +12 -15
- package/dist/commands/github/processFingerprint.js.map +1 -0
- package/dist/commands/github/projectGroup.js +25 -32
- package/dist/commands/github/projectGroup.js.map +1 -0
- package/dist/commands/github/repoServices.js +11 -21
- package/dist/commands/github/repoServices.js.map +1 -0
- package/dist/commands/learn/learn.js +3 -6
- package/dist/commands/learn/learn.js.map +1 -0
- package/dist/commands/learn/processLearn.js +3 -6
- package/dist/commands/learn/processLearn.js.map +1 -0
- package/dist/commands/scan/processScan.js +11 -14
- package/dist/commands/scan/processScan.js.map +1 -0
- package/dist/common/HTTPClient.js +123 -94
- package/dist/common/HTTPClient.js.map +1 -0
- package/dist/common/autoDetection.js +26 -33
- package/dist/common/autoDetection.js.map +1 -0
- package/dist/common/baseRequest.js +14 -18
- package/dist/common/baseRequest.js.map +1 -0
- package/dist/common/commonHelp.js +13 -13
- package/dist/common/commonHelp.js.map +1 -0
- package/dist/common/errorHandling.js +30 -39
- package/dist/common/errorHandling.js.map +1 -0
- package/dist/common/fail.js +6 -12
- package/dist/common/fail.js.map +1 -0
- package/dist/common/versionChecker.js +16 -19
- package/dist/common/versionChecker.js.map +1 -0
- package/dist/constants/constants.js +44 -65
- package/dist/constants/constants.js.map +1 -0
- package/dist/constants/lambda.js +8 -5
- package/dist/constants/lambda.js.map +1 -0
- package/dist/constants/locales.js +6 -9
- package/dist/constants/locales.js.map +1 -0
- package/dist/index.js +36 -39
- package/dist/index.js.map +1 -0
- package/dist/lambda/analytics.js +6 -9
- package/dist/lambda/analytics.js.map +1 -0
- package/dist/lambda/arn.js +6 -9
- package/dist/lambda/arn.js.map +1 -0
- package/dist/lambda/aws.js +29 -34
- package/dist/lambda/aws.js.map +1 -0
- package/dist/lambda/cliError.js +13 -41
- package/dist/lambda/cliError.js.map +1 -0
- package/dist/lambda/constants.js +3 -4
- package/dist/lambda/constants.js.map +1 -0
- package/dist/lambda/help.js +39 -44
- package/dist/lambda/help.js.map +1 -0
- package/dist/lambda/lambda.js +61 -65
- package/dist/lambda/lambda.js.map +1 -0
- package/dist/lambda/lambdaUtils.js +38 -32
- package/dist/lambda/lambdaUtils.js.map +1 -0
- package/dist/lambda/logUtils.js +21 -17
- package/dist/lambda/logUtils.js.map +1 -0
- package/dist/lambda/scanDetailCompletion.js +19 -25
- package/dist/lambda/scanDetailCompletion.js.map +1 -0
- package/dist/lambda/scanRequest.js +34 -41
- package/dist/lambda/scanRequest.js.map +1 -0
- package/dist/lambda/scanResults.js +8 -10
- package/dist/lambda/scanResults.js.map +1 -0
- package/dist/lambda/types.js +5 -7
- package/dist/lambda/types.js.map +1 -0
- package/dist/lambda/utils.js +33 -35
- package/dist/lambda/utils.js.map +1 -0
- package/dist/sbom/generateSbom.js +6 -10
- package/dist/sbom/generateSbom.js.map +1 -0
- package/dist/scaAnalysis/common/auditReport.js +8 -12
- package/dist/scaAnalysis/common/auditReport.js.map +1 -0
- package/dist/scaAnalysis/common/commonReportingFunctionsSca.js +26 -32
- package/dist/scaAnalysis/common/commonReportingFunctionsSca.js.map +1 -0
- package/dist/scaAnalysis/common/formatMessage.js +8 -17
- package/dist/scaAnalysis/common/formatMessage.js.map +1 -0
- package/dist/scaAnalysis/common/models/ScaReportModel.js +4 -9
- package/dist/scaAnalysis/common/models/ScaReportModel.js.map +1 -0
- package/dist/scaAnalysis/common/scaParserForGoAndJava.js +10 -9
- package/dist/scaAnalysis/common/scaParserForGoAndJava.js.map +1 -0
- package/dist/scaAnalysis/common/scaServicesUpload.js +21 -22
- package/dist/scaAnalysis/common/scaServicesUpload.js.map +1 -0
- package/dist/scaAnalysis/common/treeUpload.js +7 -10
- package/dist/scaAnalysis/common/treeUpload.js.map +1 -0
- package/dist/scaAnalysis/common/utils/reportUtilsSca.js +21 -29
- package/dist/scaAnalysis/common/utils/reportUtilsSca.js.map +1 -0
- package/dist/scaAnalysis/dotnet/analysis.js +12 -18
- package/dist/scaAnalysis/dotnet/analysis.js.map +1 -0
- package/dist/scaAnalysis/dotnet/index.js +4 -7
- package/dist/scaAnalysis/dotnet/index.js.map +1 -0
- package/dist/scaAnalysis/go/goAnalysis.js +8 -11
- package/dist/scaAnalysis/go/goAnalysis.js.map +1 -0
- package/dist/scaAnalysis/go/goParseDeps.js +9 -7
- package/dist/scaAnalysis/go/goParseDeps.js.map +1 -0
- package/dist/scaAnalysis/go/goReadDepFile.js +10 -8
- package/dist/scaAnalysis/go/goReadDepFile.js.map +1 -0
- package/dist/scaAnalysis/java/analysis.js +23 -20
- package/dist/scaAnalysis/java/analysis.js.map +1 -0
- package/dist/scaAnalysis/java/index.js +7 -10
- package/dist/scaAnalysis/java/index.js.map +1 -0
- package/dist/scaAnalysis/java/javaBuildDepsParser.js +43 -43
- package/dist/scaAnalysis/java/javaBuildDepsParser.js.map +1 -0
- package/dist/scaAnalysis/javascript/analysis.js +16 -20
- package/dist/scaAnalysis/javascript/analysis.js.map +1 -0
- package/dist/scaAnalysis/javascript/index.js +17 -19
- package/dist/scaAnalysis/javascript/index.js.map +1 -0
- package/dist/scaAnalysis/javascript/scaServiceParser.js +8 -15
- package/dist/scaAnalysis/javascript/scaServiceParser.js.map +1 -0
- package/dist/scaAnalysis/legacy/legacyFlow.js +13 -15
- package/dist/scaAnalysis/legacy/legacyFlow.js.map +1 -0
- package/dist/scaAnalysis/php/analysis.js +15 -16
- package/dist/scaAnalysis/php/analysis.js.map +1 -0
- package/dist/scaAnalysis/php/index.js +5 -8
- package/dist/scaAnalysis/php/index.js.map +1 -0
- package/dist/scaAnalysis/php/phpNewServicesMapper.js +9 -12
- package/dist/scaAnalysis/php/phpNewServicesMapper.js.map +1 -0
- package/dist/scaAnalysis/processServicesFlow.js +50 -25
- package/dist/scaAnalysis/processServicesFlow.js.map +1 -0
- package/dist/scaAnalysis/python/analysis.js +16 -23
- package/dist/scaAnalysis/python/analysis.js.map +1 -0
- package/dist/scaAnalysis/python/index.js +4 -7
- package/dist/scaAnalysis/python/index.js.map +1 -0
- package/dist/scaAnalysis/repoMode/gradleParser.js +7 -13
- package/dist/scaAnalysis/repoMode/gradleParser.js.map +1 -0
- package/dist/scaAnalysis/repoMode/index.js +9 -12
- package/dist/scaAnalysis/repoMode/index.js.map +1 -0
- package/dist/scaAnalysis/repoMode/mavenParser.js +12 -12
- package/dist/scaAnalysis/repoMode/mavenParser.js.map +1 -0
- package/dist/scaAnalysis/ruby/analysis.js +32 -46
- package/dist/scaAnalysis/ruby/analysis.js.map +1 -0
- package/dist/scaAnalysis/ruby/index.js +5 -8
- package/dist/scaAnalysis/ruby/index.js.map +1 -0
- package/dist/scaAnalysis/scaAnalysis.js +49 -51
- package/dist/scaAnalysis/scaAnalysis.js.map +1 -0
- package/dist/scan/fileUtils.js +27 -36
- package/dist/scan/fileUtils.js.map +1 -0
- package/dist/scan/formatScanOutput.js +47 -61
- package/dist/scan/formatScanOutput.js.map +1 -0
- package/dist/scan/help.js +8 -11
- package/dist/scan/help.js.map +1 -0
- package/dist/scan/models/groupedResultsModel.js +2 -5
- package/dist/scan/models/groupedResultsModel.js.map +1 -0
- package/dist/scan/models/resultContentModel.js +2 -2
- package/dist/scan/models/resultContentModel.js.map +1 -0
- package/dist/scan/models/scanResultsModel.js +2 -5
- package/dist/scan/models/scanResultsModel.js.map +1 -0
- package/dist/scan/populateProjectIdAndProjectName.js +9 -12
- package/dist/scan/populateProjectIdAndProjectName.js.map +1 -0
- package/dist/scan/saveResults.js +3 -6
- package/dist/scan/saveResults.js.map +1 -0
- package/dist/scan/scan.js +24 -31
- package/dist/scan/scan.js.map +1 -0
- package/dist/scan/scanConfig.js +14 -12
- package/dist/scan/scanConfig.js.map +1 -0
- package/dist/scan/scanController.js +17 -20
- package/dist/scan/scanController.js.map +1 -0
- package/dist/scan/scanResults.js +27 -34
- package/dist/scan/scanResults.js.map +1 -0
- package/dist/telemetry/telemetry.js +29 -59
- package/dist/telemetry/telemetry.js.map +1 -0
- package/dist/utils/capabilities.js +1 -0
- package/dist/utils/capabilities.js.map +1 -0
- package/dist/utils/commonApi.js +15 -24
- package/dist/utils/commonApi.js.map +1 -0
- package/dist/utils/filterProjectPath.js +1 -0
- package/dist/utils/filterProjectPath.js.map +1 -0
- package/dist/utils/generalAPI.js +11 -17
- package/dist/utils/generalAPI.js.map +1 -0
- package/dist/utils/getConfig.js +7 -13
- package/dist/utils/getConfig.js.map +1 -0
- package/dist/utils/oraWrapper.js +7 -14
- package/dist/utils/oraWrapper.js.map +1 -0
- package/dist/utils/paramsUtil/commandlineParams.js +2 -5
- package/dist/utils/paramsUtil/commandlineParams.js.map +1 -0
- package/dist/utils/paramsUtil/configStoreParams.js +9 -10
- package/dist/utils/paramsUtil/configStoreParams.js.map +1 -0
- package/dist/utils/paramsUtil/envVariableParams.js +2 -3
- package/dist/utils/paramsUtil/envVariableParams.js.map +1 -0
- package/dist/utils/paramsUtil/paramHandler.js +12 -13
- package/dist/utils/paramsUtil/paramHandler.js.map +1 -0
- package/dist/utils/parsedCLIOptions.js +4 -7
- package/dist/utils/parsedCLIOptions.js.map +1 -0
- package/dist/utils/requestUtils.js +7 -13
- package/dist/utils/requestUtils.js.map +1 -0
- package/dist/utils/saveFile.js +8 -11
- package/dist/utils/saveFile.js.map +1 -0
- package/dist/utils/validationCheck.js +5 -11
- package/dist/utils/validationCheck.js.map +1 -0
- package/package.json +32 -41
- package/.prettierignore +0 -1
- package/bin/contrast.js +0 -2
- package/dist/audit/languageAnalysisEngine/util/requestUtils.js +0 -14
- package/dist/lambda/__mocks__/aws.js +0 -21
- package/dist/lambda/__mocks__/lambdaConfig.json +0 -42
- package/src/audit/catalogueApplication/catalogueApplication.js +0 -51
- package/src/audit/languageAnalysisEngine/commonApi.js +0 -20
- package/src/audit/languageAnalysisEngine/filterProjectPath.js +0 -21
- package/src/audit/languageAnalysisEngine/getProjectRootFilenames.js +0 -36
- package/src/audit/languageAnalysisEngine/sendSnapshot.js +0 -57
- package/src/audit/languageAnalysisEngine/util/requestUtils.js +0 -17
- package/src/audit/nodeAnalysisEngine/parseYarn2LockFileContents.js +0 -63
- package/src/audit/report/commonReportingFunctions.js +0 -412
- package/src/audit/report/models/reportGuidanceModel.ts +0 -5
- package/src/audit/report/models/reportLibraryModel.ts +0 -30
- package/src/audit/report/models/reportListModel.ts +0 -49
- package/src/audit/report/models/reportOutputModel.ts +0 -29
- package/src/audit/report/models/reportSeverityModel.ts +0 -18
- package/src/audit/report/models/severityCountModel.ts +0 -22
- package/src/audit/report/reportingFeature.ts +0 -110
- package/src/audit/report/utils/reportUtils.ts +0 -165
- package/src/audit/save.js +0 -67
- package/src/cliConstants.js +0 -523
- package/src/commands/audit/auditConfig.js +0 -18
- package/src/commands/audit/auditController.js +0 -50
- package/src/commands/audit/help.js +0 -72
- package/src/commands/audit/processAudit.js +0 -34
- package/src/commands/audit/saveFile.js +0 -15
- package/src/commands/auth/auth.js +0 -146
- package/src/commands/config/config.js +0 -41
- package/src/commands/github/fingerprintConfig.js +0 -19
- package/src/commands/github/processFingerprint.js +0 -37
- package/src/commands/github/projectGroup.js +0 -298
- package/src/commands/github/repoServices.js +0 -122
- package/src/commands/learn/learn.js +0 -10
- package/src/commands/learn/processLearn.js +0 -13
- package/src/commands/scan/processScan.js +0 -42
- package/src/common/HTTPClient.js +0 -775
- package/src/common/autoDetection.js +0 -209
- package/src/common/baseRequest.ts +0 -83
- package/src/common/commonHelp.js +0 -53
- package/src/common/errorHandling.js +0 -157
- package/src/common/fail.js +0 -79
- package/src/common/versionChecker.js +0 -75
- package/src/constants/constants.js +0 -71
- package/src/constants/lambda.js +0 -85
- package/src/constants/locales.js +0 -365
- package/src/index.ts +0 -142
- package/src/lambda/__mocks__/aws.ts +0 -32
- package/src/lambda/__mocks__/lambdaConfig.json +0 -42
- package/src/lambda/analytics.ts +0 -9
- package/src/lambda/arn.ts +0 -33
- package/src/lambda/aws.ts +0 -248
- package/src/lambda/cliError.ts +0 -72
- package/src/lambda/constants.ts +0 -11
- package/src/lambda/help.ts +0 -92
- package/src/lambda/lambda.ts +0 -230
- package/src/lambda/lambdaUtils.ts +0 -111
- package/src/lambda/logUtils.ts +0 -64
- package/src/lambda/scanDetailCompletion.ts +0 -78
- package/src/lambda/scanRequest.ts +0 -169
- package/src/lambda/scanResults.ts +0 -29
- package/src/lambda/types.ts +0 -36
- package/src/lambda/utils.ts +0 -188
- package/src/sbom/generateSbom.ts +0 -45
- package/src/scaAnalysis/common/auditReport.js +0 -59
- package/src/scaAnalysis/common/commonReportingFunctionsSca.js +0 -276
- package/src/scaAnalysis/common/formatMessage.js +0 -67
- package/src/scaAnalysis/common/models/ScaReportModel.ts +0 -81
- package/src/scaAnalysis/common/scaParserForGoAndJava.js +0 -41
- package/src/scaAnalysis/common/scaServicesUpload.js +0 -159
- package/src/scaAnalysis/common/treeUpload.js +0 -51
- package/src/scaAnalysis/common/utils/reportUtilsSca.ts +0 -123
- package/src/scaAnalysis/dotnet/analysis.js +0 -72
- package/src/scaAnalysis/dotnet/index.js +0 -11
- package/src/scaAnalysis/go/goAnalysis.js +0 -26
- package/src/scaAnalysis/go/goParseDeps.js +0 -203
- package/src/scaAnalysis/go/goReadDepFile.js +0 -34
- package/src/scaAnalysis/java/analysis.js +0 -148
- package/src/scaAnalysis/java/index.js +0 -29
- package/src/scaAnalysis/java/javaBuildDepsParser.js +0 -439
- package/src/scaAnalysis/javascript/analysis.js +0 -111
- package/src/scaAnalysis/javascript/index.js +0 -104
- package/src/scaAnalysis/javascript/scaServiceParser.js +0 -151
- package/src/scaAnalysis/legacy/legacyFlow.js +0 -43
- package/src/scaAnalysis/php/analysis.js +0 -78
- package/src/scaAnalysis/php/index.js +0 -28
- package/src/scaAnalysis/php/phpNewServicesMapper.js +0 -77
- package/src/scaAnalysis/processServicesFlow.js +0 -126
- package/src/scaAnalysis/python/analysis.js +0 -93
- package/src/scaAnalysis/python/index.js +0 -16
- package/src/scaAnalysis/repoMode/gradleParser.js +0 -88
- package/src/scaAnalysis/repoMode/index.js +0 -21
- package/src/scaAnalysis/repoMode/mavenParser.js +0 -138
- package/src/scaAnalysis/ruby/analysis.js +0 -413
- package/src/scaAnalysis/ruby/index.js +0 -16
- package/src/scaAnalysis/scaAnalysis.js +0 -172
- package/src/scan/fileUtils.js +0 -218
- package/src/scan/formatScanOutput.ts +0 -225
- package/src/scan/help.js +0 -56
- package/src/scan/models/groupedResultsModel.ts +0 -20
- package/src/scan/models/resultContentModel.ts +0 -86
- package/src/scan/models/scanResultsModel.ts +0 -55
- package/src/scan/populateProjectIdAndProjectName.js +0 -73
- package/src/scan/saveResults.js +0 -14
- package/src/scan/scan.ts +0 -68
- package/src/scan/scanConfig.js +0 -58
- package/src/scan/scanController.js +0 -98
- package/src/scan/scanResults.js +0 -171
- package/src/telemetry/telemetry.ts +0 -154
- package/src/utils/capabilities.js +0 -12
- package/src/utils/commonApi.js +0 -103
- package/src/utils/filterProjectPath.js +0 -25
- package/src/utils/generalAPI.js +0 -52
- package/src/utils/getConfig.ts +0 -34
- package/src/utils/oraWrapper.js +0 -29
- package/src/utils/paramsUtil/commandlineParams.js +0 -12
- package/src/utils/paramsUtil/configStoreParams.js +0 -19
- package/src/utils/paramsUtil/envVariableParams.js +0 -10
- package/src/utils/paramsUtil/paramHandler.js +0 -38
- package/src/utils/parsedCLIOptions.js +0 -32
- package/src/utils/requestUtils.js +0 -29
- package/src/utils/saveFile.js +0 -20
- package/src/utils/validationCheck.js +0 -39
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const mavenParser = require('./mavenParser')
|
|
2
|
-
const gradleParser = require('./gradleParser')
|
|
3
|
-
const { determineProjectTypeAndCwd } = require('../java/analysis')
|
|
4
|
-
|
|
5
|
-
const buildRepo = async (config, languageFiles) => {
|
|
6
|
-
const project = determineProjectTypeAndCwd(languageFiles.JAVA, config)
|
|
7
|
-
|
|
8
|
-
if (project.projectType === 'maven') {
|
|
9
|
-
let jsonPomFile = mavenParser.readPomFile(project)
|
|
10
|
-
return mavenParser.parsePomFile(jsonPomFile)
|
|
11
|
-
} else if (project.projectType === 'gradle') {
|
|
12
|
-
const gradleJson = gradleParser.readBuildGradleFile(project)
|
|
13
|
-
return gradleParser.parseGradleJson(await gradleJson)
|
|
14
|
-
} else {
|
|
15
|
-
console.log('Unable to read project files.')
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = {
|
|
20
|
-
buildRepo
|
|
21
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const { XMLParser } = require('fast-xml-parser')
|
|
3
|
-
|
|
4
|
-
const readPomFile = project => {
|
|
5
|
-
const mavenFilePath = project.cwd + '/pom.xml'
|
|
6
|
-
const projectFile = fs.readFileSync(mavenFilePath)
|
|
7
|
-
const parser = new XMLParser()
|
|
8
|
-
return parser.parse(projectFile)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const parsePomFile = jsonPomFile => {
|
|
12
|
-
let dependencyTree = {}
|
|
13
|
-
let dependencies = []
|
|
14
|
-
let dependencyManagement = []
|
|
15
|
-
|
|
16
|
-
if (jsonPomFile.project && jsonPomFile.project.dependencies) {
|
|
17
|
-
dependencies = jsonPomFile.project.dependencies.dependency
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (jsonPomFile.project && jsonPomFile.project.dependencyManagement) {
|
|
21
|
-
dependencyManagement =
|
|
22
|
-
jsonPomFile.project.dependencyManagement.dependencies.dependency
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
//merge dependencies with dependencyManagement deps
|
|
26
|
-
//filter out any that don't appear in both by groupId and artifactId
|
|
27
|
-
const mergedAndFilteredDeps = dependencies.map(obj1 => {
|
|
28
|
-
const obj2 = dependencyManagement.find(
|
|
29
|
-
obj2 =>
|
|
30
|
-
obj2.groupId === obj1.groupId && obj2.artifactId === obj1.artifactId
|
|
31
|
-
)
|
|
32
|
-
return obj2 ? { ...obj1, ...obj2 } : obj1
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
buildDependencies(mergedAndFilteredDeps, dependencyTree, jsonPomFile)
|
|
36
|
-
return {
|
|
37
|
-
parentPom: getParentDependency(jsonPomFile),
|
|
38
|
-
dependencyTree
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const getParentDependency = jsonPomFile => {
|
|
43
|
-
if (jsonPomFile.project && jsonPomFile.project.parent) {
|
|
44
|
-
return buildParent(jsonPomFile.project.parent)
|
|
45
|
-
} else {
|
|
46
|
-
return undefined
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const buildParent = parent => {
|
|
51
|
-
return {
|
|
52
|
-
group: parent.groupId,
|
|
53
|
-
name: parent.artifactId,
|
|
54
|
-
version: parent.version
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const getVersionFromParent = (parentObj, dependencyWithoutVersion) => {
|
|
59
|
-
const { groupId, version } = parentObj
|
|
60
|
-
if (groupId === dependencyWithoutVersion.groupId) {
|
|
61
|
-
return version
|
|
62
|
-
} else {
|
|
63
|
-
return null
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const getVersionFromProperties = (properties, dep) => {
|
|
68
|
-
if (properties && dep.version.includes('${')) {
|
|
69
|
-
const currentDepVersionPlaceholder = dep.version
|
|
70
|
-
.replace('${', '')
|
|
71
|
-
.replace('}', '')
|
|
72
|
-
|
|
73
|
-
for (const prop in properties) {
|
|
74
|
-
if (prop === currentDepVersionPlaceholder) {
|
|
75
|
-
return properties[prop]
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const buildDependencies = (dependencies, dependencyTree, jsonPomFile) => {
|
|
82
|
-
const parent = getParentDependency(jsonPomFile)
|
|
83
|
-
for (const dep of dependencies) {
|
|
84
|
-
//sometimes versions are parsed as numbers, convert to string
|
|
85
|
-
const versionAsString = dep.version ? dep.version.toString() : dep.version
|
|
86
|
-
if (versionAsString && !versionAsString.includes('${')) {
|
|
87
|
-
const depName = dep.groupId + '/' + dep.artifactId + '@' + versionAsString
|
|
88
|
-
dependencyTree[depName] = buildDep(dep, dep.version)
|
|
89
|
-
} else if (
|
|
90
|
-
jsonPomFile.project.properties &&
|
|
91
|
-
dep.version &&
|
|
92
|
-
dep.version.includes('${')
|
|
93
|
-
) {
|
|
94
|
-
searchAndBuildFromProperties(jsonPomFile, dep, dependencyTree)
|
|
95
|
-
} else if (!dep.version) {
|
|
96
|
-
if (parent && parent.version) {
|
|
97
|
-
//get version where group matches from parent tag
|
|
98
|
-
const { parent } = jsonPomFile.project
|
|
99
|
-
const parsedVersion = getVersionFromParent(parent, dep)
|
|
100
|
-
const depName = dep.groupId + '/' + dep.artifactId + '@' + parsedVersion
|
|
101
|
-
dependencyTree[depName] = buildDep(dep, parsedVersion)
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const searchAndBuildFromProperties = (jsonPomFile, dep, dependencyTree) => {
|
|
108
|
-
//get version from properties tag
|
|
109
|
-
const { properties } = jsonPomFile.project
|
|
110
|
-
let versionFromProperties = getVersionFromProperties(properties, dep)
|
|
111
|
-
|
|
112
|
-
if (versionFromProperties) {
|
|
113
|
-
versionFromProperties = versionFromProperties.toString()
|
|
114
|
-
const depName =
|
|
115
|
-
dep.groupId + '/' + dep.artifactId + '@' + versionFromProperties
|
|
116
|
-
dependencyTree[depName] = buildDep(dep, versionFromProperties)
|
|
117
|
-
} else {
|
|
118
|
-
const depName = dep.groupId + '/' + dep.artifactId + '@' + null
|
|
119
|
-
dependencyTree[depName] = buildDep(dep, null)
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const buildDep = (dep, version) => {
|
|
124
|
-
return {
|
|
125
|
-
name: dep.artifactId,
|
|
126
|
-
group: dep.groupId,
|
|
127
|
-
version: version,
|
|
128
|
-
directDependency: true,
|
|
129
|
-
productionDependency: true,
|
|
130
|
-
dependencies: []
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
module.exports = {
|
|
135
|
-
readPomFile,
|
|
136
|
-
getVersionFromParent,
|
|
137
|
-
parsePomFile
|
|
138
|
-
}
|
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const i18n = require('i18n')
|
|
3
|
-
|
|
4
|
-
const getRubyDeps = (config, languageFiles) => {
|
|
5
|
-
try {
|
|
6
|
-
checkForCorrectFiles(languageFiles)
|
|
7
|
-
const parsedGem = readAndParseGemfile(config.file)
|
|
8
|
-
const parsedLock = readAndParseGemLockFile(config.file)
|
|
9
|
-
if (config.legacy === false) {
|
|
10
|
-
const rubyArray = removeRedundantAndPopulateDefinedElements(
|
|
11
|
-
parsedLock.sources
|
|
12
|
-
)
|
|
13
|
-
let rubyTree = createRubyTree(rubyArray)
|
|
14
|
-
findChildrenDependencies(rubyTree)
|
|
15
|
-
processRootDependencies(parsedLock.dependencies, rubyTree)
|
|
16
|
-
return rubyTree
|
|
17
|
-
} else {
|
|
18
|
-
return { gemfilesDependanceies: parsedGem, gemfileLock: parsedLock }
|
|
19
|
-
}
|
|
20
|
-
} catch (err) {
|
|
21
|
-
throw err
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const readAndParseGemfile = file => {
|
|
26
|
-
const gemFile = fs.readFileSync(file + '/Gemfile', 'utf8')
|
|
27
|
-
const rubyArray = gemFile.split('\n')
|
|
28
|
-
|
|
29
|
-
let filteredRubyDep = rubyArray.filter(element => {
|
|
30
|
-
return (
|
|
31
|
-
!element.includes('#') &&
|
|
32
|
-
element.includes('gem') &&
|
|
33
|
-
!element.includes('source')
|
|
34
|
-
)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
for (let i = 0; i < filteredRubyDep.length; i++) {
|
|
38
|
-
filteredRubyDep[i] = filteredRubyDep[i].trim()
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return filteredRubyDep
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const readAndParseGemLockFile = file => {
|
|
45
|
-
const lockFile = fs.readFileSync(file + '/Gemfile.lock', 'utf8')
|
|
46
|
-
const dependencyRegEx = /^\s*([A-Za-z0-9.!@#$%\-^&*_+]*)\s*(\((.*?)\))/
|
|
47
|
-
|
|
48
|
-
const lines = lockFile.split('\n')
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
dependencies: getDirectDependencies(lines, dependencyRegEx),
|
|
52
|
-
runtimeDetails: getLockFileRuntimeInfo(lines),
|
|
53
|
-
sources: getSourceArray(lines, dependencyRegEx)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const nonDependencyKeys = (line, sourceObject) => {
|
|
58
|
-
const GEMFILE_KEY_VALUE = /^\s*([^:(]*)\s*\:*\s*(.*)/
|
|
59
|
-
let parts = GEMFILE_KEY_VALUE.exec(line)
|
|
60
|
-
let key = parts[1].trim()
|
|
61
|
-
let value = parts[2] || ''
|
|
62
|
-
|
|
63
|
-
sourceObject[key] = value
|
|
64
|
-
return sourceObject
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const populateResolveAndPlatform = (version, sourceObject) => {
|
|
68
|
-
const depArr = version.split('-')
|
|
69
|
-
sourceObject.resolved = depArr[0]
|
|
70
|
-
sourceObject.platform = depArr.length > 1 ? depArr[1] : 'UNSPECIFIED'
|
|
71
|
-
return sourceObject
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const isUpperCase = str => {
|
|
75
|
-
return str === str.toUpperCase()
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const getDirectDependencies = (lines, dependencyRegEx) => {
|
|
79
|
-
const dependencies = {}
|
|
80
|
-
|
|
81
|
-
let depIndex = 0
|
|
82
|
-
for (let i = 0; i < lines.length; i++) {
|
|
83
|
-
if (lines[i] === 'DEPENDENCIES') {
|
|
84
|
-
depIndex = i
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const getDepArray = lines.slice(depIndex)
|
|
88
|
-
|
|
89
|
-
for (let j = 1; j < getDepArray.length; j++) {
|
|
90
|
-
const element = getDepArray[j]
|
|
91
|
-
if (!isUpperCase(element)) {
|
|
92
|
-
const isDependencyWithVersion = dependencyRegEx.test(element)
|
|
93
|
-
if (isDependencyWithVersion) {
|
|
94
|
-
const dependency = dependencyRegEx.exec(element)
|
|
95
|
-
let name = dependency[1]
|
|
96
|
-
name = name.replace('!', '')
|
|
97
|
-
dependencies[name.trim()] = dependency[3]
|
|
98
|
-
} else {
|
|
99
|
-
let name = element
|
|
100
|
-
name = name.replace('!', ' ')
|
|
101
|
-
dependencies[name.trim()] = 'UNSPECIFIED'
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return dependencies
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const getLockFileRuntimeInfo = lines => {
|
|
110
|
-
let rubVersionIndex = 0
|
|
111
|
-
for (let i = 0; i < lines.length; i++) {
|
|
112
|
-
if (lines[i] === 'RUBY VERSION') {
|
|
113
|
-
rubVersionIndex = i
|
|
114
|
-
break
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const runtimeDetails = {}
|
|
119
|
-
if (rubVersionIndex !== 0) {
|
|
120
|
-
const getRubyVersionArray = lines.slice(rubVersionIndex)
|
|
121
|
-
|
|
122
|
-
for (let element of getRubyVersionArray) {
|
|
123
|
-
if (!isUpperCase(element)) {
|
|
124
|
-
runtimeDetails['version'] = getVersion(element)
|
|
125
|
-
runtimeDetails['patchLevel'] = getPatchLevel(element)
|
|
126
|
-
|
|
127
|
-
if (element.includes('engine')) {
|
|
128
|
-
let splitElement = element.split(' ')
|
|
129
|
-
runtimeDetails[splitElement[0]] = splitElement[1]
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return runtimeDetails
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const getVersion = element => {
|
|
138
|
-
const versionRegex = /^([ruby\s0-9.*]+)/
|
|
139
|
-
if (versionRegex.test(element)) {
|
|
140
|
-
let version = versionRegex.exec(element)[0]
|
|
141
|
-
|
|
142
|
-
if (version.includes('ruby')) {
|
|
143
|
-
return trimWhiteSpace(version.replace('ruby', ''))
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const getPatchLevel = element => {
|
|
149
|
-
const patchLevelRegex = /(p\d+)/
|
|
150
|
-
if (patchLevelRegex.test(element)) {
|
|
151
|
-
return patchLevelRegex.exec(element)[0]
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const formatSourceArr = sourceArr => {
|
|
156
|
-
return sourceArr.map(element => {
|
|
157
|
-
if (element.sourceType === 'GIT') {
|
|
158
|
-
delete element.specs
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (element.sourceType === 'GEM') {
|
|
162
|
-
delete element.branch
|
|
163
|
-
delete element.revision
|
|
164
|
-
delete element.depthLevel
|
|
165
|
-
delete element.specs
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
if (element.sourceType === 'PATH') {
|
|
169
|
-
delete element.branch
|
|
170
|
-
delete element.revision
|
|
171
|
-
delete element.depthLevel
|
|
172
|
-
delete element.specs
|
|
173
|
-
delete element.platform
|
|
174
|
-
}
|
|
175
|
-
return element
|
|
176
|
-
})
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const getSourceArray = (lines, dependencyRegEx) => {
|
|
180
|
-
const sourceObject = {
|
|
181
|
-
dependencies: {}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
const whitespaceRegx = /^(\s*)/
|
|
185
|
-
let index = 0
|
|
186
|
-
|
|
187
|
-
let line = 0
|
|
188
|
-
const sources = []
|
|
189
|
-
while ((line = lines[index++]) !== undefined) {
|
|
190
|
-
let currentWS = whitespaceRegx.exec(line)[1].length
|
|
191
|
-
if (!line.includes(' bundler (')) {
|
|
192
|
-
if (currentWS === 0 && !line.includes(':') && line !== '') {
|
|
193
|
-
sourceObject.sourceType = line
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
if (currentWS !== 0 && line.includes(':')) {
|
|
197
|
-
nonDependencyKeys(line, sourceObject)
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
if (currentWS > 2) {
|
|
201
|
-
let nexlineWS = whitespaceRegx.exec(lines[index])[1].length
|
|
202
|
-
sourceObject.dependencies = buildSourceDependencyWithVersion(
|
|
203
|
-
whitespaceRegx,
|
|
204
|
-
dependencyRegEx,
|
|
205
|
-
line,
|
|
206
|
-
currentWS,
|
|
207
|
-
sourceObject.name,
|
|
208
|
-
sourceObject.dependencies
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
if (currentWS === 4 && sourceObject.depthLevel === undefined) {
|
|
212
|
-
const dependency = dependencyRegEx.exec(line)
|
|
213
|
-
sourceObject.name = dependency[1]
|
|
214
|
-
sourceObject.depthLevel = currentWS
|
|
215
|
-
populateResolveAndPlatform(dependency[3], sourceObject)
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
if (currentWS === 4 && sourceObject.depthLevel) {
|
|
219
|
-
// create new Parent
|
|
220
|
-
const dependency = dependencyRegEx.exec(line)
|
|
221
|
-
sourceObject.name = dependency[1]
|
|
222
|
-
sourceObject.depthLevel = currentWS
|
|
223
|
-
populateResolveAndPlatform(dependency[3], sourceObject)
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
if (
|
|
227
|
-
(currentWS === 4 && nexlineWS === 4) ||
|
|
228
|
-
(currentWS === 6 && nexlineWS === 4) ||
|
|
229
|
-
nexlineWS == ''
|
|
230
|
-
) {
|
|
231
|
-
let newObj = {}
|
|
232
|
-
newObj = JSON.parse(JSON.stringify(sourceObject))
|
|
233
|
-
sources.push(newObj)
|
|
234
|
-
sourceObject.dependencies = {}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return formatSourceArr(sources)
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
const buildSourceDependencyWithVersion = (
|
|
243
|
-
whitespaceRegx,
|
|
244
|
-
dependencyRegEx,
|
|
245
|
-
line,
|
|
246
|
-
currentWhiteSpace,
|
|
247
|
-
name,
|
|
248
|
-
dependencies
|
|
249
|
-
) => {
|
|
250
|
-
const isDependencyWithVersion = dependencyRegEx.test(line)
|
|
251
|
-
|
|
252
|
-
if (currentWhiteSpace === 6) {
|
|
253
|
-
const dependency = dependencyRegEx.exec(line)
|
|
254
|
-
if (isDependencyWithVersion) {
|
|
255
|
-
if (name !== dependency[1]) {
|
|
256
|
-
dependencies[dependency[1]] = dependency[3]
|
|
257
|
-
}
|
|
258
|
-
} else {
|
|
259
|
-
dependencies[line.trim()] = 'UNSPECIFIED'
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
return dependencies
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const processRootDependencies = (rootDependencies, rubyTree) => {
|
|
267
|
-
const getParentObjectByName = queryToken =>
|
|
268
|
-
Object.values(rubyTree).filter(({ name }) => name === queryToken)
|
|
269
|
-
|
|
270
|
-
for (let parent in rootDependencies) {
|
|
271
|
-
let parentObject = getParentObjectByName(parent)
|
|
272
|
-
|
|
273
|
-
// ignore root dependencies that don't have a resolved version
|
|
274
|
-
if (parentObject[0]) {
|
|
275
|
-
let gav =
|
|
276
|
-
parentObject[0].group +
|
|
277
|
-
'/' +
|
|
278
|
-
parentObject[0].name +
|
|
279
|
-
'@' +
|
|
280
|
-
parentObject[0].version
|
|
281
|
-
|
|
282
|
-
rubyTree[gav] = parentObject[0]
|
|
283
|
-
rubyTree[gav].directDependency = true
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return rubyTree
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const createRubyTree = rubyArray => {
|
|
290
|
-
let rubyTree = {}
|
|
291
|
-
for (let x in rubyArray) {
|
|
292
|
-
let version = rubyArray[x].resolved
|
|
293
|
-
|
|
294
|
-
let gav = rubyArray[x].group + '/' + rubyArray[x].name + '@' + version
|
|
295
|
-
rubyTree[gav] = rubyArray[x]
|
|
296
|
-
rubyTree[gav].directDependency = false
|
|
297
|
-
rubyTree[gav].version = version
|
|
298
|
-
|
|
299
|
-
// add dependency array if none exists
|
|
300
|
-
if (!rubyTree[gav].dependencies) {
|
|
301
|
-
rubyTree[gav].dependencies = []
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
delete rubyTree[gav].resolved
|
|
305
|
-
}
|
|
306
|
-
return rubyTree
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
const findChildrenDependencies = rubyTree => {
|
|
310
|
-
for (let dep in rubyTree) {
|
|
311
|
-
let unResolvedChildDepsKey = Object.keys(rubyTree[dep].dependencies)
|
|
312
|
-
rubyTree[dep].dependencies = resolveVersionOfChildDependencies(
|
|
313
|
-
unResolvedChildDepsKey,
|
|
314
|
-
rubyTree
|
|
315
|
-
)
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
const resolveVersionOfChildDependencies = (
|
|
320
|
-
unResolvedChildDepsKey,
|
|
321
|
-
rubyObject
|
|
322
|
-
) => {
|
|
323
|
-
const getParentObjectByName = queryToken =>
|
|
324
|
-
Object.values(rubyObject).filter(({ name }) => name === queryToken)
|
|
325
|
-
let resolvedChildrenDependencies = []
|
|
326
|
-
for (let childDep in unResolvedChildDepsKey) {
|
|
327
|
-
let childDependencyName = unResolvedChildDepsKey[childDep]
|
|
328
|
-
let parent = getParentObjectByName(childDependencyName)
|
|
329
|
-
resolvedChildrenDependencies.push(
|
|
330
|
-
'null/' + childDependencyName + '@' + parent[0].version
|
|
331
|
-
)
|
|
332
|
-
}
|
|
333
|
-
return resolvedChildrenDependencies
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
const removeRedundantAndPopulateDefinedElements = deps => {
|
|
337
|
-
return deps.map(element => {
|
|
338
|
-
if (element.sourceType === 'GIT') {
|
|
339
|
-
delete element.sourceType
|
|
340
|
-
delete element.remote
|
|
341
|
-
delete element.platform
|
|
342
|
-
|
|
343
|
-
element.group = null
|
|
344
|
-
element.productionDependency = true
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
if (element.sourceType === 'GEM') {
|
|
348
|
-
element.group = null
|
|
349
|
-
element.productionDependency = true
|
|
350
|
-
|
|
351
|
-
delete element.sourceType
|
|
352
|
-
delete element.remote
|
|
353
|
-
delete element.platform
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
if (element.sourceType === 'PATH') {
|
|
357
|
-
element.group = null
|
|
358
|
-
element.productionDependency = true
|
|
359
|
-
|
|
360
|
-
delete element.platform
|
|
361
|
-
delete element.sourceType
|
|
362
|
-
delete element.remote
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
if (element.sourceType === 'BUNDLED WITH') {
|
|
366
|
-
element.group = null
|
|
367
|
-
element.productionDependency = true
|
|
368
|
-
|
|
369
|
-
delete element.sourceType
|
|
370
|
-
delete element.remote
|
|
371
|
-
delete element.branch
|
|
372
|
-
delete element.revision
|
|
373
|
-
delete element.depthLevel
|
|
374
|
-
delete element.specs
|
|
375
|
-
delete element.platform
|
|
376
|
-
}
|
|
377
|
-
return element
|
|
378
|
-
})
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
const checkForCorrectFiles = languageFiles => {
|
|
382
|
-
if (!languageFiles.includes('Gemfile.lock')) {
|
|
383
|
-
throw new Error(i18n.__('languageAnalysisHasNoLockFile', 'ruby'))
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
if (!languageFiles.includes('Gemfile')) {
|
|
387
|
-
throw new Error(i18n.__('languageAnalysisProjectFileError', 'ruby'))
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
const trimWhiteSpace = string => {
|
|
392
|
-
return string.replace(/\s+/g, '')
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
module.exports = {
|
|
396
|
-
getRubyDeps,
|
|
397
|
-
readAndParseGemfile,
|
|
398
|
-
readAndParseGemLockFile,
|
|
399
|
-
nonDependencyKeys,
|
|
400
|
-
populateResolveAndPlatform,
|
|
401
|
-
isUpperCase,
|
|
402
|
-
getDirectDependencies,
|
|
403
|
-
getLockFileRuntimeInfo,
|
|
404
|
-
getVersion,
|
|
405
|
-
getPatchLevel,
|
|
406
|
-
formatSourceArr,
|
|
407
|
-
getSourceArray,
|
|
408
|
-
checkForCorrectFiles,
|
|
409
|
-
removeRedundantAndPopulateDefinedElements,
|
|
410
|
-
createRubyTree,
|
|
411
|
-
findChildrenDependencies,
|
|
412
|
-
processRootDependencies
|
|
413
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const analysis = require('./analysis')
|
|
2
|
-
const { createRubyTSMessage } = require('../common/formatMessage')
|
|
3
|
-
|
|
4
|
-
const rubyAnalysis = (config, languageFiles) => {
|
|
5
|
-
const rubyDeps = analysis.getRubyDeps(config, languageFiles.RUBY)
|
|
6
|
-
|
|
7
|
-
if (config.legacy === false) {
|
|
8
|
-
return rubyDeps
|
|
9
|
-
} else {
|
|
10
|
-
return createRubyTSMessage(rubyDeps)
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
rubyAnalysis
|
|
16
|
-
}
|