Class: Packages::Npm::CheckManifestCoherenceService
- Inherits:
-
Object
- Object
- Packages::Npm::CheckManifestCoherenceService
- Defined in:
- app/services/packages/npm/check_manifest_coherence_service.rb
Constant Summary collapse
- MismatchError =
Class.new(StandardError)
- PKG_TYPE =
'npm'- MANIFEST_NOT_COHERENT_ERROR =
'Package manifest is not coherent'- VERSION_NOT_COMPLIANT_ERROR =
'Version in package.json is not SemVer compliant'
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(package, package_json_entry) ⇒ CheckManifestCoherenceService
constructor
A new instance of CheckManifestCoherenceService.
Constructor Details
#initialize(package, package_json_entry) ⇒ CheckManifestCoherenceService
Returns a new instance of CheckManifestCoherenceService.
12 13 14 15 |
# File 'app/services/packages/npm/check_manifest_coherence_service.rb', line 12 def initialize(package, package_json_entry) @package = package @package_json_entry = package_json_entry end |
Instance Method Details
#execute ⇒ Object
17 18 19 20 21 22 23 |
# File 'app/services/packages/npm/check_manifest_coherence_service.rb', line 17 def execute parsed_package_json = Gitlab::Json.parse(package_json_entry.read) raise MismatchError, MANIFEST_NOT_COHERENT_ERROR unless coherent?(parsed_package_json) ServiceResponse.success end |