From dd84d04087b1059b27c8249df6a2b923df272248 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 15 Dec 2019 17:59:07 -0800 Subject: [PATCH 1/4] Update for 3.1 release and Ruby 2.7 calling sequences. --- .travis.yml | 13 ++--- Gemfile | 4 +- lib/rdf/tabular/json.rb | 0 lib/rdf/tabular/literal.rb | 2 +- lib/rdf/tabular/metadata.rb | 94 ++++++++++++++++++------------------- lib/rdf/tabular/reader.rb | 30 ++++++------ script/parse | 6 +-- script/tc | 4 +- spec/metadata_spec.rb | 4 +- spec/suite_helper.rb | 4 +- spec/suite_spec.rb | 9 ++-- 11 files changed, 81 insertions(+), 89 deletions(-) delete mode 100644 lib/rdf/tabular/json.rb diff --git a/.travis.yml b/.travis.yml index b6e788e..0c5127e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,18 @@ language: ruby -bundler_args: --without debug script: "bundle exec rspec spec" -before_install: - - 'gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)' - - 'gem update bundler --conservative' env: global: - CI=true - NOKOGIRI_USE_SYSTEM_LIBRARIES=true rvm: - - 2.2.2 - - 2.3 - 2.4 - 2.5 - 2.6 - - jruby-9 - - rbx-3 + - 2.7 + - jruby cache: bundler sudo: false matrix: allow_failures: - - rvm: jruby-9 - - rvm: rbx-3 + - rvm: jruby dist: trusty diff --git a/Gemfile b/Gemfile index 6c412f4..dc42e49 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,7 @@ group :debug do end group :development, :test do - gem 'simplecov', require: false - gem 'coveralls', require: false + gem 'simplecov', platforms: :mri + gem 'coveralls', '~> 0.8', platforms: :mri gem 'psych', platforms: [:mri, :rbx] end diff --git a/lib/rdf/tabular/json.rb b/lib/rdf/tabular/json.rb deleted file mode 100644 index e69de29..0000000 diff --git a/lib/rdf/tabular/literal.rb b/lib/rdf/tabular/literal.rb index 3c1ec76..28b1850 100644 --- a/lib/rdf/tabular/literal.rb +++ b/lib/rdf/tabular/literal.rb @@ -13,7 +13,7 @@ class JSON < RDF::Literal ## # @param [Object] value # @option options [String] :lexical (nil) - def initialize(value, options = {}) + def initialize(value, **options) @datatype = options[:datatype] || DATATYPE @string = options[:lexical] if options.has_key?(:lexical) if value.is_a?(String) diff --git a/lib/rdf/tabular/metadata.rb b/lib/rdf/tabular/metadata.rb index 8a2d0a5..cdd2a2e 100644 --- a/lib/rdf/tabular/metadata.rb +++ b/lib/rdf/tabular/metadata.rb @@ -136,15 +136,15 @@ class Metadata # see `RDF::Util::File.open_file` in RDF.rb and {new} # @yield [Metadata] # @raise [IOError] if file not found - def self.open(path, options = {}) + def self.open(path, **options) options = options.merge( headers: { 'Accept' => 'application/ld+json, application/json' } ) path = "file:" + path unless path =~ /^\w+:/ - RDF::Util::File.open_file(path, options) do |file| - self.new(file, options.merge(base: path, filenames: path)) + RDF::Util::File.open_file(path, **options) do |file| + self.new(file, **options.merge(base: path, filenames: path)) end end @@ -173,16 +173,16 @@ def self.site_wide_config(base) # @option options [RDF::URI] :base # The Base URL to use when expanding the document. This overrides the value of `input` if it is a URL. If not specified and `input` is not an URL, the base URL defaults to the current document URL if in a browser context, or the empty string if there is no document context. # @return [Metadata] - def self.for_input(input, options = {}) + def self.for_input(input, **options) base = options[:base] # Use user metadata, if provided metadata = case options[:metadata] when Metadata then options[:metadata] when Hash - Metadata.new(options[:metadata], options.merge(reason: "load user metadata: #{options[:metadata].inspect}")) + Metadata.new(options[:metadata], **options.merge(reason: "load user metadata: #{options[:metadata].inspect}")) when String, RDF::URI - Metadata.open(options[:metadata], options.merge(filenames: options[:metadata], reason: "load user metadata: #{options[:metadata].inspect}")) + Metadata.open(options[:metadata], **options.merge(filenames: options[:metadata], reason: "load user metadata: #{options[:metadata].inspect}")) end # Search for metadata until found @@ -191,13 +191,13 @@ def self.for_input(input, options = {}) if !metadata && input.respond_to?(:links) && link = input.links.find_link(%w(rel describedby)) link_loc = RDF::URI(base).join(link.href).to_s - md = Metadata.open(link_loc, options.merge(filenames: link_loc, reason: "load linked metadata: #{link_loc}")) + md = Metadata.open(link_loc, **options.merge(filenames: link_loc, reason: "load linked metadata: #{link_loc}")) if md # Metadata must describe file to be useful if md.describes_file?(base) metadata = md else - log_warn("Found metadata at #{link_loc}, which does not describe #{base}, ignoring", options) + log_warn("Found metadata at #{link_loc}, which does not describe #{base}, ignoring", **options) end end end @@ -206,28 +206,28 @@ def self.for_input(input, options = {}) # If we still don't have metadata, load the site-wide configuration file and use templates found there as locations if !metadata && base templates = site_wide_config(base) - log_debug("for_input", options) {"templates: #{templates.map(&:to_s).inspect}"} + log_debug("for_input", **options) {"templates: #{templates.map(&:to_s).inspect}"} locs = templates.map do |template| t = Addressable::Template.new(template) RDF::URI(base).join(t.expand(url: base).to_s) end - log_debug("for_input", options) {"locs: #{locs.map(&:to_s).inspect}"} + log_debug("for_input", **options) {"locs: #{locs.map(&:to_s).inspect}"} locs.each do |loc| metadata ||= begin - md = Metadata.open(loc, options.merge(filenames: loc, reason: "load found metadata: #{loc}")) + md = Metadata.open(loc, **options.merge(filenames: loc, reason: "load found metadata: #{loc}")) # Metadata must describe file to be useful if md # Metadata must describe file to be useful if md.describes_file?(base) md else - log_warn("Found metadata at #{loc}, which does not describe #{base}, ignoring", options) + log_warn("Found metadata at #{loc}, which does not describe #{base}, ignoring", **options) nil end end rescue IOError - log_debug("for_input", options) {"failed to load found metadata #{loc}: #{$!}"} + log_debug("for_input", **options) {"failed to load found metadata #{loc}: #{$!}"} nil end end @@ -236,8 +236,8 @@ def self.for_input(input, options = {}) # Return either the merge or user- and found-metadata, any of these, or an empty TableGroup metadata = case when metadata then metadata - when base then TableGroup.new({"@context" => "http://www.w3.org/ns/csvw", tables: [{url: base}]}, options) - else TableGroup.new({"@context" => "http://www.w3.org/ns/csvw", tables: [{url: nil}]}, options) + when base then TableGroup.new({"@context" => "http://www.w3.org/ns/csvw", tables: [{url: base}]}, **options) + else TableGroup.new({"@context" => "http://www.w3.org/ns/csvw", tables: [{url: nil}]}, **options) end # Make TableGroup, if not already @@ -246,7 +246,7 @@ def self.for_input(input, options = {}) ## # @private - def self.new(input, options = {}) + def self.new(input, **options) # Triveal case return input if input.is_a?(Metadata) @@ -297,7 +297,7 @@ def self.new(input, options = {}) end md = klass.allocate - md.send(:initialize, object, options) + md.send(:initialize, object, **options) md rescue ::JSON::ParserError raise Error, "Expected input to be a JSON Object" @@ -318,7 +318,7 @@ def self.new(input, options = {}) # @option options [Boolean] :validate Strict metadata validation # @raise [Error] # @return [Metadata] - def initialize(input, options = {}) + def initialize(input, **options) @options = options.dup # Parent of this Metadata, if any @@ -467,16 +467,16 @@ def tableSchema=(value) object[:tableSchema] = case value when String link = context.base.join(value).to_s - md = Schema.open(link, @options.merge(parent: self, context: nil, normalize: true)) + md = Schema.open(link, **@options.merge(parent: self, context: nil, normalize: true)) md[:@id] ||= link md when Hash - Schema.new(value, @options.merge(parent: self, context: nil)) + Schema.new(value, **@options.merge(parent: self, context: nil)) when Schema value else log_warn "#{type} has invalid property 'tableSchema' (#{value.inspect}): expected a URL or object" - Schema.new({}, @options.merge(parent: self, context: nil)) + Schema.new({}, **@options.merge(parent: self, context: nil)) end end @@ -491,7 +491,7 @@ def dialect when object[:dialect] then object[:dialect] when parent then parent.dialect when is_a?(Table) || is_a?(TableGroup) - d = Dialect.new({}, @options.merge(parent: self, context: nil)) + d = Dialect.new({}, **@options.merge(parent: self, context: nil)) self.dialect = d unless self.parent d else @@ -514,11 +514,11 @@ def dialect=(value) @dialect = object[:dialect] = case value when String link = context.base.join(value).to_s - md = Metadata.open(link, @options.merge(parent: self, context: nil, normalize: true)) + md = Metadata.open(link, **@options.merge(parent: self, context: nil, normalize: true)) md[:@id] ||= link md when Hash - Dialect.new(value, @options.merge(parent: self, context: nil)) + Dialect.new(value, **@options.merge(parent: self, context: nil)) when Dialect value else @@ -532,8 +532,8 @@ def dialect=(value) # @raise [Error] if datatype is not valid def datatype=(value) val = case value - when Hash then Datatype.new(value, @options.merge(parent: self)) - else Datatype.new({base: value}, @options.merge(parent: self)) + when Hash then Datatype.new(value, **@options.merge(parent: self)) + else Datatype.new({base: value}, **@options.merge(parent: self)) end if val.valid? || value.is_a?(Hash) @@ -872,7 +872,7 @@ def each_row(input) csv << data unless data.empty? end else - csv = ::CSV.new(input, csv_options) + csv = ::CSV.new(input, **csv_options) # Skip skipRows and headerRowCount skipped = (dialect.skipRows.to_i + dialect.headerRowCount) (1..skipped).each {csv.shift} @@ -891,7 +891,7 @@ def each_row(input) next end number += 1 - row = Row.new(data, self, number, number + skipped, @options) + row = Row.new(data, self, number, number + skipped, **@options) (self.object[:rows] ||= []) << row if @options[:validate] # Keep track of rows when validating yield(row) end @@ -1036,7 +1036,7 @@ def verify_compatible!(other) end index = 0 object_columns.all? do |cb| - ca = non_virtual_columns[index] || Column.new({}, @options) + ca = non_virtual_columns[index] || Column.new({}, **@options) ta = ca.titles || {} tb = cb.titles || {} if !ca.object.has_key?(:name) && !cb.object.has_key?(:name) && ta.empty? && tb.empty? @@ -1235,13 +1235,13 @@ def set_nl(value) end # General setter for array properties - def set_array_value(key, value, klass, options={}) + def set_array_value(key, value, klass, **options) object[key] = case value when Array value.map do |v| case v when Hash - klass.new(v, @options.merge(options).merge(parent: self, context: nil)) + klass.new(v, **@options.merge(options).merge(parent: self, context: nil)) else v end end @@ -1282,11 +1282,11 @@ def csv_options class DebugContext include RDF::Util::Logger end - def self.log_debug(*args, &block) - DebugContext.new.log_debug(*args, &block) + def self.log_debug(*args, **options, &block) + DebugContext.new.log_debug(*args, **options, &block) end - def self.log_warn(*args) - DebugContext.new.log_warn(*args) + def self.log_warn(*args, **options) + DebugContext.new.log_warn(*args, **options) end end @@ -1434,7 +1434,7 @@ def to_table_group content['@context'] = object.delete(:@context) if object[:@context] ctx = @context remove_instance_variable(:@context) if instance_variables.include?(:@context) - tg = TableGroup.new(content, @options.merge(context: ctx, filenames: @filenames, base: base)) + tg = TableGroup.new(content, **@options.merge(context: ctx, filenames: @filenames, base: base)) @parent = tg # Link from parent tg end @@ -1489,7 +1489,7 @@ def columns=(value) number += 1 case v when Hash - Column.new(v, @options.merge( + Column.new(v, **@options.merge( table: (parent if parent.is_a?(Table)), parent: self, context: nil, @@ -1621,8 +1621,8 @@ def has_annotations? def name self[:name] || if titles && (ts = titles[context.default_language || 'und'] || titles[self.lang || 'und']) n = Array(ts).first - n0 = URI.encode(n[0,1], /[^a-zA-Z0-9]/).encode("utf-8") - n1 = URI.encode(n[1..-1], /[^\w\.]/).encode("utf-8") + n0 = RDF::URI.encode(n[0,1], /[^a-zA-Z0-9]/).encode("utf-8") + n1 = RDF::URI.encode(n[1..-1], /[^\w\.]/).encode("utf-8") "#{n0}#{n1}" end || "_col.#{number}" end @@ -1783,12 +1783,12 @@ def trim # @option options [String] :lang, language to set in table, if any # @return [Metadata] Tabular metadata # @see http://w3c.github.io/csvw/syntax/#parsing - def embedded_metadata(input, metadata, options = {}) + def embedded_metadata(input, metadata, **options) options = options.dup options.delete(:context) # Don't accidentally use a passed context # Normalize input to an IO object if input.is_a?(String) - return ::RDF::Util::File.open_file(input) {|f| embedded_metadata(f, metadata, options.merge(base: input.to_s))} + return ::RDF::Util::File.open_file(input) {|f| embedded_metadata(f, metadata, **options.merge(base: input.to_s))} end table = { @@ -1841,7 +1841,7 @@ def embedded_metadata(input, metadata, options = {}) end end else - csv = ::CSV.new(input, csv_options) + csv = ::CSV.new(input, **csv_options) (1..skipRows.to_i).each do value = csv.shift.join(delimiter) # Skip initial lines, these form comment annotations # Trim value @@ -1876,7 +1876,7 @@ def embedded_metadata(input, metadata, options = {}) log_debug("embedded_metadata") {"table: #{table.inspect}"} input.rewind if input.respond_to?(:rewind) - Table.new(table, options.merge(reason: "load embedded metadata: #{table['@id']}")) + Table.new(table, **options.merge(reason: "load embedded metadata: #{table['@id']}")) end end @@ -2026,7 +2026,7 @@ def inspect # @param [Hash{Symbol => Object}] options ({}) # @option options [Boolean] :validate check for PK/FK consistency # @return [Row] - def initialize(row, metadata, number, source_number, options = {}) + def initialize(row, metadata, number, source_number, **options) @table = metadata @number = number @sourceNumber = source_number @@ -2058,13 +2058,13 @@ def initialize(row, metadata, number, source_number, options = {}) # create column if necessary columns[index - skipColumns] ||= - Column.new({}, options.merge(table: metadata, parent: metadata.tableSchema, number: index + 1 - skipColumns)) + Column.new({}, **options.merge(table: metadata, parent: metadata.tableSchema, number: index + 1 - skipColumns)) column = columns[index - skipColumns] @values << cell = Cell.new(metadata, column, self, value) - datatype = column.datatype || Datatype.new({base: "string"}, options.merge(parent: column)) + datatype = column.datatype || Datatype.new({base: "string"}, **options.merge(parent: column)) value = value.gsub(/\r\n\t/, ' ') unless %w(string json xml html anyAtomicType).include?(datatype.base) value = value.strip.gsub(/\s+/, ' ') unless %w(string json xml html anyAtomicType normalizedString).include?(datatype.base) # if the resulting string is an empty string, apply the remaining steps to the string given by the default property @@ -2110,7 +2110,7 @@ def initialize(row, metadata, number, source_number, options = {}) # Map URLs for row @values.each_with_index do |cell, index| mapped_values = map_values.merge( - "_name" => URI.decode(cell.column.name), + "_name" => CGI.unescape(cell.column.name), "_column" => cell.column.number, "_sourceColumn" => cell.column.sourceNumber ) diff --git a/lib/rdf/tabular/reader.rb b/lib/rdf/tabular/reader.rb index daf7fb3..2dd6c80 100644 --- a/lib/rdf/tabular/reader.rb +++ b/lib/rdf/tabular/reader.rb @@ -63,7 +63,7 @@ def self.options # @yieldparam [RDF::Reader] reader # @yieldreturn [void] ignored # @raise [RDF::ReaderError] if the CSV document cannot be loaded - def initialize(input = $stdin, options = {}, &block) + def initialize(input = $stdin, **options, &block) super do # Base would be how we are to take this @options[:base] ||= base_uri.to_s if base_uri @@ -89,7 +89,7 @@ def initialize(input = $stdin, options = {}, &block) # If input is JSON, then the input is the metadata content_type = @input.respond_to?(:content_type) ? @input.content_type : "" if @options[:base] =~ /\.json(?:ld)?$/ || content_type =~ %r(application/(csvm\+|ld\+)?json) - @metadata = Metadata.new(@input, @options.merge(filenames: @options[:base])) + @metadata = Metadata.new(@input, filenames: @options[:base], **@options) # If @metadata is for a Table, turn it into a TableGroup @metadata = @metadata.to_table_group if @metadata.is_a?(Table) @metadata.normalize! @@ -102,7 +102,7 @@ def initialize(input = $stdin, options = {}, &block) def script.content_type; "application/csvm+json"; end log_debug("Reader#initialize") {"Process HTML script block"} @input = script - @metadata = Metadata.new(@input, @options.merge(filenames: @options[:base])) + @metadata = Metadata.new(@input, filenames: @options[:base], **@options) # If @metadata is for a Table, turn it into a TableGroup @metadata = @metadata.to_table_group if @metadata.is_a?(Table) @metadata.normalize! @@ -119,7 +119,7 @@ def script.content_type; "application/csvm+json"; end dialect.separator = "\t" if (input.content_type == "text/tsv" rescue nil) embed_options = @options.dup embed_options[:lang] = dialect_metadata.lang if dialect_metadata.lang - embedded_metadata = dialect.embedded_metadata(input, @options[:metadata], embed_options) + embedded_metadata = dialect.embedded_metadata(input, @options[:metadata], **embed_options) if (@metadata = @options[:metadata]) && @metadata.tableSchema @metadata.verify_compatible!(embedded_metadata) @@ -136,7 +136,7 @@ def script.content_type; "application/csvm+json"; end else # It's tabluar data. Find metadata and proceed as if it was specified in the first place @options[:original_input] = @input unless @options[:metadata] - @input = @metadata = Metadata.for_input(@input, @options).normalize! + @input = @metadata = Metadata.for_input(@input, **@options).normalize! end log_debug("Reader#initialize") {"input: #{input}, metadata: #{metadata.inspect}"} @@ -186,7 +186,7 @@ def each_statement(&block) if options[:original_input] && !input.describes_file?(options[:base_uri]) table_resource = RDF::Node.new add_statement(0, table_group, CSVW.table, table_resource) unless minimal? - Reader.new(options[:original_input], options.merge( + Reader.new(options[:original_input], **options.merge( metadata: input.tables.first, base: input.tables.first.url, no_found_metadata: true, @@ -205,7 +205,7 @@ def each_statement(&block) end.flatten.compact table_resource = table.id || RDF::Node.new add_statement(0, table_group, CSVW.table, table_resource) unless minimal? - Reader.open(table.url, options.merge( + Reader.open(table.url, **options.merge( metadata: table, base: table.url, no_found_metadata: true, @@ -421,9 +421,9 @@ def to_json(options = @options) res = if io ::JSON::dump_default_options = json_state - ::JSON.dump(self.send(hash_fn, options), io) + ::JSON.dump(self.send(hash_fn, **options), io) else - hash = self.send(hash_fn, options) + hash = self.send(hash_fn, **options) ::JSON.generate(hash, json_state) end @@ -443,7 +443,7 @@ def to_json(options = @options) # # @param [Hash{Symbol => Object}] options # @return [Hash, Array] - def to_hash(options = {}) + def to_hash(**options) # Construct metadata from that passed from file open, along with information from the file. if input.is_a?(Metadata) log_debug("each_statement: metadata") {input.inspect} @@ -467,13 +467,13 @@ def to_hash(options = {}) table_group['tables'] = tables if options[:original_input] && !input.describes_file?(options[:base_uri]) - Reader.new(options[:original_input], options.merge( + Reader.new(options[:original_input], **options.merge( metadata: input.tables.first, base: input.tables.first.url, minimal: minimal?, no_found_metadata: true, )) do |r| - case t = r.to_hash(options) + case t = r.to_hash(**options) when Array then tables += t unless input.tables.first.suppressOutput when Hash then tables << t unless input.tables.first.suppressOutput end @@ -481,13 +481,13 @@ def to_hash(options = {}) else input.each_table do |table| next if table.suppressOutput && !validate? - Reader.open(table.url, options.merge( + Reader.open(table.url, **options.merge( metadata: table, base: table.url, minimal: minimal?, no_found_metadata: true, )) do |r| - case t = r.to_hash(options) + case t = r.to_hash(**options) when Array then tables += t unless table.suppressOutput when Hash then tables << t unless table.suppressOutput end @@ -560,7 +560,7 @@ def to_hash(options = {}) co['@id'] = subject.to_s unless subject == 'null' prop = case cell.propertyUrl when RDF.type then '@type' - when nil then URI.decode(column.name) # Use URI-decoded name + when nil then CGI.unescape(column.name) # Use URI-decoded name else # Compact the property to a term or prefixed name metadata.context.compact_iri(cell.propertyUrl, vocab: true) diff --git a/script/parse b/script/parse index bfbcf4a..fa8f945 100755 --- a/script/parse +++ b/script/parse @@ -10,7 +10,7 @@ end require 'rdf/tabular' require 'getoptlong' -def run(input, options) +def run(input, **options) reader_class = RDF::Reader.for(options[:input_format].to_sym) raise "Reader not found for #{options[:input_format]}" unless reader_class @@ -81,10 +81,10 @@ end if ARGV.empty? s = input ? input : $stdin.read - run(StringIO.new(s), options) + run(StringIO.new(s), **options) else ARGV.each do |test_file| - run(test_file, options) + run(test_file, **options) end end puts diff --git a/script/tc b/script/tc index 2da3aba..dbce5d7 100755 --- a/script/tc +++ b/script/tc @@ -33,7 +33,7 @@ def earl_preamble(options) ) end -def run_tc(t, options) +def run_tc(t, **options) STDERR.write "run #{t.id}" if options[:verbose] @@ -202,7 +202,7 @@ result_count = {} Fixtures::SuiteTest::Manifest.open(manifest, manifest[0..-8]) do |m| m.entries.each do |t| next unless ARGV.empty? || ARGV.any? {|n| t.id.match(/#{n}/)} - run_tc(t, options.merge(manifest: manifest, result_count: result_count)) + run_tc(t, **options.merge(manifest: manifest, result_count: result_count)) end end end diff --git a/spec/metadata_spec.rb b/spec/metadata_spec.rb index 8fed82e..e7b160b 100644 --- a/spec/metadata_spec.rb +++ b/spec/metadata_spec.rb @@ -874,7 +874,7 @@ options ||= {} options[:logger] = logger options[:context] ||= 'http://www.w3.org/ns/csvw' - expect(described_class.new(input, options)).to be_a(klass) + expect(described_class.new(input, **options)).to be_a(klass) expect(logger.to_s).not_to match(/ERROR|WARN/) end end @@ -1379,7 +1379,7 @@ context "Unsupported datatypes" do %w(anyType anySimpleType ENTITIES IDREFS NMTOKENS ENTITY ID IDREF NOTATAION foo).each do |base| it "detects #{base} as unsupported" do - md = RDF::Tabular::Table.new({ + RDF::Tabular::Table.new({ url: "http://example.com/table.csv", tableSchema: { columns: [{ diff --git a/spec/suite_helper.rb b/spec/suite_helper.rb index a56eb04..5f79e9e 100644 --- a/spec/suite_helper.rb +++ b/spec/suite_helper.rb @@ -23,7 +23,7 @@ class << self # HTTP Request headers. # @return [IO] File stream # @yield [IO] File stream - def self.open_file(filename_or_url, options = {}, &block) + def self.open_file(filename_or_url, **options, &block) case when filename_or_url.to_s =~ /^file:/ path = filename_or_url.to_s[5..-1] @@ -73,7 +73,7 @@ def self.open_file(filename_or_url, options = {}, &block) end end else - original_open_file(filename_or_url, options) do |remote_document| + original_open_file(filename_or_url, **options) do |remote_document| # Add Link header, if necessary remote_document.headers[:link] = options[:httpLink] if options[:httpLink] diff --git a/spec/suite_spec.rb b/spec/suite_spec.rb index e39f1f4..715608b 100644 --- a/spec/suite_spec.rb +++ b/spec/suite_spec.rb @@ -25,11 +25,10 @@ t.logger.info "source:\n#{t.input}" begin RDF::Tabular::Reader.open(t.action, - t.reader_options.merge( - base_uri: t.base, - validate: t.validation?, - logger: t.logger, - ) + base_uri: t.base, + validate: t.validation?, + logger: t.logger, + **t.reader_options ) do |reader| expect(reader).to be_a RDF::Reader From 75d4ef22a1c64fb9a09d4e6c6efec88a0d2ac2a8 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 15 Dec 2019 18:21:59 -0800 Subject: [PATCH 2/4] Remove some worthless specs which misused named arguments. --- spec/metadata_spec.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/spec/metadata_spec.rb b/spec/metadata_spec.rb index e7b160b..fafa674 100644 --- a/spec/metadata_spec.rb +++ b/spec/metadata_spec.rb @@ -838,12 +838,6 @@ ":type Schema" => [{}, {type: :Schema}, RDF::Tabular::Schema], ":type Column" => [{}, {type: :Column}, RDF::Tabular::Column], ":type Dialect" => [{}, {type: :Dialect}, RDF::Tabular::Dialect], - "@type TableGroup" => [{}, {"@type" => "TableGroup"}, RDF::Tabular::TableGroup], - "@type Table" => [{"@type" => "Table"}, RDF::Tabular::Table], - "@type Template" => [{"@type" => "Template"}, RDF::Tabular::Transformation], - "@type Schema" => [{"@type" => "Schema"}, RDF::Tabular::Schema], - "@type Column" => [{"@type" => "Column"}, RDF::Tabular::Column], - "@type Dialect" => [{"@type" => "Dialect"}, RDF::Tabular::Dialect], "tables TableGroup" => [{"tables" => []}, RDF::Tabular::TableGroup], "dialect Table" => [{"dialect" => {}}, RDF::Tabular::Table], "tableSchema Table" => [{"tableSchema" => {}}, RDF::Tabular::Table], From 1e8a9f58cbd675e556bd46a411f5c34b27852c59 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 15 Dec 2019 18:29:23 -0800 Subject: [PATCH 3/4] Update version to 3.1.0. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b1b25a5..fd2a018 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.2 +3.1.0 From 9b4754d6d736beb58bab4ab024d3a7796a15ac56 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 16 Dec 2019 13:51:35 -0800 Subject: [PATCH 4/4] Update dependencies. --- rdf-tabular.gemspec | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/rdf-tabular.gemspec b/rdf-tabular.gemspec index 6c2c427..e6e8982 100755 --- a/rdf-tabular.gemspec +++ b/rdf-tabular.gemspec @@ -23,19 +23,18 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 2.2.2' gem.requirements = [] gem.add_runtime_dependency 'bcp47', '~> 0.3', '>= 0.3.3' - gem.add_runtime_dependency 'rdf', '~> 3.0' - gem.add_runtime_dependency 'rdf-vocab', '~> 3.0' - gem.add_runtime_dependency 'rdf-xsd', '~> 3.0' - #gem.add_runtime_dependency 'json-ld', '~> 3.0' - gem.add_runtime_dependency 'json-ld', '>= 2.1', '< 4.0' + gem.add_runtime_dependency 'rdf', '~> 3.1' + gem.add_runtime_dependency 'rdf-vocab', '~> 3.1' + gem.add_runtime_dependency 'rdf-xsd', '~> 3.1' + gem.add_runtime_dependency 'json-ld', '~> 3.1' gem.add_runtime_dependency 'addressable', '~> 2.3' gem.add_development_dependency 'nokogiri', '~> 1.8' gem.add_development_dependency 'rspec', '~> 3.7' gem.add_development_dependency 'rspec-its', '~> 1.2' - gem.add_development_dependency 'rdf-isomorphic', '~> 3.0' - gem.add_development_dependency 'rdf-spec', '~> 3.0' - gem.add_development_dependency 'rdf-turtle', '~> 3.0' - gem.add_development_dependency 'sparql', '~> 3.0' + gem.add_development_dependency 'rdf-isomorphic', '~> 3.1' + gem.add_development_dependency 'rdf-spec', '~> 3.1' + gem.add_development_dependency 'rdf-turtle', '~> 3.1' + gem.add_development_dependency 'sparql', '~> 3.1' gem.add_development_dependency 'webmock', '~> 3.0' gem.add_development_dependency 'yard' , '~> 0.9.12'