From acd098a5705fbaa3266763b5397eae57f0de78ea Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 11 Dec 2019 14:51:24 -0800 Subject: [PATCH 1/2] Update some options usage to be compatible with Ruby 2.7. --- .travis.yml | 14 +++++--------- README.md | 6 +++--- VERSION | 2 +- lib/sxp.rb | 18 +++++++++--------- lib/sxp/reader.rb | 6 +++--- lib/sxp/reader/common_lisp.rb | 4 ++-- lib/sxp/reader/sparql.rb | 2 +- spec/common_lisp_spec.rb | 8 ++++---- spec/reader_spec.rb | 8 ++++---- spec/scheme_spec.rb | 8 ++++---- spec/sparql_spec.rb | 8 ++++---- sxp.gemspec | 9 ++++----- 12 files changed, 44 insertions(+), 49 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43881d7..790f037 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,19 @@ 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: - CI=true rvm: - - 2.2.2 - - 2.3 - 2.4 - 2.5 - 2.6 - - jruby-9 - - rbx-3 + - 2.7 + - jruby + - rbx cache: bundler sudo: false matrix: allow_failures: - - rvm: jruby-9 - - rvm: rbx-3 + - rvm: jruby + - rvm: rbx dist: trusty diff --git a/README.md b/README.md index f94cc2e..aac470d 100755 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This is a Ruby implementation of a universal [S-expression][] parser. * Parses S-expressions in universal, [Scheme][], [Common Lisp][], or [SPARQL][] syntax. * Adds a `#to_sxp` method to Ruby objects. -* Compatible with Ruby >= 2.2.2, Rubinius >= 3.0, and JRuby 9+. +* Compatible with Ruby >= 2.4, Rubinius >= 3.0, and JRuby 9+. ## Examples @@ -74,8 +74,8 @@ This is a Ruby implementation of a universal [S-expression][] parser. Dependencies ------------ -* [Ruby](http://ruby-lang.org/) (>= 2.2.2) -* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.0), only needed for SPARQL +* [Ruby](http://ruby-lang.org/) (>= 2.4) +* [RDF.rb](http://rubygems.org/gems/rdf) (~> 3.1), only needed for SPARQL S-expressions Installation diff --git a/VERSION b/VERSION index 6d7de6e..9084fa2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.2 +1.1.0 diff --git a/lib/sxp.rb b/lib/sxp.rb index 572f935..74b4017 100644 --- a/lib/sxp.rb +++ b/lib/sxp.rb @@ -32,8 +32,8 @@ module SXP # @param [String, #to_s] url # @param [Hash{Symbol => Object}] options # @return [Enumerable] - def self.read_url(url, options = {}) - Reader::Basic.read_url(url, options) + def self.read_url(url, **options) + Reader::Basic.read_url(url, **options) end ## @@ -42,7 +42,7 @@ def self.read_url(url, options = {}) # @overload read_files(*filenames) # @param [Enumerable] filenames # - # @overload read_files(*filenames, options) + # @overload read_files(*filenames, **options) # @param [Enumerable] filenames # @param [Hash{Symbol => Object}] options # @@ -57,8 +57,8 @@ def self.read_files(*filenames) # @param [String, #to_s] filename # @param [Hash{Symbol => Object}] options # @return [Enumerable] - def self.read_file(filename, options = {}) - Reader::Basic.read_file(filename, options) + def self.read_file(filename, **options) + Reader::Basic.read_file(filename, **options) end ## @@ -67,8 +67,8 @@ def self.read_file(filename, options = {}) # @param [IO, StringIO, String] input # @param [Hash{Symbol => Object}] options # @return [Enumerable] - def self.read_all(input, options = {}) - Reader::Basic.read_all(input, options) + def self.read_all(input, **options) + Reader::Basic.read_all(input, **options) end ## @@ -77,8 +77,8 @@ def self.read_all(input, options = {}) # @param [IO, StringIO, String] input # @param [Hash{Symbol => Object}] options # @return [Object] - def self.read(input, options = {}) - Reader::Basic.read(input, options) + def self.read(input, **options) + Reader::Basic.read(input, **options) end ## diff --git a/lib/sxp/reader.rb b/lib/sxp/reader.rb index 6c1c52f..64fdc25 100644 --- a/lib/sxp/reader.rb +++ b/lib/sxp/reader.rb @@ -24,7 +24,7 @@ class EOF < Error; end # @return [Enumerable] def self.read_url(url, **options) require 'open-uri' - open(url.to_s, 'rb', nil, **options) { |io| read_all(io, options) } + open(url.to_s, 'rb', nil, **options) { |io| read_all(io, **options) } end ## @@ -33,7 +33,7 @@ def self.read_url(url, **options) # @overload read_files(*filenames) # @param [Enumerable] filenames # - # @overload read_files(*filenames, options) + # @overload read_files(*filenames, **options) # @param [Enumerable] filenames # @param [Hash{Symbol => Object}] options # See {#read} @@ -41,7 +41,7 @@ def self.read_url(url, **options) # @return [Enumerable] def read_files(*filenames) options = filenames.last.is_a?(Hash) ? filenames.pop : {} - filenames.map { |filename| read_file(filename, options) }.inject { |sxps, sxp| sxps + sxp } + filenames.map { |filename| read_file(filename, **options) }.inject { |sxps, sxp| sxps + sxp } end ## diff --git a/lib/sxp/reader/common_lisp.rb b/lib/sxp/reader/common_lisp.rb index d12d9c2..d1a2b1d 100644 --- a/lib/sxp/reader/common_lisp.rb +++ b/lib/sxp/reader/common_lisp.rb @@ -37,8 +37,8 @@ class CommonLisp < Basic # @option options [Object] :t (true) # @option options [Object] :quote (:quote) # @option options [Object] :function (:function) - def initialize(input, options = {}, &block) - super(input, OPTIONS.merge(options), &block) + def initialize(input, **options, &block) + super(input, **OPTIONS.merge(options), &block) end ## diff --git a/lib/sxp/reader/sparql.rb b/lib/sxp/reader/sparql.rb index 87594da..41f015a 100644 --- a/lib/sxp/reader/sparql.rb +++ b/lib/sxp/reader/sparql.rb @@ -162,7 +162,7 @@ def read_rdf_literal {datatype: read_token.last} else {} end - RDF::Literal(value, options) + RDF::Literal(value, **options) end ## diff --git a/spec/common_lisp_spec.rb b/spec/common_lisp_spec.rb index 3345ce2..ce9521f 100644 --- a/spec/common_lisp_spec.rb +++ b/spec/common_lisp_spec.rb @@ -120,11 +120,11 @@ end end - def read(input, options = {}) - SXP::Reader::CommonLisp.new(input.freeze, options.freeze).read + def read(input, **options) + SXP::Reader::CommonLisp.new(input.freeze, **options.freeze).read end - def read_all(input, options = {}) - SXP::Reader::CommonLisp.new(input.freeze, options.freeze).read_all + def read_all(input, **options) + SXP::Reader::CommonLisp.new(input.freeze, **options.freeze).read_all end end diff --git a/spec/reader_spec.rb b/spec/reader_spec.rb index 82c19b8..61f3bd6 100644 --- a/spec/reader_spec.rb +++ b/spec/reader_spec.rb @@ -68,11 +68,11 @@ expect(SXP.read_file("http://example/foo.sxp")).to eq [[1, 2, 3], [4, 5, 6]] end - def read(input, options = {}) - SXP::Reader::Basic.read(input.freeze, options) + def read(input, **options) + SXP::Reader::Basic.read(input.freeze, **options) end - def read_all(input, options = {}) - SXP::Reader::Basic.read_all(input.freeze, options) + def read_all(input, **options) + SXP::Reader::Basic.read_all(input.freeze, **options) end end diff --git a/spec/scheme_spec.rb b/spec/scheme_spec.rb index d6e5219..5fbdf4e 100644 --- a/spec/scheme_spec.rb +++ b/spec/scheme_spec.rb @@ -178,11 +178,11 @@ end end - def read(input, options = {}) - SXP::Reader::Scheme.new(input.freeze, options.freeze).read + def read(input, **options) + SXP::Reader::Scheme.new(input.freeze, **options.freeze).read end - def read_all(input, options = {}) - SXP::Reader::Scheme.new(input.freeze, options.freeze).read_all + def read_all(input, **options) + SXP::Reader::Scheme.new(input.freeze, **options.freeze).read_all end end diff --git a/spec/sparql_spec.rb b/spec/sparql_spec.rb index ccc2b8c..5ed11d3 100644 --- a/spec/sparql_spec.rb +++ b/spec/sparql_spec.rb @@ -292,11 +292,11 @@ end end - def read(input, options = {}) - SXP::Reader::SPARQL.new(input, options).read + def read(input, **options) + SXP::Reader::SPARQL.new(input, **options).read end - def read_all(input, options = {}) - SXP::Reader::SPARQL.new(input.freeze, options).read_all + def read_all(input, **options) + SXP::Reader::SPARQL.new(input.freeze, **options).read_all end end diff --git a/sxp.gemspec b/sxp.gemspec index 39e3951..9e4547e 100755 --- a/sxp.gemspec +++ b/sxp.gemspec @@ -10,7 +10,6 @@ Gem::Specification.new do |gem| gem.license = 'Unlicense' gem.summary = 'A pure-Ruby implementation of a universal S-expression parser.' gem.description = 'Universal S-expression parser with specific support for Common Lisp, Scheme, and RDF/SPARQL' - gem.rubyforge_project = 'sxp' gem.author = ['Arto Bendiken', 'Gregg Kellogg'] gem.email = ['arto@bendiken.net', 'gregg@greggkellogg.net'] @@ -21,11 +20,11 @@ Gem::Specification.new do |gem| gem.executables = %w(sxp2rdf sxp2json sxp2xml sxp2yaml) gem.require_paths = %w(lib) - gem.required_ruby_version = '>= 2.2.2' + gem.required_ruby_version = '>= 2.4' gem.requirements = [] - gem.add_development_dependency 'rspec', '~> 3.8' - gem.add_development_dependency 'yard' , '~> 0.9.18' - gem.add_runtime_dependency 'rdf', '~> 3.0' + gem.add_development_dependency 'rspec', '~> 3.9' + gem.add_development_dependency 'yard' , '~> 0.9.20' + gem.add_runtime_dependency 'rdf', '~> 3.1' gem.post_install_message = nil end From ef490377fdf0d65a075a5311aaed61355694fb58 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sat, 14 Dec 2019 10:41:46 -0800 Subject: [PATCH 2/2] Fix bundler args in travis. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 790f037..4ed71ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,4 @@ language: ruby -bundler_args: --without debug script: "bundle exec rspec spec" env: - CI=true