From bb3299effd2179e3538c99429571852d641f2eb3 Mon Sep 17 00:00:00 2001 From: Masataka Pocke Kuwabara Date: Thu, 3 Mar 2022 15:16:07 +0900 Subject: [PATCH 01/19] Separate RBS files to `_internal` directory to avoid exposing RBS --- sig/lib/_internal/rails.rbs | 10 ++++++++++ sig/lib/_rails.rbs | 31 +++++++++++-------------------- 2 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 sig/lib/_internal/rails.rbs diff --git a/sig/lib/_internal/rails.rbs b/sig/lib/_internal/rails.rbs new file mode 100644 index 00000000..4ce8f78a --- /dev/null +++ b/sig/lib/_internal/rails.rbs @@ -0,0 +1,10 @@ +class ::Hash[unchecked out K, unchecked out V] + def with_indifferent_access: () -> instance + def deep_merge!: (instance other) -> self +end + +class ::Object + def presence: () -> String? + def blank?: () -> bool + def present?: () -> bool +end diff --git a/sig/lib/_rails.rbs b/sig/lib/_rails.rbs index 48c0e83f..81a22b1d 100644 --- a/sig/lib/_rails.rbs +++ b/sig/lib/_rails.rbs @@ -1,26 +1,17 @@ -class ::Hash[unchecked out K, unchecked out V] - def with_indifferent_access: () -> instance - def deep_merge!: (instance other) -> self -end - -class ::Object - def presence: () -> String? - def blank?: () -> bool - def present?: () -> bool -end - -interface _ActionControllerBase - def render: (*untyped args) { () -> untyped } -> untyped -end +module MetaTags + interface _ActionControllerBase + def render: (*untyped args) { () -> untyped } -> untyped + end -interface _ActionViewBase - def tag: (String name, ?Hash[String | Symbol, untyped] options, ?bool open) -> void + interface _ActionViewBase + def tag: (String name, ?Hash[String | Symbol, untyped] options, ?bool open) -> void - def content_tag: (String name, String content, ?Hash[String | Symbol, untyped] options, ?bool open) -> void + def content_tag: (String name, String content, ?Hash[String | Symbol, untyped] options, ?bool open) -> void - def safe_join: (Array[String], String) -> String + def safe_join: (Array[String], String) -> String - def truncate: (String text, ?Hash[Symbol, untyped] options) -> String + def truncate: (String text, ?Hash[Symbol, untyped] options) -> String - def strip_tags: (String html) -> String + def strip_tags: (String html) -> String + end end From 79f0674b6064acfc98adea1d828735ab52d51eb7 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Thu, 30 Dec 2021 11:43:11 -0500 Subject: [PATCH 02/19] Added Ruby 3.1 to the build matrix --- .circleci/config.yml | 87 +++++++++++++++++++++++++++++++++------- .circleci/config.yml.erb | 11 +++-- 2 files changed, 80 insertions(+), 18 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f5d56103..b5d5b411 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -256,7 +256,7 @@ jobs: working_directory: ~/meta-tags/ruby27-rails-6.1.4 steps: *shared_build_steps - build-ruby27-rails-7_0_0_alpha2: + build-ruby27-rails-7_0_0: parameters: is_main_build: type: boolean @@ -264,10 +264,10 @@ jobs: docker: - image: circleci/ruby:2.7 environment: - RAILS_VERSION: 7.0.0.alpha2 + RAILS_VERSION: 7.0.0 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby27-rails-7.0.0.alpha2 + working_directory: ~/meta-tags/ruby27-rails-7.0.0 steps: *shared_build_steps build-ruby30-rails-6_0_4: @@ -294,11 +294,11 @@ jobs: environment: RAILS_VERSION: 6.1.4 ENABLE_CODE_COVERAGE: 1 - NO_STEEP: 0 + NO_STEEP: 1 working_directory: ~/meta-tags/ruby30-rails-6.1.4 steps: *shared_build_steps - build-ruby30-rails-7_0_0_alpha2: + build-ruby30-rails-7_0_0: parameters: is_main_build: type: boolean @@ -306,16 +306,58 @@ jobs: docker: - image: circleci/ruby:3.0 environment: - RAILS_VERSION: 7.0.0.alpha2 + RAILS_VERSION: 7.0.0 + ENABLE_CODE_COVERAGE: 1 + NO_STEEP: 1 + working_directory: ~/meta-tags/ruby30-rails-7.0.0 + steps: *shared_build_steps + + build-ruby31-rails-6_0_4: + parameters: + is_main_build: + type: boolean + default: false + docker: + - image: circleci/ruby:3.1 + environment: + RAILS_VERSION: 6.0.4 + ENABLE_CODE_COVERAGE: 1 + NO_STEEP: 1 + working_directory: ~/meta-tags/ruby31-rails-6.0.4 + steps: *shared_build_steps + + build-ruby31-rails-6_1_4: + parameters: + is_main_build: + type: boolean + default: false + docker: + - image: circleci/ruby:3.1 + environment: + RAILS_VERSION: 6.1.4 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby30-rails-7.0.0.alpha2 + working_directory: ~/meta-tags/ruby31-rails-6.1.4 + steps: *shared_build_steps + + build-ruby31-rails-7_0_0: + parameters: + is_main_build: + type: boolean + default: false + docker: + - image: circleci/ruby:3.1 + environment: + RAILS_VERSION: 7.0.0 + ENABLE_CODE_COVERAGE: 1 + NO_STEEP: 0 + working_directory: ~/meta-tags/ruby31-rails-7.0.0 steps: *shared_build_steps upload-coverage: docker: - - image: circleci/ruby:3.0 + - image: circleci/ruby:3.1 environment: CC_TEST_REPORTER_ID: 8792cbc0d1780830ddd3dd7eb1c25f09f386ba8f04449ad830039469406a6ab3 steps: @@ -325,7 +367,7 @@ jobs: - run: name: Uploading Code Coverage command: | - cd /tmp/workspace/ruby30-rails-6.1.4 + cd /tmp/workspace/ruby31-rails-7.0.0 ./cc-test-reporter upload-coverage --input coverage/codeclimate.coverage.json || true tests: docker: @@ -376,22 +418,31 @@ workflows: - build-ruby27-rails-6_1_4: is_main_build: false - - build-ruby27-rails-7_0_0_alpha2: + - build-ruby27-rails-7_0_0: is_main_build: false - build-ruby30-rails-6_0_4: is_main_build: false - build-ruby30-rails-6_1_4: - is_main_build: true + is_main_build: false + + - build-ruby30-rails-7_0_0: + is_main_build: false - - build-ruby30-rails-7_0_0_alpha2: + - build-ruby31-rails-6_0_4: is_main_build: false + - build-ruby31-rails-6_1_4: + is_main_build: false + + - build-ruby31-rails-7_0_0: + is_main_build: true + - upload-coverage: requires: - - build-ruby30-rails-6_1_4 + - build-ruby31-rails-7_0_0 - tests: requires: @@ -420,11 +471,17 @@ workflows: - build-ruby27-rails-6_1_4 - - build-ruby27-rails-7_0_0_alpha2 + - build-ruby27-rails-7_0_0 - build-ruby30-rails-6_0_4 - build-ruby30-rails-6_1_4 - - build-ruby30-rails-7_0_0_alpha2 + - build-ruby30-rails-7_0_0 + + - build-ruby31-rails-6_0_4 + + - build-ruby31-rails-6_1_4 + + - build-ruby31-rails-7_0_0 diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index c99f6021..9d6d4147 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -21,12 +21,17 @@ ['2.7', '5.2.6'], ['2.7', '6.0.4'], ['2.7', '6.1.4'], - ['2.7', '7.0.0.alpha2'], + ['2.7', '7.0.0'], # 3.0 ['3.0', '6.0.4'], - ['3.0', '6.1.4', true], - ['3.0', '7.0.0.alpha2'], + ['3.0', '6.1.4'], + ['3.0', '7.0.0'], + + # 3.1 + ['3.1', '6.0.4'], + ['3.1', '6.1.4'], + ['3.1', '7.0.0', true], ] main_build = builds.find { |_, _, is_main_build| is_main_build } From 8fb7a896082616a34e0375e003a3e9487af5f08c Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Thu, 30 Dec 2021 11:47:04 -0500 Subject: [PATCH 03/19] cimg/ruby is designed to supercede the legacy CircleCI Ruby image, circleci/ruby --- .circleci/config.yml | 45 ++++++++++++++++++++-------------------- .circleci/config.yml.erb | 9 ++++---- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b5d5b411..74b37fad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,12 +34,13 @@ shared_build_steps: &shared_build_steps - run: name: Installing Dependencies command: | - bundle check || (bundle install --jobs=4 --retry=3 --path vendor/bundle && bundle clean) + bundle config set --local path vendor/bundle + bundle check || (bundle install --jobs=4 --retry=3 && bundle clean) - save_cache: paths: - ./vendor/bundle - - /usr/local/bundle/config + # - /usr/local/bundle/config key: dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "RAILS_VERSION" }}-{{ checksum "Gemfile" }}-{{ checksum "meta-tags.gemspec" }} # run tests! @@ -94,7 +95,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.5 + - image: cimg/ruby:2.5 environment: RAILS_VERSION: 5.1.7 ENABLE_CODE_COVERAGE: 1 @@ -108,7 +109,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.5 + - image: cimg/ruby:2.5 environment: RAILS_VERSION: 5.2.6 ENABLE_CODE_COVERAGE: 1 @@ -122,7 +123,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.5 + - image: cimg/ruby:2.5 environment: RAILS_VERSION: 6.0.4 ENABLE_CODE_COVERAGE: 1 @@ -136,7 +137,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.5 + - image: cimg/ruby:2.5 environment: RAILS_VERSION: 6.1.0 ENABLE_CODE_COVERAGE: 1 @@ -150,7 +151,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.6 + - image: cimg/ruby:2.6 environment: RAILS_VERSION: 5.1.7 ENABLE_CODE_COVERAGE: 1 @@ -164,7 +165,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.6 + - image: cimg/ruby:2.6 environment: RAILS_VERSION: 5.2.6 ENABLE_CODE_COVERAGE: 1 @@ -178,7 +179,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.6 + - image: cimg/ruby:2.6 environment: RAILS_VERSION: 6.0.4 ENABLE_CODE_COVERAGE: 1 @@ -192,7 +193,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.6 + - image: cimg/ruby:2.6 environment: RAILS_VERSION: 6.1.4 ENABLE_CODE_COVERAGE: 1 @@ -206,7 +207,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.7 + - image: cimg/ruby:2.7 environment: RAILS_VERSION: 5.1.7 ENABLE_CODE_COVERAGE: 1 @@ -220,7 +221,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.7 + - image: cimg/ruby:2.7 environment: RAILS_VERSION: 5.2.6 ENABLE_CODE_COVERAGE: 1 @@ -234,7 +235,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.7 + - image: cimg/ruby:2.7 environment: RAILS_VERSION: 6.0.4 ENABLE_CODE_COVERAGE: 1 @@ -248,7 +249,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.7 + - image: cimg/ruby:2.7 environment: RAILS_VERSION: 6.1.4 ENABLE_CODE_COVERAGE: 1 @@ -262,7 +263,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:2.7 + - image: cimg/ruby:2.7 environment: RAILS_VERSION: 7.0.0 ENABLE_CODE_COVERAGE: 1 @@ -276,7 +277,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:3.0 + - image: cimg/ruby:3.0 environment: RAILS_VERSION: 6.0.4 ENABLE_CODE_COVERAGE: 1 @@ -290,7 +291,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:3.0 + - image: cimg/ruby:3.0 environment: RAILS_VERSION: 6.1.4 ENABLE_CODE_COVERAGE: 1 @@ -304,7 +305,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:3.0 + - image: cimg/ruby:3.0 environment: RAILS_VERSION: 7.0.0 ENABLE_CODE_COVERAGE: 1 @@ -318,7 +319,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:3.1 + - image: cimg/ruby:3.1 environment: RAILS_VERSION: 6.0.4 ENABLE_CODE_COVERAGE: 1 @@ -332,7 +333,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:3.1 + - image: cimg/ruby:3.1 environment: RAILS_VERSION: 6.1.4 ENABLE_CODE_COVERAGE: 1 @@ -346,7 +347,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:3.1 + - image: cimg/ruby:3.1 environment: RAILS_VERSION: 7.0.0 ENABLE_CODE_COVERAGE: 1 @@ -357,7 +358,7 @@ jobs: upload-coverage: docker: - - image: circleci/ruby:3.1 + - image: cimg/ruby:3.1 environment: CC_TEST_REPORTER_ID: 8792cbc0d1780830ddd3dd7eb1c25f09f386ba8f04449ad830039469406a6ab3 steps: diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index 9d6d4147..c805d825 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -67,12 +67,13 @@ shared_build_steps: &shared_build_steps - run: name: Installing Dependencies command: | - bundle check || (bundle install --jobs=4 --retry=3 --path vendor/bundle && bundle clean) + bundle config set --local path vendor/bundle + bundle check || (bundle install --jobs=4 --retry=3 && bundle clean) - save_cache: paths: - ./vendor/bundle - - /usr/local/bundle/config + # - /usr/local/bundle/config key: dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "RAILS_VERSION" }}-{{ checksum "Gemfile" }}-{{ checksum "meta-tags.gemspec" }} # run tests! @@ -127,7 +128,7 @@ jobs: type: boolean default: false docker: - - image: circleci/ruby:<%= ruby_version %> + - image: cimg/ruby:<%= ruby_version %> environment: RAILS_VERSION: <%= rails_version %> ENABLE_CODE_COVERAGE: 1 @@ -138,7 +139,7 @@ jobs: upload-coverage: docker: - - image: circleci/ruby:<%= main_build[0] %> + - image: cimg/ruby:<%= main_build[0] %> environment: CC_TEST_REPORTER_ID: 8792cbc0d1780830ddd3dd7eb1c25f09f386ba8f04449ad830039469406a6ab3 steps: From 2b005551ff06af5ba3759944935a4f5b2c75c4e1 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Thu, 30 Dec 2021 12:12:40 -0500 Subject: [PATCH 04/19] Updated rubocop --- .circleci/config.yml.erb | 1 - .codeclimate.yml | 2 +- Gemfile | 8 +++++--- lib/meta_tags/text_normalizer.rb | 2 +- meta-tags.gemspec | 11 ++++++----- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index c805d825..bcb03dd8 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -73,7 +73,6 @@ shared_build_steps: &shared_build_steps - save_cache: paths: - ./vendor/bundle - # - /usr/local/bundle/config key: dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "RAILS_VERSION" }}-{{ checksum "Gemfile" }}-{{ checksum "meta-tags.gemspec" }} # run tests! diff --git a/.codeclimate.yml b/.codeclimate.yml index 29cb4876..9a4b1539 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -10,7 +10,7 @@ engines: rubocop: enabled: true - channel: rubocop-0-75 + channel: rubocop-1-23-0 ratings: paths: diff --git a/Gemfile b/Gemfile index c7142795..a6a61457 100644 --- a/Gemfile +++ b/Gemfile @@ -10,13 +10,15 @@ if ENV['RAILS_VERSION'] gem 'railties', "~> #{ENV['RAILS_VERSION']}" end -# Ruby typings -gem 'steep', platform: :mri unless ENV["NO_STEEP"] == '1' +unless ENV["NO_STEEP"] == '1' + # Ruby typings + gem 'steep', platform: :mri +end group :test do # Lock rubocop to a specific version we use on CI. If you update this, # don't forget to switch rubocop channel in the .codeclimate.yml - gem 'rubocop', '~> 1.18.0' + gem 'rubocop', '~> 1.24.0' # Cops for rails apps gem 'rubocop-rails' # Apply RSpec rubocop cops diff --git a/lib/meta_tags/text_normalizer.rb b/lib/meta_tags/text_normalizer.rb index 0f0a1c76..9e038aae 100644 --- a/lib/meta_tags/text_normalizer.rb +++ b/lib/meta_tags/text_normalizer.rb @@ -205,7 +205,7 @@ def calculate_title_limits(site_title, title, separator, global_limit) # What should we truncate first: site title or page title? main_title = MetaTags.config.truncate_site_title_first ? title : [site_title] - main_length = main_title.map(&:length).sum + (main_title.size - 1) * separator.length + main_length = main_title.map(&:length).sum + ((main_title.size - 1) * separator.length) main_limited_length = global_limit secondary_limited_length = global_limit - (main_length > 0 ? main_length + separator.length : 0) diff --git a/meta-tags.gemspec b/meta-tags.gemspec index 980ce36d..dfaad1a1 100644 --- a/meta-tags.gemspec +++ b/meta-tags.gemspec @@ -33,10 +33,11 @@ Gem::Specification.new do |spec| spec.signing_key = File.expand_path("~/.ssh/gem-kpumuk.pem") if $PROGRAM_NAME.end_with?('gem') spec.metadata = { - "bug_tracker_uri" => "https://github.com/kpumuk/meta-tags/issues/", - "changelog_uri" => "https://github.com/kpumuk/meta-tags/blob/main/CHANGELOG.md", - "documentation_uri" => "https://rubydoc.info/github/kpumuk/meta-tags/", - "homepage_uri" => "https://github.com/kpumuk/meta-tags/", - "source_code_uri" => "https://github.com/kpumuk/meta-tags/", + "bug_tracker_uri" => "https://github.com/kpumuk/meta-tags/issues/", + "changelog_uri" => "https://github.com/kpumuk/meta-tags/blob/main/CHANGELOG.md", + "documentation_uri" => "https://rubydoc.info/github/kpumuk/meta-tags/", + "homepage_uri" => "https://github.com/kpumuk/meta-tags/", + "source_code_uri" => "https://github.com/kpumuk/meta-tags/", + "rubygems_mfa_required" => "true", } end From a5f3bd00bf6d3fad8767872cee723113dc2e4fcc Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Thu, 6 Jan 2022 18:59:14 -0500 Subject: [PATCH 05/19] Updated Rails 7 to 7.0.1 - now with full support for Ruby 3.0 --- .circleci/config.yml | 35 +++++++++++++++++------------------ .circleci/config.yml.erb | 6 +++--- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 74b37fad..35f198a2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,7 +40,6 @@ shared_build_steps: &shared_build_steps - save_cache: paths: - ./vendor/bundle - # - /usr/local/bundle/config key: dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "RAILS_VERSION" }}-{{ checksum "Gemfile" }}-{{ checksum "meta-tags.gemspec" }} # run tests! @@ -257,7 +256,7 @@ jobs: working_directory: ~/meta-tags/ruby27-rails-6.1.4 steps: *shared_build_steps - build-ruby27-rails-7_0_0: + build-ruby27-rails-7_0_1: parameters: is_main_build: type: boolean @@ -265,10 +264,10 @@ jobs: docker: - image: cimg/ruby:2.7 environment: - RAILS_VERSION: 7.0.0 + RAILS_VERSION: 7.0.1 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby27-rails-7.0.0 + working_directory: ~/meta-tags/ruby27-rails-7.0.1 steps: *shared_build_steps build-ruby30-rails-6_0_4: @@ -299,7 +298,7 @@ jobs: working_directory: ~/meta-tags/ruby30-rails-6.1.4 steps: *shared_build_steps - build-ruby30-rails-7_0_0: + build-ruby30-rails-7_0_1: parameters: is_main_build: type: boolean @@ -307,10 +306,10 @@ jobs: docker: - image: cimg/ruby:3.0 environment: - RAILS_VERSION: 7.0.0 + RAILS_VERSION: 7.0.1 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby30-rails-7.0.0 + working_directory: ~/meta-tags/ruby30-rails-7.0.1 steps: *shared_build_steps build-ruby31-rails-6_0_4: @@ -341,7 +340,7 @@ jobs: working_directory: ~/meta-tags/ruby31-rails-6.1.4 steps: *shared_build_steps - build-ruby31-rails-7_0_0: + build-ruby31-rails-7_0_1: parameters: is_main_build: type: boolean @@ -349,10 +348,10 @@ jobs: docker: - image: cimg/ruby:3.1 environment: - RAILS_VERSION: 7.0.0 + RAILS_VERSION: 7.0.1 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 0 - working_directory: ~/meta-tags/ruby31-rails-7.0.0 + working_directory: ~/meta-tags/ruby31-rails-7.0.1 steps: *shared_build_steps @@ -368,7 +367,7 @@ jobs: - run: name: Uploading Code Coverage command: | - cd /tmp/workspace/ruby31-rails-7.0.0 + cd /tmp/workspace/ruby31-rails-7.0.1 ./cc-test-reporter upload-coverage --input coverage/codeclimate.coverage.json || true tests: docker: @@ -419,7 +418,7 @@ workflows: - build-ruby27-rails-6_1_4: is_main_build: false - - build-ruby27-rails-7_0_0: + - build-ruby27-rails-7_0_1: is_main_build: false - build-ruby30-rails-6_0_4: @@ -428,7 +427,7 @@ workflows: - build-ruby30-rails-6_1_4: is_main_build: false - - build-ruby30-rails-7_0_0: + - build-ruby30-rails-7_0_1: is_main_build: false - build-ruby31-rails-6_0_4: @@ -437,13 +436,13 @@ workflows: - build-ruby31-rails-6_1_4: is_main_build: false - - build-ruby31-rails-7_0_0: + - build-ruby31-rails-7_0_1: is_main_build: true - upload-coverage: requires: - - build-ruby31-rails-7_0_0 + - build-ruby31-rails-7_0_1 - tests: requires: @@ -472,17 +471,17 @@ workflows: - build-ruby27-rails-6_1_4 - - build-ruby27-rails-7_0_0 + - build-ruby27-rails-7_0_1 - build-ruby30-rails-6_0_4 - build-ruby30-rails-6_1_4 - - build-ruby30-rails-7_0_0 + - build-ruby30-rails-7_0_1 - build-ruby31-rails-6_0_4 - build-ruby31-rails-6_1_4 - - build-ruby31-rails-7_0_0 + - build-ruby31-rails-7_0_1 diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index bcb03dd8..00228689 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -21,17 +21,17 @@ ['2.7', '5.2.6'], ['2.7', '6.0.4'], ['2.7', '6.1.4'], - ['2.7', '7.0.0'], + ['2.7', '7.0.1'], # 3.0 ['3.0', '6.0.4'], ['3.0', '6.1.4'], - ['3.0', '7.0.0'], + ['3.0', '7.0.1'], # 3.1 ['3.1', '6.0.4'], ['3.1', '6.1.4'], - ['3.1', '7.0.0', true], + ['3.1', '7.0.1', true], ] main_build = builds.find { |_, _, is_main_build| is_main_build } From 45ec26e7b7a30b1f844d3fc55b32c12e74146601 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 17:45:59 -0400 Subject: [PATCH 06/19] Updated Rails matrix and type definitions --- .circleci/config.yml | 104 ++++++++++----------- .circleci/config.yml.erb | 20 ++-- Gemfile | 2 +- Steepfile | 2 + lib/meta_tags.rb | 3 + lib/meta_tags/meta_tags_collection.rb | 6 +- sig/lib/_internal/rails.rbs | 50 +++++++++- sig/lib/_rails.rbs | 17 ---- sig/lib/meta_tags/meta_tags_collection.rbs | 2 +- sig/lib/meta_tags/text_normalizer.rbs | 2 +- 10 files changed, 121 insertions(+), 87 deletions(-) delete mode 100644 sig/lib/_rails.rbs diff --git a/.circleci/config.yml b/.circleci/config.yml index 35f198a2..cb66c3f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -158,7 +158,7 @@ jobs: working_directory: ~/meta-tags/ruby26-rails-5.1.7 steps: *shared_build_steps - build-ruby26-rails-5_2_6: + build-ruby26-rails-5_2_8: parameters: is_main_build: type: boolean @@ -166,13 +166,13 @@ jobs: docker: - image: cimg/ruby:2.6 environment: - RAILS_VERSION: 5.2.6 + RAILS_VERSION: 5.2.8 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby26-rails-5.2.6 + working_directory: ~/meta-tags/ruby26-rails-5.2.8 steps: *shared_build_steps - build-ruby26-rails-6_0_4: + build-ruby26-rails-6_0_5: parameters: is_main_build: type: boolean @@ -180,13 +180,13 @@ jobs: docker: - image: cimg/ruby:2.6 environment: - RAILS_VERSION: 6.0.4 + RAILS_VERSION: 6.0.5 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby26-rails-6.0.4 + working_directory: ~/meta-tags/ruby26-rails-6.0.5 steps: *shared_build_steps - build-ruby26-rails-6_1_4: + build-ruby26-rails-6_1_6: parameters: is_main_build: type: boolean @@ -194,10 +194,10 @@ jobs: docker: - image: cimg/ruby:2.6 environment: - RAILS_VERSION: 6.1.4 + RAILS_VERSION: 6.1.6 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby26-rails-6.1.4 + working_directory: ~/meta-tags/ruby26-rails-6.1.6 steps: *shared_build_steps build-ruby27-rails-5_1_7: @@ -214,7 +214,7 @@ jobs: working_directory: ~/meta-tags/ruby27-rails-5.1.7 steps: *shared_build_steps - build-ruby27-rails-5_2_6: + build-ruby27-rails-5_2_8: parameters: is_main_build: type: boolean @@ -222,13 +222,13 @@ jobs: docker: - image: cimg/ruby:2.7 environment: - RAILS_VERSION: 5.2.6 + RAILS_VERSION: 5.2.8 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby27-rails-5.2.6 + working_directory: ~/meta-tags/ruby27-rails-5.2.8 steps: *shared_build_steps - build-ruby27-rails-6_0_4: + build-ruby27-rails-6_0_5: parameters: is_main_build: type: boolean @@ -236,13 +236,13 @@ jobs: docker: - image: cimg/ruby:2.7 environment: - RAILS_VERSION: 6.0.4 + RAILS_VERSION: 6.0.5 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby27-rails-6.0.4 + working_directory: ~/meta-tags/ruby27-rails-6.0.5 steps: *shared_build_steps - build-ruby27-rails-6_1_4: + build-ruby27-rails-6_1_6: parameters: is_main_build: type: boolean @@ -250,10 +250,10 @@ jobs: docker: - image: cimg/ruby:2.7 environment: - RAILS_VERSION: 6.1.4 + RAILS_VERSION: 6.1.6 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby27-rails-6.1.4 + working_directory: ~/meta-tags/ruby27-rails-6.1.6 steps: *shared_build_steps build-ruby27-rails-7_0_1: @@ -270,7 +270,7 @@ jobs: working_directory: ~/meta-tags/ruby27-rails-7.0.1 steps: *shared_build_steps - build-ruby30-rails-6_0_4: + build-ruby30-rails-6_0_5: parameters: is_main_build: type: boolean @@ -278,10 +278,10 @@ jobs: docker: - image: cimg/ruby:3.0 environment: - RAILS_VERSION: 6.0.4 + RAILS_VERSION: 6.0.5 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby30-rails-6.0.4 + working_directory: ~/meta-tags/ruby30-rails-6.0.5 steps: *shared_build_steps build-ruby30-rails-6_1_4: @@ -312,7 +312,7 @@ jobs: working_directory: ~/meta-tags/ruby30-rails-7.0.1 steps: *shared_build_steps - build-ruby31-rails-6_0_4: + build-ruby31-rails-6_0_5: parameters: is_main_build: type: boolean @@ -320,13 +320,13 @@ jobs: docker: - image: cimg/ruby:3.1 environment: - RAILS_VERSION: 6.0.4 + RAILS_VERSION: 6.0.5 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby31-rails-6.0.4 + working_directory: ~/meta-tags/ruby31-rails-6.0.5 steps: *shared_build_steps - build-ruby31-rails-6_1_4: + build-ruby31-rails-6_1_6: parameters: is_main_build: type: boolean @@ -334,13 +334,13 @@ jobs: docker: - image: cimg/ruby:3.1 environment: - RAILS_VERSION: 6.1.4 + RAILS_VERSION: 6.1.6 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby31-rails-6.1.4 + working_directory: ~/meta-tags/ruby31-rails-6.1.6 steps: *shared_build_steps - build-ruby31-rails-7_0_1: + build-ruby31-rails-7_0_3: parameters: is_main_build: type: boolean @@ -348,10 +348,10 @@ jobs: docker: - image: cimg/ruby:3.1 environment: - RAILS_VERSION: 7.0.1 + RAILS_VERSION: 7.0.3 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 0 - working_directory: ~/meta-tags/ruby31-rails-7.0.1 + working_directory: ~/meta-tags/ruby31-rails-7.0.3 steps: *shared_build_steps @@ -367,7 +367,7 @@ jobs: - run: name: Uploading Code Coverage command: | - cd /tmp/workspace/ruby31-rails-7.0.1 + cd /tmp/workspace/ruby31-rails-7.0.3 ./cc-test-reporter upload-coverage --input coverage/codeclimate.coverage.json || true tests: docker: @@ -397,31 +397,31 @@ workflows: - build-ruby26-rails-5_1_7: is_main_build: false - - build-ruby26-rails-5_2_6: + - build-ruby26-rails-5_2_8: is_main_build: false - - build-ruby26-rails-6_0_4: + - build-ruby26-rails-6_0_5: is_main_build: false - - build-ruby26-rails-6_1_4: + - build-ruby26-rails-6_1_6: is_main_build: false - build-ruby27-rails-5_1_7: is_main_build: false - - build-ruby27-rails-5_2_6: + - build-ruby27-rails-5_2_8: is_main_build: false - - build-ruby27-rails-6_0_4: + - build-ruby27-rails-6_0_5: is_main_build: false - - build-ruby27-rails-6_1_4: + - build-ruby27-rails-6_1_6: is_main_build: false - build-ruby27-rails-7_0_1: is_main_build: false - - build-ruby30-rails-6_0_4: + - build-ruby30-rails-6_0_5: is_main_build: false - build-ruby30-rails-6_1_4: @@ -430,19 +430,19 @@ workflows: - build-ruby30-rails-7_0_1: is_main_build: false - - build-ruby31-rails-6_0_4: + - build-ruby31-rails-6_0_5: is_main_build: false - - build-ruby31-rails-6_1_4: + - build-ruby31-rails-6_1_6: is_main_build: false - - build-ruby31-rails-7_0_1: + - build-ruby31-rails-7_0_3: is_main_build: true - upload-coverage: requires: - - build-ruby31-rails-7_0_1 + - build-ruby31-rails-7_0_3 - tests: requires: @@ -457,31 +457,31 @@ workflows: - build-ruby26-rails-5_1_7 - - build-ruby26-rails-5_2_6 + - build-ruby26-rails-5_2_8 - - build-ruby26-rails-6_0_4 + - build-ruby26-rails-6_0_5 - - build-ruby26-rails-6_1_4 + - build-ruby26-rails-6_1_6 - build-ruby27-rails-5_1_7 - - build-ruby27-rails-5_2_6 + - build-ruby27-rails-5_2_8 - - build-ruby27-rails-6_0_4 + - build-ruby27-rails-6_0_5 - - build-ruby27-rails-6_1_4 + - build-ruby27-rails-6_1_6 - build-ruby27-rails-7_0_1 - - build-ruby30-rails-6_0_4 + - build-ruby30-rails-6_0_5 - build-ruby30-rails-6_1_4 - build-ruby30-rails-7_0_1 - - build-ruby31-rails-6_0_4 + - build-ruby31-rails-6_0_5 - - build-ruby31-rails-6_1_4 + - build-ruby31-rails-6_1_6 - - build-ruby31-rails-7_0_1 + - build-ruby31-rails-7_0_3 diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index 00228689..57b6cc1c 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -12,26 +12,26 @@ # 2.6 ['2.6', '5.1.7'], - ['2.6', '5.2.6'], - ['2.6', '6.0.4'], - ['2.6', '6.1.4'], + ['2.6', '5.2.8'], + ['2.6', '6.0.5'], + ['2.6', '6.1.6'], # 2.7 ['2.7', '5.1.7'], - ['2.7', '5.2.6'], - ['2.7', '6.0.4'], - ['2.7', '6.1.4'], + ['2.7', '5.2.8'], + ['2.7', '6.0.5'], + ['2.7', '6.1.6'], ['2.7', '7.0.1'], # 3.0 - ['3.0', '6.0.4'], + ['3.0', '6.0.5'], ['3.0', '6.1.4'], ['3.0', '7.0.1'], # 3.1 - ['3.1', '6.0.4'], - ['3.1', '6.1.4'], - ['3.1', '7.0.1', true], + ['3.1', '6.0.5'], + ['3.1', '6.1.6'], + ['3.1', '7.0.3', true], ] main_build = builds.find { |_, _, is_main_build| is_main_build } diff --git a/Gemfile b/Gemfile index a6a61457..eab3f99b 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ end unless ENV["NO_STEEP"] == '1' # Ruby typings - gem 'steep', platform: :mri + gem 'steep', '~> 1.0.1', platform: :mri end group :test do diff --git a/Steepfile b/Steepfile index 4bf0753a..b53072e8 100644 --- a/Steepfile +++ b/Steepfile @@ -10,4 +10,6 @@ target :lib do # (because we don't have RBS files for it) ignore "lib/meta_tags/railtie.rb" ignore "lib/generators" + + library "set" end diff --git a/lib/meta_tags.rb b/lib/meta_tags.rb index 24860882..f33aee90 100644 --- a/lib/meta_tags.rb +++ b/lib/meta_tags.rb @@ -1,5 +1,8 @@ # frozen_string_literal: true +require 'set' +require 'active_support/core_ext/hash/indifferent_access' + # MetaTags gem namespace. module MetaTags # Returns MetaTags gem configuration. diff --git a/lib/meta_tags/meta_tags_collection.rb b/lib/meta_tags/meta_tags_collection.rb index 13525e72..64ce9d27 100644 --- a/lib/meta_tags/meta_tags_collection.rb +++ b/lib/meta_tags/meta_tags_collection.rb @@ -9,7 +9,7 @@ class MetaTagsCollection # Initializes a new instance of MetaTagsCollection. # def initialize - @meta_tags = HashWithIndifferentAccess.new + @meta_tags = ActiveSupport::HashWithIndifferentAccess.new end # Returns meta tag value by name. @@ -170,10 +170,10 @@ def extract_robots # Converts input hash to HashWithIndifferentAccess and renames :open_graph to :og. # # @param [Hash] meta_tags list of meta tags. - # @return [HashWithIndifferentAccess] normalized meta tags list. + # @return [ActiveSupport::HashWithIndifferentAccess] normalized meta tags list. # def normalize_open_graph(meta_tags) - meta_tags = meta_tags.kind_of?(HashWithIndifferentAccess) ? meta_tags.dup : meta_tags.with_indifferent_access + meta_tags = meta_tags.with_indifferent_access meta_tags[:og] = meta_tags.delete(:open_graph) if meta_tags.key?(:open_graph) meta_tags end diff --git a/sig/lib/_internal/rails.rbs b/sig/lib/_internal/rails.rbs index 4ce8f78a..22ef2685 100644 --- a/sig/lib/_internal/rails.rbs +++ b/sig/lib/_internal/rails.rbs @@ -1,6 +1,6 @@ class ::Hash[unchecked out K, unchecked out V] - def with_indifferent_access: () -> instance - def deep_merge!: (instance other) -> self + def with_indifferent_access: () -> ActiveSupport::HashWithIndifferentAccess[K, V] + def deep_merge!: (instance | ActiveSupport::HashWithIndifferentAccess[K, V] other) -> self end class ::Object @@ -8,3 +8,49 @@ class ::Object def blank?: () -> bool def present?: () -> bool end + +class ::Loofah + module TextBehavior + def text: (?Hash[Symbol, untyped]? options) -> String + end + + class DocumentFragment + include TextBehavior + end + + def self.fragment: (String tags, ?String? encoding) -> DocumentFragment +end + +class ::Rails +end + +module ActionController + class Base + include _ActionControllerBase + + def self.helpers: () -> _ActionViewBase + end +end + +module ActiveSupport + class HashWithIndifferentAccess[unchecked out K, unchecked out V] < Hash[K, V] + def with_indifferent_access: () -> self + def deep_merge!: (instance | Hash[K, V] other) -> self + end +end + +interface _ActionControllerBase + def render: (*untyped args) { () -> untyped } -> untyped +end + +interface _ActionViewBase + def tag: (String name, ?Hash[String | Symbol, untyped] options, ?bool open) -> void + + def content_tag: (String name, String content, ?Hash[String | Symbol, untyped] options, ?bool open) -> void + + def safe_join: (Array[String], String) -> String + + def truncate: (String text, ?Hash[Symbol, untyped] options) -> String + + def strip_tags: (String html) -> String +end diff --git a/sig/lib/_rails.rbs b/sig/lib/_rails.rbs deleted file mode 100644 index 81a22b1d..00000000 --- a/sig/lib/_rails.rbs +++ /dev/null @@ -1,17 +0,0 @@ -module MetaTags - interface _ActionControllerBase - def render: (*untyped args) { () -> untyped } -> untyped - end - - interface _ActionViewBase - def tag: (String name, ?Hash[String | Symbol, untyped] options, ?bool open) -> void - - def content_tag: (String name, String content, ?Hash[String | Symbol, untyped] options, ?bool open) -> void - - def safe_join: (Array[String], String) -> String - - def truncate: (String text, ?Hash[Symbol, untyped] options) -> String - - def strip_tags: (String html) -> String - end -end diff --git a/sig/lib/meta_tags/meta_tags_collection.rbs b/sig/lib/meta_tags/meta_tags_collection.rbs index 3d30dd9c..0ddfa59d 100644 --- a/sig/lib/meta_tags/meta_tags_collection.rbs +++ b/sig/lib/meta_tags/meta_tags_collection.rbs @@ -28,7 +28,7 @@ module MetaTags def extract_robots: () -> Hash[String, String] - def normalize_open_graph: (Hash[String | Symbol, untyped] meta_tags) -> Hash[String | Symbol, untyped] + def normalize_open_graph: (Hash[String | Symbol, untyped] meta_tags) -> ActiveSupport::HashWithIndifferentAccess[String | Symbol, untyped] def extract_separator_section: (String | Symbol name, String default) -> String diff --git a/sig/lib/meta_tags/text_normalizer.rbs b/sig/lib/meta_tags/text_normalizer.rbs index 0bd0c775..57c6d686 100644 --- a/sig/lib/meta_tags/text_normalizer.rbs +++ b/sig/lib/meta_tags/text_normalizer.rbs @@ -21,7 +21,7 @@ module MetaTags def cleanup_strings: (keywords? strings, ?strip: bool strip) -> Array[String] - def truncate: (String string, ?Integer limit, ?String natural_separator) -> String + def truncate: (String string, ?Integer? limit, ?String natural_separator) -> String def truncate_array: (Array[String] string_array, ?Integer? limit, ?String separator, ?String natural_separator) -> Array[String] From 1248a3610b53a2dc86b83ad58308f610d556fcfd Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 18:02:44 -0400 Subject: [PATCH 07/19] Updated changelog --- CHANGELOG.md | 7 +++++++ README.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6b1a5ff..cf93c1ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2.17.0 (Development) [☰](https://github.com/kpumuk/meta-tags/compare/v2.16.0...HEAD) + +Changes: + +- Separate RBS files to _internal directory to avoid exposing RBS ([237](https://github.com/kpumuk/meta-tags/pull/237)) +- Added Ruby 3.1 to supported versions ([235](https://github.com/kpumuk/meta-tags/pull/235/)) + ## 2.16.0 (September 24, 2021) [☰](https://github.com/kpumuk/meta-tags/compare/v2.15.0...v2.16.0) Changes: diff --git a/README.md b/README.md index 764f2b0d..6cfb93b1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Search Engine Optimization (SEO) plugin for Ruby on Rails applications. ## Ruby on Rails MetaTags main branch fully supports Ruby on Rails 5.1+, and is tested against all -major Rails releases up to 6.1. +major Rails releases up to 7.0. Ruby versions older than 2.5 are no longer officially supported. From 6665c699313b90407abb702eb35cbc2d0e1770a2 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 18:06:38 -0400 Subject: [PATCH 08/19] Making sure we test against the same Rails patch version in all build matrix cells --- .circleci/config.yml | 60 ++++++++++++++++++++-------------------- .circleci/config.yml.erb | 44 ++++++++++++++++------------- 2 files changed, 55 insertions(+), 49 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cb66c3f9..7c08b58f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -102,7 +102,7 @@ jobs: working_directory: ~/meta-tags/ruby25-rails-5.1.7 steps: *shared_build_steps - build-ruby25-rails-5_2_6: + build-ruby25-rails-5_2_8: parameters: is_main_build: type: boolean @@ -110,13 +110,13 @@ jobs: docker: - image: cimg/ruby:2.5 environment: - RAILS_VERSION: 5.2.6 + RAILS_VERSION: 5.2.8 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby25-rails-5.2.6 + working_directory: ~/meta-tags/ruby25-rails-5.2.8 steps: *shared_build_steps - build-ruby25-rails-6_0_4: + build-ruby25-rails-6_0_5: parameters: is_main_build: type: boolean @@ -124,13 +124,13 @@ jobs: docker: - image: cimg/ruby:2.5 environment: - RAILS_VERSION: 6.0.4 + RAILS_VERSION: 6.0.5 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby25-rails-6.0.4 + working_directory: ~/meta-tags/ruby25-rails-6.0.5 steps: *shared_build_steps - build-ruby25-rails-6_1_0: + build-ruby25-rails-6_1_6: parameters: is_main_build: type: boolean @@ -138,10 +138,10 @@ jobs: docker: - image: cimg/ruby:2.5 environment: - RAILS_VERSION: 6.1.0 + RAILS_VERSION: 6.1.6 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby25-rails-6.1.0 + working_directory: ~/meta-tags/ruby25-rails-6.1.6 steps: *shared_build_steps build-ruby26-rails-5_1_7: @@ -256,7 +256,7 @@ jobs: working_directory: ~/meta-tags/ruby27-rails-6.1.6 steps: *shared_build_steps - build-ruby27-rails-7_0_1: + build-ruby27-rails-7_0_3: parameters: is_main_build: type: boolean @@ -264,10 +264,10 @@ jobs: docker: - image: cimg/ruby:2.7 environment: - RAILS_VERSION: 7.0.1 + RAILS_VERSION: 7.0.3 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby27-rails-7.0.1 + working_directory: ~/meta-tags/ruby27-rails-7.0.3 steps: *shared_build_steps build-ruby30-rails-6_0_5: @@ -284,7 +284,7 @@ jobs: working_directory: ~/meta-tags/ruby30-rails-6.0.5 steps: *shared_build_steps - build-ruby30-rails-6_1_4: + build-ruby30-rails-6_1_6: parameters: is_main_build: type: boolean @@ -292,13 +292,13 @@ jobs: docker: - image: cimg/ruby:3.0 environment: - RAILS_VERSION: 6.1.4 + RAILS_VERSION: 6.1.6 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby30-rails-6.1.4 + working_directory: ~/meta-tags/ruby30-rails-6.1.6 steps: *shared_build_steps - build-ruby30-rails-7_0_1: + build-ruby30-rails-7_0_3: parameters: is_main_build: type: boolean @@ -306,10 +306,10 @@ jobs: docker: - image: cimg/ruby:3.0 environment: - RAILS_VERSION: 7.0.1 + RAILS_VERSION: 7.0.3 ENABLE_CODE_COVERAGE: 1 NO_STEEP: 1 - working_directory: ~/meta-tags/ruby30-rails-7.0.1 + working_directory: ~/meta-tags/ruby30-rails-7.0.3 steps: *shared_build_steps build-ruby31-rails-6_0_5: @@ -385,13 +385,13 @@ workflows: - build-ruby25-rails-5_1_7: is_main_build: false - - build-ruby25-rails-5_2_6: + - build-ruby25-rails-5_2_8: is_main_build: false - - build-ruby25-rails-6_0_4: + - build-ruby25-rails-6_0_5: is_main_build: false - - build-ruby25-rails-6_1_0: + - build-ruby25-rails-6_1_6: is_main_build: false - build-ruby26-rails-5_1_7: @@ -418,16 +418,16 @@ workflows: - build-ruby27-rails-6_1_6: is_main_build: false - - build-ruby27-rails-7_0_1: + - build-ruby27-rails-7_0_3: is_main_build: false - build-ruby30-rails-6_0_5: is_main_build: false - - build-ruby30-rails-6_1_4: + - build-ruby30-rails-6_1_6: is_main_build: false - - build-ruby30-rails-7_0_1: + - build-ruby30-rails-7_0_3: is_main_build: false - build-ruby31-rails-6_0_5: @@ -449,11 +449,11 @@ workflows: - build-ruby25-rails-5_1_7 - - build-ruby25-rails-5_2_6 + - build-ruby25-rails-5_2_8 - - build-ruby25-rails-6_0_4 + - build-ruby25-rails-6_0_5 - - build-ruby25-rails-6_1_0 + - build-ruby25-rails-6_1_6 - build-ruby26-rails-5_1_7 @@ -471,13 +471,13 @@ workflows: - build-ruby27-rails-6_1_6 - - build-ruby27-rails-7_0_1 + - build-ruby27-rails-7_0_3 - build-ruby30-rails-6_0_5 - - build-ruby30-rails-6_1_4 + - build-ruby30-rails-6_1_6 - - build-ruby30-rails-7_0_1 + - build-ruby30-rails-7_0_3 - build-ruby31-rails-6_0_5 diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index 57b6cc1c..1a37a667 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -3,35 +3,41 @@ # rake circleci # <% + rails51 = '5.1.7' + rails52 = '5.2.8' + rails60 = '6.0.5' + rails61 = '6.1.6' + rails70 = '7.0.3' + builds = [ # 2.5 - ['2.5', '5.1.7'], - ['2.5', '5.2.6'], - ['2.5', '6.0.4'], - ['2.5', '6.1.0'], + ['2.5', rails51], + ['2.5', rails52], + ['2.5', rails60], + ['2.5', rails61], # 2.6 - ['2.6', '5.1.7'], - ['2.6', '5.2.8'], - ['2.6', '6.0.5'], - ['2.6', '6.1.6'], + ['2.6', rails51], + ['2.6', rails52], + ['2.6', rails60], + ['2.6', rails61], # 2.7 - ['2.7', '5.1.7'], - ['2.7', '5.2.8'], - ['2.7', '6.0.5'], - ['2.7', '6.1.6'], - ['2.7', '7.0.1'], + ['2.7', rails51], + ['2.7', rails52], + ['2.7', rails60], + ['2.7', rails61], + ['2.7', rails70], # 3.0 - ['3.0', '6.0.5'], - ['3.0', '6.1.4'], - ['3.0', '7.0.1'], + ['3.0', rails60], + ['3.0', rails61], + ['3.0', rails70], # 3.1 - ['3.1', '6.0.5'], - ['3.1', '6.1.6'], - ['3.1', '7.0.3', true], + ['3.1', rails60], + ['3.1', rails61], + ['3.1', rails70, true], ] main_build = builds.find { |_, _, is_main_build| is_main_build } From f7a414b033858bd9b0b8152209736d8eb91f81fe Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 18:13:21 -0400 Subject: [PATCH 09/19] Updated Rubocop to 1.31.0 --- .codeclimate.yml | 3 ++- .rubocop.yml | 17 ----------------- Gemfile | 2 +- lib/meta_tags/view_helper.rb | 2 +- .../shared_examples_for_set_meta_tags.rb | 2 +- 5 files changed, 5 insertions(+), 21 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 9a4b1539..8a98a09f 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -10,7 +10,8 @@ engines: rubocop: enabled: true - channel: rubocop-1-23-0 + # Check https://github.com/codeclimate/codeclimate-rubocop/branches/all?query=channel%2Frubocop + channel: rubocop-1-31-0 ratings: paths: diff --git a/.rubocop.yml b/.rubocop.yml index 45b26e38..ba15b5ed 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -40,10 +40,7 @@ Layout/DotPosition: Layout/LineLength: Max: 120 Exclude: - - "db/migrate/*" - "spec/**/*" - IgnoredPatterns: - - "^#.*" Layout/MultilineAssignmentLayout: EnforcedStyle: same_line @@ -58,13 +55,9 @@ Layout/SpaceInsideArrayLiteralBrackets: Metrics/AbcSize: Max: 25 - Exclude: - - "db/migrate/*.rb" Metrics/BlockLength: Exclude: - - "db/migrate/*.rb" - - "config/routes.rb" - "**/*.rake" - "spec/**/*_spec.rb" - "spec/spec_helper.rb" @@ -76,21 +69,11 @@ Metrics/ClassLength: Metrics/MethodLength: Max: 30 - Exclude: - - "db/migrate/*" Metrics/ModuleLength: Max: 250 CountComments: false -Rails/UnknownEnv: - Environments: - - development - - test - - production - - staging - - migration - Rails/SafeNavigation: ConvertTry: true diff --git a/Gemfile b/Gemfile index eab3f99b..0954c47a 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ end group :test do # Lock rubocop to a specific version we use on CI. If you update this, # don't forget to switch rubocop channel in the .codeclimate.yml - gem 'rubocop', '~> 1.24.0' + gem 'rubocop', '= 1.31.0' # Cops for rails apps gem 'rubocop-rails' # Apply RSpec rubocop cops diff --git a/lib/meta_tags/view_helper.rb b/lib/meta_tags/view_helper.rb index fb6cf297..892cb1e4 100644 --- a/lib/meta_tags/view_helper.rb +++ b/lib/meta_tags/view_helper.rb @@ -27,7 +27,7 @@ def meta_tags # # @see #display_meta_tags # - def set_meta_tags(meta_tags = {}) # rubocop:disable Naming/AccessorMethodName + def set_meta_tags(meta_tags = {}) self.meta_tags.update(meta_tags) end diff --git a/spec/support/shared_examples_for_set_meta_tags.rb b/spec/support/shared_examples_for_set_meta_tags.rb index 4219d87d..dfa95089 100644 --- a/spec/support/shared_examples_for_set_meta_tags.rb +++ b/spec/support/shared_examples_for_set_meta_tags.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -shared_examples_for '.set_meta_tags' do # rubocop:disable Metrics/BlockLength +shared_examples_for '.set_meta_tags' do context 'with a Hash parameter' do it 'updates meta tags' do subject.set_meta_tags(title: 'hello') From 6ab38f40c5d2f84a5dbae06d818bff2cf2a534be Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 18:19:07 -0400 Subject: [PATCH 10/19] Ruby 2.5 is no longer supported --- .circleci/config.yml | 76 ---------------------------------------- .circleci/config.yml.erb | 6 ---- .rubocop.yml | 2 +- CHANGELOG.md | 2 +- README.md | 6 ++-- meta-tags.gemspec | 2 +- 6 files changed, 6 insertions(+), 88 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7c08b58f..5e88cdca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -88,62 +88,6 @@ shared_build_steps: &shared_build_steps jobs: - build-ruby25-rails-5_1_7: - parameters: - is_main_build: - type: boolean - default: false - docker: - - image: cimg/ruby:2.5 - environment: - RAILS_VERSION: 5.1.7 - ENABLE_CODE_COVERAGE: 1 - NO_STEEP: 1 - working_directory: ~/meta-tags/ruby25-rails-5.1.7 - steps: *shared_build_steps - - build-ruby25-rails-5_2_8: - parameters: - is_main_build: - type: boolean - default: false - docker: - - image: cimg/ruby:2.5 - environment: - RAILS_VERSION: 5.2.8 - ENABLE_CODE_COVERAGE: 1 - NO_STEEP: 1 - working_directory: ~/meta-tags/ruby25-rails-5.2.8 - steps: *shared_build_steps - - build-ruby25-rails-6_0_5: - parameters: - is_main_build: - type: boolean - default: false - docker: - - image: cimg/ruby:2.5 - environment: - RAILS_VERSION: 6.0.5 - ENABLE_CODE_COVERAGE: 1 - NO_STEEP: 1 - working_directory: ~/meta-tags/ruby25-rails-6.0.5 - steps: *shared_build_steps - - build-ruby25-rails-6_1_6: - parameters: - is_main_build: - type: boolean - default: false - docker: - - image: cimg/ruby:2.5 - environment: - RAILS_VERSION: 6.1.6 - ENABLE_CODE_COVERAGE: 1 - NO_STEEP: 1 - working_directory: ~/meta-tags/ruby25-rails-6.1.6 - steps: *shared_build_steps - build-ruby26-rails-5_1_7: parameters: is_main_build: @@ -382,18 +326,6 @@ workflows: test: jobs: - - build-ruby25-rails-5_1_7: - is_main_build: false - - - build-ruby25-rails-5_2_8: - is_main_build: false - - - build-ruby25-rails-6_0_5: - is_main_build: false - - - build-ruby25-rails-6_1_6: - is_main_build: false - - build-ruby26-rails-5_1_7: is_main_build: false @@ -447,14 +379,6 @@ workflows: - tests: requires: - - build-ruby25-rails-5_1_7 - - - build-ruby25-rails-5_2_8 - - - build-ruby25-rails-6_0_5 - - - build-ruby25-rails-6_1_6 - - build-ruby26-rails-5_1_7 - build-ruby26-rails-5_2_8 diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index 1a37a667..f3bc4f03 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -10,12 +10,6 @@ rails70 = '7.0.3' builds = [ - # 2.5 - ['2.5', rails51], - ['2.5', rails52], - ['2.5', rails60], - ['2.5', rails61], - # 2.6 ['2.6', rails51], ['2.6', rails52], diff --git a/.rubocop.yml b/.rubocop.yml index ba15b5ed..d46219b7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,7 +14,7 @@ AllCops: # We do not specify Ruby version, because CodeClimate should by default # read .ruby-version, and send it down to Rubocop # (see https://github.com/codeclimate/codeclimate-rubocop/pull/68) - TargetRubyVersion: 2.5 + TargetRubyVersion: 2.6 # We will lock Rails version to the newest we have in the company, so we're # always looking to the future. TargetRailsVersion: 5.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index cf93c1ee..79f8970e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ Changes: - Separate RBS files to _internal directory to avoid exposing RBS ([237](https://github.com/kpumuk/meta-tags/pull/237)) -- Added Ruby 3.1 to supported versions ([235](https://github.com/kpumuk/meta-tags/pull/235/)) +- Added Ruby 3.1 to supported versions, Ruby 2.6 is minimum supported version ([235](https://github.com/kpumuk/meta-tags/pull/235/)) ## 2.16.0 (September 24, 2021) [☰](https://github.com/kpumuk/meta-tags/compare/v2.15.0...v2.16.0) diff --git a/README.md b/README.md index 6cfb93b1..80d1b9da 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,10 @@ Search Engine Optimization (SEO) plugin for Ruby on Rails applications. MetaTags main branch fully supports Ruby on Rails 5.1+, and is tested against all major Rails releases up to 7.0. -Ruby versions older than 2.5 are no longer officially supported. +Ruby versions older than 2.6 are no longer officially supported. -_Please note_ that we are no longer support Ruby versions older than 2.4.0 and -Ruby on Rails older than 5.1, because they [reached their End of Life](https://github.com/kpumuk/meta-tags/pull/143). +_Please note_ that we no longer support Ruby versions older than 2.6.0 and +Ruby on Rails older than 5.1, because they reached their [End of Life](https://endoflife.date/ruby). ## Installation diff --git a/meta-tags.gemspec b/meta-tags.gemspec index dfaad1a1..8f585daf 100644 --- a/meta-tags.gemspec +++ b/meta-tags.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/kpumuk/meta-tags" spec.license = "MIT" spec.platform = Gem::Platform::RUBY - spec.required_ruby_version = '>= 2.5.0' + spec.required_ruby_version = '>= 2.6.0' spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(\.|(bin|test|spec|features)/)}) } spec.bindir = "exe" From 2ba78133ab9db14a49253b0e5bcda15c1771c71f Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 18:31:31 -0400 Subject: [PATCH 11/19] Updated signing certificate --- certs/kpumuk.pem | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/certs/kpumuk.pem b/certs/kpumuk.pem index 62228757..aed5edd4 100644 --- a/certs/kpumuk.pem +++ b/certs/kpumuk.pem @@ -1,7 +1,7 @@ -----BEGIN CERTIFICATE----- MIIDODCCAiCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhrcHVt -dWsvREM9a3B1bXVrL0RDPWluZm8wHhcNMjAxMjEwMjA1MTE5WhcNMjExMjEwMjA1 -MTE5WjAjMSEwHwYDVQQDDBhrcHVtdWsvREM9a3B1bXVrL0RDPWluZm8wggEiMA0G +dWsvREM9a3B1bXVrL0RDPWluZm8wHhcNMjIwNzA1MjIyODU4WhcNMjMwNzA1MjIy +ODU4WjAjMSEwHwYDVQQDDBhrcHVtdWsvREM9a3B1bXVrL0RDPWluZm8wggEiMA0G CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8NmK6GXPiE/q7PDbj7nNdw3pa8a6Q IDxLtc7kW95e1mh0TVgOE8kvGegGtRtjvhXVGTTFtZ+yMD/0DCfTM2oUQYk5oYpO ZGrCfbNIdZauf4WYsnJtKOTrRoqFMwpL5PlBDKczB2y5lUmQs2HIsjQ0Q21wdKyy @@ -10,11 +10,11 @@ ZGrCfbNIdZauf4WYsnJtKOTrRoqFMwpL5PlBDKczB2y5lUmQs2HIsjQ0Q21wdKyy RryRTj5NVZbq9p1/WRc5zxD9QhAEPjRa5ikbd+eWebIDpAKI0hpyC/9bAgMBAAGj dzB1MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBT2uFRXNWDpVdbv +xBk8DAgJPGBPTAdBgNVHREEFjAUgRJrcHVtdWtAa3B1bXVrLmluZm8wHQYDVR0S -BBYwFIESa3B1bXVrQGtwdW11ay5pbmZvMA0GCSqGSIb3DQEBCwUAA4IBAQBdcrpl -32OlNaf68v38yzqYkviLELtbzRvEpRuQWZZyxOwU1OWSFAWkkALuseLWHDLYRDE8 -lOzQHewKodqaSPEo63vMZ28UQ3kDP1YE+cXR12fOg4YbCH8VETrTJa3X0AOOAbgA -ZLMcZD6wu9Zu2rPhxLxs6Q/PaGGEc8bonOirCZrwVDzHFA1cPjcSoApdsyGdRiyj -1f+XHXjCE5A1A6b8o4ffpAI6gkuaQOIrgGCyLS9oos6DSuofkvXI9g62G+2ZOmKJ -U97JEQmXCpruLEeSVT2UqR+iJAWEAxPzqzDbTzZBTSPKn+nXeuF6h81e4hsJtkeJ -HkYAoatF9iZrxT4E +BBYwFIESa3B1bXVrQGtwdW11ay5pbmZvMA0GCSqGSIb3DQEBCwUAA4IBAQBa5fMh +JcbhWBoP3kA32g3yM238fyJlre/ZeE6WIFxcuETff8AgPmk550qpAF/WBtP23X8Q +khIFv+bFiuBURvNbuFevs23to7NeNA7XMmEJqjB6fRzO/i/a3bkLG07u+o74MyXe +3/VAxl4Ce+C3aLwXccsbD+Fe3kQ6ku4ceIh2WebBSkpG3WRANReEAf7lcOt4aGEt +nkYjyHgDz6/gYamK15XtOivglkTJDwAVGBzF9o6j5IQ9nXho8Vd2P+hiawx76CoT +ANVO3I4ZwTKD12DMFqjalLwbSVVO4wpuMO3tcAgO4q7Fqh2tXTXom/YYl0SFvmx4 +evTPD0iY8lmGP3ZM -----END CERTIFICATE----- From 328c496c527bb0f70ffd46e3f22a0473bfa00ccf Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 18:32:34 -0400 Subject: [PATCH 12/19] Version bump to 2.17.0 --- CHANGELOG.md | 2 +- lib/meta_tags/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f8970e..bc70916b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 2.17.0 (Development) [☰](https://github.com/kpumuk/meta-tags/compare/v2.16.0...HEAD) +## 2.17.0 (July 5, 2022) [☰](https://github.com/kpumuk/meta-tags/compare/v2.16.0...v2.17.0) Changes: diff --git a/lib/meta_tags/version.rb b/lib/meta_tags/version.rb index 51d5495e..134a4efd 100644 --- a/lib/meta_tags/version.rb +++ b/lib/meta_tags/version.rb @@ -2,6 +2,6 @@ module MetaTags # Gem version. - VERSION = '2.16.0' + VERSION = '2.17.0' public_constant :VERSION end From 64edb148b5502174771d1b629ea0f6ffb40ea7a9 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 19:34:41 -0400 Subject: [PATCH 13/19] Updated dependencies --- Gemfile | 2 +- meta-tags.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 0954c47a..ae2f4135 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ group :test do # Apply RSpec rubocop cops gem 'rubocop-rspec', require: false # We use this gem on CI to calculate code coverage. - gem 'simplecov', '>= 0.17.0', '< 0.18' + gem 'simplecov', '~> 0.21.2' # Format RSpec output for CircleCI gem 'rspec_junit_formatter' end diff --git a/meta-tags.gemspec b/meta-tags.gemspec index 8f585daf..42c81f5a 100644 --- a/meta-tags.gemspec +++ b/meta-tags.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "railties", ">= 3.2.0", "< 7.1" spec.add_development_dependency "rake", "~> 13.0" - spec.add_development_dependency "rspec", "~> 3.10.0" + spec.add_development_dependency "rspec", "~> 3.11.0" spec.add_development_dependency "rspec-html-matchers", "~> 0.9.1" spec.cert_chain = ["certs/kpumuk.pem"] From d71536fb06661059a065ebdbdd79245fea7377b7 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 19:47:10 -0400 Subject: [PATCH 14/19] Moved CC_TEST_REPORTER_ID to CircleCI --- .circleci/config.yml | 2 -- .circleci/config.yml.erb | 2 -- 2 files changed, 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5e88cdca..f4e3b930 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -302,8 +302,6 @@ jobs: upload-coverage: docker: - image: cimg/ruby:3.1 - environment: - CC_TEST_REPORTER_ID: 8792cbc0d1780830ddd3dd7eb1c25f09f386ba8f04449ad830039469406a6ab3 steps: - attach_workspace: at: /tmp/workspace diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index f3bc4f03..d45e5d5f 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -139,8 +139,6 @@ jobs: upload-coverage: docker: - image: cimg/ruby:<%= main_build[0] %> - environment: - CC_TEST_REPORTER_ID: 8792cbc0d1780830ddd3dd7eb1c25f09f386ba8f04449ad830039469406a6ab3 steps: - attach_workspace: at: /tmp/workspace From ab40399ac592bcf26f071a9f5af0fa4d17d77401 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 19:59:36 -0400 Subject: [PATCH 15/19] Test a case when @page_* variables are defined, but nil --- spec/controller_helper_spec.rb | 6 ++++++ spec/spec_helper.rb | 4 +++- spec/support/initialize_rails.rb | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/spec/controller_helper_spec.rb b/spec/controller_helper_spec.rb index b91b7178..71171024 100644 --- a/spec/controller_helper_spec.rb +++ b/spec/controller_helper_spec.rb @@ -36,6 +36,12 @@ expect(subject.response.body).to eq('_rendered_') expect(subject.meta_tags.meta_tags).to eq({}) end + + it 'does not fail when instance variables are not set' do + subject.hide + expect(subject.response.body).to eq('_rendered_') + expect(subject.meta_tags.meta_tags).to eq({}) + end end it_behaves_like '.set_meta_tags' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d52439c1..08a5b829 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,9 @@ if ENV['ENABLE_CODE_COVERAGE'] require 'simplecov' - SimpleCov.start + SimpleCov.start do + enable_coverage :branch + end end require 'meta_tags' diff --git a/spec/support/initialize_rails.rb b/spec/support/initialize_rails.rb index 819d4ad2..800e40e2 100644 --- a/spec/support/initialize_rails.rb +++ b/spec/support/initialize_rails.rb @@ -32,6 +32,14 @@ def show render plain: '_rendered_' end + def hide + @page_title = nil + @page_keywords = nil + @page_description = nil + + render plain: '_rendered_' + end + public :set_meta_tags, :meta_tags end From 70a0ae2ae3708c87521869cc1931529cce3ee679 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 20:03:35 -0400 Subject: [PATCH 16/19] More details RSpec output for CI --- .circleci/config.yml | 5 ++--- .circleci/config.yml.erb | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f4e3b930..2525af85 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -49,10 +49,9 @@ shared_build_steps: &shared_build_steps mkdir /tmp/test-results TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)" - bundle exec rspec --format progress \ - --format RspecJunitFormatter \ + bundle exec rspec --format RspecJunitFormatter \ --out /tmp/test-results/rspec.xml \ - --format progress \ + --format documentation \ $TEST_FILES - when: diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index d45e5d5f..1b1b976f 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -82,10 +82,9 @@ shared_build_steps: &shared_build_steps mkdir /tmp/test-results TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)" - bundle exec rspec --format progress \ - --format RspecJunitFormatter \ + bundle exec rspec --format RspecJunitFormatter \ --out /tmp/test-results/rspec.xml \ - --format progress \ + --format documentation \ $TEST_FILES - when: From a7179626d8cd7521173de20c2c199c40f03e3556 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 20:14:15 -0400 Subject: [PATCH 17/19] Properly expose test results to CircleCI --- .circleci/config.yml | 2 +- .circleci/config.yml.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2525af85..363f533e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -50,7 +50,7 @@ shared_build_steps: &shared_build_steps TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)" bundle exec rspec --format RspecJunitFormatter \ - --out /tmp/test-results/rspec.xml \ + --out /tmp/test-results/rspec/results.xml \ --format documentation \ $TEST_FILES diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index 1b1b976f..c79c6587 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -83,7 +83,7 @@ shared_build_steps: &shared_build_steps TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)" bundle exec rspec --format RspecJunitFormatter \ - --out /tmp/test-results/rspec.xml \ + --out /tmp/test-results/rspec/results.xml \ --format documentation \ $TEST_FILES From 7d0e4303371255e6392de542015a2c6af3d878b7 Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Tue, 5 Jul 2022 20:30:33 -0400 Subject: [PATCH 18/19] Moved coverage formatting higher so it does not get overwritten by type checking --- .circleci/config.yml | 10 ++++++---- .circleci/config.yml.erb | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 363f533e..425b0690 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -54,6 +54,12 @@ shared_build_steps: &shared_build_steps --format documentation \ $TEST_FILES + - run: + name: Formatting Coverage + condition: << parameters.is_main_build >> + command: | + ./cc-test-reporter format-coverage --input-type simplecov --output coverage/codeclimate.coverage.json + - when: condition: << parameters.is_main_build >> steps: @@ -67,10 +73,6 @@ shared_build_steps: &shared_build_steps command: | bundle exec rake rbs:spec - - run: - name: Formatting Coverage - command: | - ./cc-test-reporter format-coverage --input-type simplecov --output coverage/codeclimate.coverage.json # collect reports - store_test_results: diff --git a/.circleci/config.yml.erb b/.circleci/config.yml.erb index c79c6587..6d7b7f0c 100644 --- a/.circleci/config.yml.erb +++ b/.circleci/config.yml.erb @@ -87,6 +87,12 @@ shared_build_steps: &shared_build_steps --format documentation \ $TEST_FILES + - run: + name: Formatting Coverage + condition: << parameters.is_main_build >> + command: | + ./cc-test-reporter format-coverage --input-type simplecov --output coverage/codeclimate.coverage.json + - when: condition: << parameters.is_main_build >> steps: @@ -100,10 +106,6 @@ shared_build_steps: &shared_build_steps command: | bundle exec rake rbs:spec - - run: - name: Formatting Coverage - command: | - ./cc-test-reporter format-coverage --input-type simplecov --output coverage/codeclimate.coverage.json # collect reports - store_test_results: From be8fbce2a9b2f6effb46ba2d2bc8ca627662959d Mon Sep 17 00:00:00 2001 From: Dmytro Shteflyuk Date: Thu, 7 Jul 2022 10:46:01 -0400 Subject: [PATCH 19/19] Fixed RBS type for Object#presence --- sig/lib/_internal/rails.rbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sig/lib/_internal/rails.rbs b/sig/lib/_internal/rails.rbs index 22ef2685..3812b842 100644 --- a/sig/lib/_internal/rails.rbs +++ b/sig/lib/_internal/rails.rbs @@ -4,7 +4,7 @@ class ::Hash[unchecked out K, unchecked out V] end class ::Object - def presence: () -> String? + def presence: () -> self? def blank?: () -> bool def present?: () -> bool end