Skip to content

Commit

Permalink
Merge branch 'kpumuk:main' into rename-title-helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Spone authored Aug 22, 2022
2 parents 5c3a771 + 95b07b5 commit 0507045
Show file tree
Hide file tree
Showing 23 changed files with 262 additions and 233 deletions.
224 changes: 102 additions & 122 deletions .circleci/config.yml

Large diffs are not rendered by default.

68 changes: 36 additions & 32 deletions .circleci/config.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,35 @@
# rake circleci
#
<%
builds = [
# 2.5
['2.5', '5.1.7'],
['2.5', '5.2.6'],
['2.5', '6.0.4'],
['2.5', '6.1.0'],
rails51 = '5.1.7'
rails52 = '5.2.8'
rails60 = '6.0.5'
rails61 = '6.1.6'
rails70 = '7.0.3'

builds = [
# 2.6
['2.6', '5.1.7'],
['2.6', '5.2.6'],
['2.6', '6.0.4'],
['2.6', '6.1.4'],
['2.6', rails51],
['2.6', rails52],
['2.6', rails60],
['2.6', rails61],

# 2.7
['2.7', '5.1.7'],
['2.7', '5.2.6'],
['2.7', '6.0.4'],
['2.7', '6.1.4'],
['2.7', '7.0.0.alpha2'],
['2.7', rails51],
['2.7', rails52],
['2.7', rails60],
['2.7', rails61],
['2.7', rails70],

# 3.0
['3.0', '6.0.4'],
['3.0', '6.1.4', true],
['3.0', '7.0.0.alpha2'],
['3.0', rails60],
['3.0', rails61],
['3.0', rails70],

# 3.1
['3.1', rails60],
['3.1', rails61],
['3.1', rails70, true],
]

main_build = builds.find { |_, _, is_main_build| is_main_build }
Expand Down Expand Up @@ -62,12 +67,12 @@ 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
key: dependencies-{{ .Environment.CACHE_VERSION }}-{{ checksum "RAILS_VERSION" }}-{{ checksum "Gemfile" }}-{{ checksum "meta-tags.gemspec" }}

# run tests!
Expand All @@ -77,12 +82,17 @@ 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 \
--out /tmp/test-results/rspec.xml \
--format progress \
bundle exec rspec --format RspecJunitFormatter \
--out /tmp/test-results/rspec/results.xml \
--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:
Expand All @@ -96,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:
Expand All @@ -122,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
Expand All @@ -133,9 +139,7 @@ jobs:

upload-coverage:
docker:
- image: circleci/ruby:<%= main_build[0] %>
environment:
CC_TEST_REPORTER_ID: 8792cbc0d1780830ddd3dd7eb1c25f09f386ba8f04449ad830039469406a6ab3
- image: cimg/ruby:<%= main_build[0] %>
steps:
- attach_workspace:
at: /tmp/workspace
Expand Down
3 changes: 2 additions & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ engines:

rubocop:
enabled: true
channel: rubocop-0-75
# Check https://github.com/codeclimate/codeclimate-rubocop/branches/all?query=channel%2Frubocop
channel: rubocop-1-31-0

ratings:
paths:
Expand Down
19 changes: 1 addition & 18 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,10 +40,7 @@ Layout/DotPosition:
Layout/LineLength:
Max: 120
Exclude:
- "db/migrate/*"
- "spec/**/*"
IgnoredPatterns:
- "^#.*"

Layout/MultilineAssignmentLayout:
EnforcedStyle: same_line
Expand All @@ -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"
Expand All @@ -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

Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2.17.0 (July 5, 2022) [](https://github.com/kpumuk/meta-tags/compare/v2.16.0...v2.17.0)

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, 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)

Changes:
Expand Down
10 changes: 6 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ 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', '~> 1.0.1', 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.31.0'
# Cops for rails apps
gem 'rubocop-rails'
# 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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ 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.
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

Expand Down
2 changes: 2 additions & 0 deletions Steepfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 9 additions & 9 deletions certs/kpumuk.pem
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-----BEGIN CERTIFICATE-----
MIIDODCCAiCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhrcHVt
dWsvREM9a3B1bXVrL0RDPWluZm8wHhcNMjAxMjEwMjA1MTE5WhcNMjExMjEwMjA1
MTE5WjAjMSEwHwYDVQQDD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
BBYwFIESa3B1bXVrQGtwdW11ay5pbmZvMA0GCSqGSIb3DQEBCwUAA4IBAQBa5fMh
JcbhWBoP3kA32g3yM238fyJlre/ZeE6WIFxcuETff8AgPmk550qpAF/WBtP23X8Q
khIFv+bFiuBURvNbuFevs23to7NeNA7XMmEJqjB6fRzO/i/a3bkLG07u+o74MyXe
3/VAxl4Ce+C3aLwXccsbD+Fe3kQ6ku4ceIh2WebBSkpG3WRANReEAf7lcOt4aGEt
nkYjyHgDz6/gYamK15XtOivglkTJDwAVGBzF9o6j5IQ9nXho8Vd2P+hiawx76CoT
ANVO3I4ZwTKD12DMFqjalLwbSVVO4wpuMO3tcAgO4q7Fqh2tXTXom/YYl0SFvmx4
evTPD0iY8lmGP3ZM
-----END CERTIFICATE-----
3 changes: 3 additions & 0 deletions lib/meta_tags.rb
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions lib/meta_tags/meta_tags_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/meta_tags/text_normalizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/meta_tags/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module MetaTags
# Gem version.
VERSION = '2.16.0'
VERSION = '2.17.0'
public_constant :VERSION
end
2 changes: 1 addition & 1 deletion lib/meta_tags/view_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 8 additions & 7 deletions meta-tags.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -26,17 +26,18 @@ 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"]
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
Loading

0 comments on commit 0507045

Please sign in to comment.