Sha256: de4ec20a3b3ad8e738974f3844f9bb4975fef2d10e74566010d0e3582fdfc0b9

Contents?: true

Size: 591 Bytes

Versions: 15

Compression:

Stored size: 591 Bytes

Contents

Dir.glob("#{__dir__}/*.rb").each { |file| require file }

require 'json'

class JsonFileValidator < ValidationStrategy
    def initialize(json_files)
        @json_files = json_files
    end

    def validate(project_path = nil)
        @json_files.each do |json_file|
            begin
                path = json_file
                JSON.parse(File.read(path))
                Solara.logger.passed("Valid JSON: #{path}")
            rescue JSON::ParserError => e
                raise ValidationError, "Not valid JSON: #{path}. Error: #{e.message}"
            end
        end
    end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solara-0.7.4 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.7.3 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.7.2 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.7.1 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.7.0 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.6.0 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.5.0 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.4.0 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.3.0 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.2.4 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.2.3 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.2.2 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.2.1 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.2.0 solara/lib/core/doctor/validator/json_file_validator.rb
solara-0.1.0 solara/lib/core/doctor/validator/json_file_validator.rb