diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03b2cce..4a7f98d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,11 @@ on: jobs: rspec: runs-on: ubuntu-latest + if: ${{ !contains(github.event.head_commit.message, 'skip-ci') }} strategy: fail-fast: false matrix: - ruby-version: ['3.1', '3.2', '3.3', '3.4'] + ruby-version: ['3.1', '3.2', '3.3', '3.4', '4.0'] steps: - uses: actions/checkout@v4 @@ -35,6 +36,7 @@ jobs: rspec_each: runs-on: ubuntu-latest + if: ${{ !contains(github.event.head_commit.message, 'skip-ci') }} steps: - uses: actions/checkout@v4 @@ -52,6 +54,7 @@ jobs: rubocop: runs-on: ubuntu-latest + if: ${{ !contains(github.event.head_commit.message, 'skip-ci') }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index 85127b0..f8cc49c 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -27,7 +27,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '3.3' + ruby-version: '3.4' bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Setup Pages diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d44722d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Build Options -language: ruby -rvm: - - 2.6.8 - - 2.7.4 - - 3.0.2 -before_install: - - sudo apt-get update && sudo apt-get install apt-transport-https ca-certificates -y && sudo update-ca-certificates -before_script: - - cp .rspec.example .rspec -script: - - bundle exec thor ci:steps - -# Travis-CI Configuration -cache: bundler -dist: focal diff --git a/Gemfile b/Gemfile index 9cee559..deac34a 100644 --- a/Gemfile +++ b/Gemfile @@ -10,10 +10,10 @@ group :development, :test do gem 'byebug', '~> 11.1' gem 'rspec', '~> 3.13' - gem 'rspec-sleeping_king_studios', '~> 2.8.0' + gem 'rspec-sleeping_king_studios', '~> 2.8', '>= 2.8.3' - gem 'rubocop', '~> 1.75' - gem 'rubocop-rspec', '~> 3.6' + gem 'rubocop', '~> 1.82' + gem 'rubocop-rspec', '~> 3.8' gem 'simplecov', '~> 0.22' end @@ -25,7 +25,9 @@ group :docs do # Use Kramdown to parse GFM-dialect Markdown. gem 'kramdown-parser-gfm', '~> 1.1' - gem 'sleeping_king_studios-docs', '~> 0.1' + gem 'sleeping_king_studios-docs', + branch: 'chore/ruby-4-0', + git: 'https://github.com/sleepingkingstudios/sleeping_king_studios-docs' # Use Webrick as local content server. gem 'webrick', '~> 1.8' diff --git a/cuprum.gemspec b/cuprum.gemspec index 8003d93..176994f 100644 --- a/cuprum.gemspec +++ b/cuprum.gemspec @@ -1,8 +1,6 @@ # frozen_string_literal: true -$LOAD_PATH << './lib' - -require 'cuprum/version' +require_relative 'lib/cuprum/version' Gem::Specification.new do |gem| gem.name = 'cuprum' @@ -27,9 +25,9 @@ Gem::Specification.new do |gem| 'rubygems_mfa_required' => 'true' } - gem.required_ruby_version = '~> 3.1' + gem.required_ruby_version = ['>= 3.1', '< 5'] gem.require_path = 'lib' gem.files = Dir['lib/**/*.rb', 'LICENSE', '*.md'] - gem.add_runtime_dependency 'sleeping_king_studios-tools', '~> 1.2' + gem.add_runtime_dependency 'sleeping_king_studios-tools', '~> 1.2', '>= 1.2.1' end diff --git a/docs/versions/1.1/index.md b/docs/versions/1.1/index.md index 261b310..35f976c 100644 --- a/docs/versions/1.1/index.md +++ b/docs/versions/1.1/index.md @@ -38,3 +38,5 @@ Cuprum defines the following core components: Define handling for results based on `#status`, `#error`, and `#value`. For a full list of defined classes and objects, see [Reference](./reference). + +{% include breadcrumbs.md %} diff --git a/docs/versions/1.1/reference/index.md b/docs/versions/1.1/reference/index.md new file mode 100644 index 0000000..cb3d6a2 --- /dev/null +++ b/docs/versions/1.1/reference/index.md @@ -0,0 +1,18 @@ +--- +breadcrumbs: + - name: Documentation + path: '../../../' + - name: Versions + path: '../../' + - name: '1.1' + path: '../' +version: '1.1' +--- + +{% assign root_namespace = site.namespaces | where: "version", page.version | first %} + +# Cuprum Reference + +{% include reference/namespace.md label=false namespace=root_namespace %} + +{% include breadcrumbs.md %} diff --git a/docs/versions/1.2/index.md b/docs/versions/1.2/index.md index 419d070..40ccddf 100644 --- a/docs/versions/1.2/index.md +++ b/docs/versions/1.2/index.md @@ -38,3 +38,5 @@ Cuprum defines the following core components: Define handling for results based on `#status`, `#error`, and `#value`. For a full list of defined classes and objects, see [Reference](./reference). + +{% include breadcrumbs.md %} diff --git a/docs/versions/1.2/reference/index.md b/docs/versions/1.2/reference/index.md new file mode 100644 index 0000000..7289e88 --- /dev/null +++ b/docs/versions/1.2/reference/index.md @@ -0,0 +1,18 @@ +--- +breadcrumbs: + - name: Documentation + path: '../../../' + - name: Versions + path: '../../' + - name: '1.2' + path: '../' +version: '1.2' +--- + +{% assign root_namespace = site.namespaces | where: "version", page.version | first %} + +# Cuprum Reference + +{% include reference/namespace.md label=false namespace=root_namespace %} + +{% include breadcrumbs.md %} diff --git a/docs/versions/1.3/index.md b/docs/versions/1.3/index.md index 0a86d1a..5ce8d4a 100644 --- a/docs/versions/1.3/index.md +++ b/docs/versions/1.3/index.md @@ -38,3 +38,5 @@ Cuprum defines the following core components: Define handling for results based on `#status`, `#error`, and `#value`. For a full list of defined classes and objects, see [Reference](./reference). + +{% include breadcrumbs.md %} diff --git a/docs/versions/1.3/reference/index.md b/docs/versions/1.3/reference/index.md new file mode 100644 index 0000000..b1ea37f --- /dev/null +++ b/docs/versions/1.3/reference/index.md @@ -0,0 +1,18 @@ +--- +breadcrumbs: + - name: Documentation + path: '../../../' + - name: Versions + path: '../../' + - name: '1.3' + path: '../' +version: '1.3' +--- + +{% assign root_namespace = site.namespaces | where: "version", page.version | first %} + +# Cuprum Reference + +{% include reference/namespace.md label=false namespace=root_namespace %} + +{% include breadcrumbs.md %} diff --git a/lib/cuprum/result.rb b/lib/cuprum/result.rb index 5c9d59f..b7a3376 100644 --- a/lib/cuprum/result.rb +++ b/lib/cuprum/result.rb @@ -77,7 +77,7 @@ def defined_statuses self.class::STATUSES end - def deprecated_compare(other) + def deprecated_compare(other) # rubocop:disable Naming/PredicateMethod unless %i[value status error].all? { |sym| other.respond_to?(sym) } return false end diff --git a/lib/cuprum/rspec/be_a_result_matcher.rb b/lib/cuprum/rspec/be_a_result_matcher.rb index 3cc4d9b..730d15f 100644 --- a/lib/cuprum/rspec/be_a_result_matcher.rb +++ b/lib/cuprum/rspec/be_a_result_matcher.rb @@ -104,7 +104,7 @@ def description # @param actual [Object] the actual object to match. # # @return [Boolean] false if the actual object is a result; otherwise true. - def does_not_match?(actual) # rubocop:disable Naming/PredicateName + def does_not_match?(actual) # rubocop:disable Naming/PredicatePrefix @actual = actual raise ArgumentError, negated_matcher_warning if expected_properties? @@ -210,7 +210,7 @@ def actual_is_uncalled_operation? result.error.is_a?(Cuprum::Errors::OperationNotCalled) end - def compare_items(expected, actual) + def compare_items(expected, actual) # rubocop:disable Naming/PredicateMethod return expected.matches?(actual) if expected.respond_to?(:matches?) expected == actual diff --git a/spec/cuprum/result/with_custom_status_spec.rb b/spec/cuprum/result/with_custom_status_spec.rb index aaf3780..bd43eba 100644 --- a/spec/cuprum/result/with_custom_status_spec.rb +++ b/spec/cuprum/result/with_custom_status_spec.rb @@ -105,7 +105,7 @@ 'status: :halted' => :halted, 'status: :success' => :success } - default_scenarios = { + default_scenarios = { # rubocop:disable RSpec/LeakyLocalVariable value: value_scenarios, error: error_scenarios, status: status_scenarios @@ -121,7 +121,7 @@ default_scenarios wrap_context 'when the result has a value' do - all_scenarios = { + all_scenarios = { # rubocop:disable RSpec/LeakyLocalVariable value: value_scenarios.merge('a matching value' => 'returned value'), error: error_scenarios, status: status_scenarios.merge('status: :halted' => :halted) @@ -149,7 +149,7 @@ end wrap_context 'when the result has an error' do - all_scenarios = { + all_scenarios = { # rubocop:disable RSpec/LeakyLocalVariable value: value_scenarios, error: error_scenarios.merge( 'a matching error' => Cuprum::Error.new( @@ -184,7 +184,7 @@ include_context 'when the result has a value' include_context 'when the result has an error' - all_scenarios = { + all_scenarios = { # rubocop:disable RSpec/LeakyLocalVariable value: value_scenarios.merge('a matching value' => 'returned value'), error: error_scenarios.merge( 'a matching error' => Cuprum::Error.new( diff --git a/spec/cuprum/result_spec.rb b/spec/cuprum/result_spec.rb index 53f46ec..b19bf25 100644 --- a/spec/cuprum/result_spec.rb +++ b/spec/cuprum/result_spec.rb @@ -83,7 +83,7 @@ 'status: :failure' => :failure, 'status: :success' => :success } - default_scenarios = { + default_scenarios = { # rubocop:disable RSpec/LeakyLocalVariable value: value_scenarios, error: error_scenarios, status: status_scenarios @@ -99,7 +99,7 @@ default_scenarios wrap_context 'when the result has a value' do - all_scenarios = { + all_scenarios = { # rubocop:disable RSpec/LeakyLocalVariable value: value_scenarios.merge('a matching value' => 'returned value'), error: error_scenarios, status: status_scenarios @@ -122,7 +122,7 @@ end wrap_context 'when the result has an error' do - all_scenarios = { + all_scenarios = { # rubocop:disable RSpec/LeakyLocalVariable value: value_scenarios, error: error_scenarios.merge( 'a matching error' => Cuprum::Error.new( @@ -152,7 +152,7 @@ include_context 'when the result has a value' include_context 'when the result has an error' - all_scenarios = { + all_scenarios = { # rubocop:disable RSpec/LeakyLocalVariable value: value_scenarios.merge('a matching value' => 'returned value'), error: error_scenarios.merge( 'a matching error' => Cuprum::Error.new(