diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7366f03..e73fa8f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,14 @@ jobs: fail-fast: false matrix: os: [ "ubuntu-22.04", "macos-15-intel" ] # , windows-latest ] - ruby-version: [ "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2" ] + ruby-version: [ + "2.6", + "2.7", + "3.0", + "3.1", + "3.2", + "3.3", + ] name: Ruby ${{ matrix.ruby-version }} on OS ${{ matrix.os }} steps: diff --git a/.gitignore b/.gitignore index 34c3268..c89f452 100644 --- a/.gitignore +++ b/.gitignore @@ -21,5 +21,6 @@ log/crate.log crate_test_server.* crate-*.tar.gz parts/ +vendor/ .byebug_history diff --git a/.rubocop.yml b/.rubocop.yml index 3240022..2fc2808 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,4 +4,4 @@ require: rubocop-rspec AllCops: NewCops: enable - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 diff --git a/DEVELOP.rst b/DEVELOP.rst index 138e5dc..23e82eb 100644 --- a/DEVELOP.rst +++ b/DEVELOP.rst @@ -17,6 +17,9 @@ Then, run tests:: $ bundle exec rspec +Linter +====== + Run linter:: $ bundle exec rubocop @@ -25,6 +28,13 @@ Update linter violations file:: $ bundle exec rubocop --auto-gen-config +Dependencies +============ + +Update lock file ``Gemfile.lock``:: + + $ bundle update + Preparing a Release =================== diff --git a/Gemfile.lock b/Gemfile.lock index 7bbc7df..4f7a8a6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,62 +6,65 @@ PATH GEM remote: https://rubygems.org/ specs: - ast (2.4.2) - diff-lcs (1.5.1) + ast (2.4.3) + base64 (0.3.0) + diff-lcs (1.6.2) + json (2.18.1) os (1.1.4) - parallel (1.22.1) - parser (3.1.3.0) + parallel (1.27.0) + parser (3.3.10.1) ast (~> 2.4.1) + racc + prism (1.9.0) + racc (1.8.1) rainbow (3.1.1) - rake (13.2.1) - regexp_parser (2.6.1) - rexml (3.2.5) - rspec (3.13.0) + regexp_parser (2.11.3) + rexml (3.4.4) + rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.2) + rspec-core (3.13.6) rspec-support (~> 3.13.0) - rspec-expectations (3.13.3) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.2) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-support (3.13.2) - rubocop (1.12.1) + rspec-support (3.13.7) + rubocop (1.39.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.2.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.23.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.23.0) - parser (>= 3.1.1.0) - rubocop-rake (0.5.1) - rubocop - rubocop-rspec (2.3.0) - rubocop (~> 1.0) - rubocop-ast (>= 1.1.0) - ruby-progressbar (1.11.0) - unicode-display_width (2.3.0) + rubocop-ast (1.49.0) + parser (>= 3.3.7.2) + prism (~> 1.7) + rubocop-rspec (2.17.1) + rubocop (~> 1.33) + ruby-progressbar (1.13.0) + unicode-display_width (2.6.0) PLATFORMS x86_64-darwin-17 x86_64-darwin-19 x86_64-darwin-20 + x86_64-darwin-23 x86_64-linux DEPENDENCIES + base64 bundler crate_ruby! os - rake rspec (~> 3.10) - rubocop (< 1.13) - rubocop-rake + rubocop (< 1.40) rubocop-rspec BUNDLED WITH diff --git a/crate_ruby.gemspec b/crate_ruby.gemspec index c872941..d8e44dc 100644 --- a/crate_ruby.gemspec +++ b/crate_ruby.gemspec @@ -33,11 +33,10 @@ Gem::Specification.new do |spec| spec.description = 'A Ruby library for the CrateDB HTTP interface with query support, DDL command and schema introspection shortcuts, and support for BLOB tables.' spec.homepage = 'https://crate.io' spec.license = 'Apache-2.0' - spec.required_ruby_version = '>= 2.4' + spec.required_ruby_version = '>= 2.5' spec.files = Dir['lib/**/*'] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = %w[lib] spec.extra_rdoc_files = Dir['README.rst', 'CHANGES.rst', 'LICENSE', 'NOTICE'] spec.rdoc_options += [ @@ -53,14 +52,14 @@ Gem::Specification.new do |spec| 'changelog_uri' => 'https://github.com/crate/crate_ruby/blob/main/CHANGES.rst', 'documentation_uri' => 'https://www.rubydoc.info/gems/crate_ruby', 'homepage_uri' => spec.homepage, - 'source_code_uri' => 'https://github.com/crate/crate_ruby' + 'source_code_uri' => 'https://github.com/crate/crate_ruby', + 'rubygems_mfa_required' => 'true' } + spec.add_development_dependency 'base64' spec.add_development_dependency 'bundler' spec.add_development_dependency 'os' - spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 3.10' - spec.add_development_dependency 'rubocop', '< 1.13' - spec.add_development_dependency 'rubocop-rake' + spec.add_development_dependency 'rubocop', '< 1.40' spec.add_development_dependency 'rubocop-rspec' end diff --git a/spec/bootstrap.rb b/spec/bootstrap.rb index e7eab94..ec00621 100755 --- a/spec/bootstrap.rb +++ b/spec/bootstrap.rb @@ -58,9 +58,7 @@ def download Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http| request = Net::HTTP::Get.new uri resp = http.request request - File.open(@fname, 'wb') do |file| - file.write(resp.body) - end + File.binwrite(@fname, resp.body) end end diff --git a/spec/crate_ruby/client_spec.rb b/spec/crate_ruby/client_spec.rb index 1ea93d1..a2ab065 100644 --- a/spec/crate_ruby/client_spec.rb +++ b/spec/crate_ruby/client_spec.rb @@ -72,9 +72,7 @@ it 'downloads a blob' do data = client.blob_get(blob_table, digest) expect(data).to be_truthy - File.open(store_location, 'wb') do |file| - file.write(data) - end + File.binwrite(store_location, data) end end @@ -85,7 +83,8 @@ end it 'deletes a blob' do - client.blob_delete(blob_table, digest) + response = client.blob_delete(blob_table, digest) + expect(response).to be_falsy end end end @@ -95,7 +94,7 @@ before do client.execute("create table #{table_name} " \ - '(id integer primary key, name string, address object, tags array(string)) ') + '(id integer primary key, name string, address object, tags array(string)) ') end after do