Sha256: b3c132d5c3e1ca42dcad0ca8b4e9c03519072cc107be4e81bca5e2ac6441d090
Contents?: true
Size: 1.55 KB
Versions: 2
Compression:
Stored size: 1.55 KB
Contents
require 'bundler' require 'rake' require 'rake/testtask' Bundler::GemHelper.install_tasks desc "Updates the json-schema common test suite to the latest version" task :update_common_tests do unless File.read(".git/config").include?('submodule "test/test-suite"') sh "git submodule init" end puts "Updating json-schema common test suite..." begin sh "git submodule update --remote --quiet" rescue StandardError STDERR.puts "Failed to update common test suite." end end desc "Update meta-schemas to the latest version" task :update_meta_schemas do puts "Updating meta-schemas..." id_mappings = { 'http://json-schema.org/draft/schema#' => 'https://raw.githubusercontent.com/json-schema-org/json-schema-spec/master/schema.json' } require 'open-uri' require 'thwait' download_threads = Dir['resources/*.json'].map do |path| schema_id = File.read(path)[/"\$?id"\s*:\s*"(.*?)"/, 1] schema_uri = id_mappings[schema_id] || schema_id Thread.new(schema_uri) do |uri| Thread.current[:uri] = uri begin metaschema = URI(uri).read File.write(path, metaschema) rescue StandardError false end end end ThreadsWait.all_waits(*download_threads) do |t| if t.value puts t[:uri] else STDERR.puts "Failed to update meta-schema #{t[:uri]}" end end end Rake::TestTask.new do |t| t.libs << "." t.warning = true t.verbose = true t.test_files = FileList.new('test/*_test.rb') end task update: [:update_common_tests, :update_meta_schemas] task :default => :test
Version data entries
2 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mountapi-0.11.1 | vendor/bundle/ruby/2.7.0/bundler/gems/json-schema-2253a5ee6679/Rakefile |
mountapi-0.11.1 | vendor/json-schema/Rakefile |