Skip to content

Commit

Permalink
Bump minimum Ruby version to 3.1 (#841)
Browse files Browse the repository at this point in the history
* Bump minimum Ruby version to 3.1

* cops

* Resolve block forwarding issue with Ruby 3.3

* Replace Cucumber feature/integration tests with Minitest (#866)

* First pass of rewriting feature tests in Minitest rather than Cucumber

* add more feature tests

* Hooks and Pagination feature tests

* more feature tests added

* Remove some old comment references to Document

Add additional feature integration tests

* Add last feature test and remove Cucumber

* update Gemfile.lock

* fix cops
  • Loading branch information
jaredcwhite authored Mar 17, 2024
1 parent 4f933bb commit 6b577e3
Show file tree
Hide file tree
Showing 109 changed files with 2,368 additions and 4,092 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/ruby/.devcontainer/base.Dockerfile

# [Choice] Ruby version: 3, 3.0, 2, 2.7, 2.6
ARG VARIANT="3.0"
ARG VARIANT="3.1"
FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}

# [Option] Install Node.js
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dockerfile": "Dockerfile",
"args": {
// Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6
"VARIANT": "3",
"VARIANT": "3.1",
// Options
"INSTALL_NODE": "true",
"NODE_VERSION": "lts/*"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby_version: [3.0.6, 3.1.4, 3.2.2, 3.3.0]
ruby_version: [3.1.4, 3.2.3, 3.3.0]
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
# Has to be top level to cache properly
env:
Expand Down
4 changes: 2 additions & 2 deletions .gitpod.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ FROM gitpod/workspace-full
USER gitpod

# Define Ruby version
ENV RUBY_VERSION=2.7.2
ENV RUBY_WEBSITE_VERSION=3.0.3
ENV RUBY_VERSION=3.1.4
ENV RUBY_WEBSITE_VERSION=3.1.4

# Install the required Ruby version and set it as default
RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Bridgetown/NoPutsAllowed:
- rake/*.rake

AllCops:
TargetRubyVersion: 2.7
TargetRubyVersion: 3.1

Lint/NestedPercentLiteral:
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-3.0.6
ruby-3.1.4
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,15 @@ end

group :test do
gem "benchmark-ips"
gem "cucumber", "~> 8.0"
gem "memory_profiler"
gem "minitest"
gem "minitest-profile"
gem "minitest-reporters"
gem "nokogiri", "~> 1.7"
gem "nokolexbor"
gem "rack-test"
gem "rspec"
gem "rspec-mocks"
gem "rubocop-bridgetown", "~> 0.3.0", require: false
gem "rubocop-bridgetown", "~> 0.4", require: false
gem "shoulda"
gem "simplecov"
gem "terminal-table"
Expand Down
45 changes: 2 additions & 43 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,6 @@ GEM
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
csv (3.2.8)
cucumber (8.0.0)
builder (~> 3.2, >= 3.2.4)
cucumber-ci-environment (~> 9.0, >= 9.0.4)
cucumber-core (~> 11.0, >= 11.0.0)
cucumber-cucumber-expressions (~> 15.1, >= 15.1.1)
cucumber-gherkin (~> 23.0, >= 23.0.1)
cucumber-html-formatter (~> 19.1, >= 19.1.0)
cucumber-messages (~> 18.0, >= 18.0.0)
diff-lcs (~> 1.5, >= 1.5.0)
mime-types (~> 3.4, >= 3.4.1)
multi_test (~> 1.1, >= 1.1.0)
sys-uname (~> 1.2, >= 1.2.2)
cucumber-ci-environment (9.2.0)
cucumber-core (11.0.0)
cucumber-gherkin (~> 23.0, >= 23.0.1)
cucumber-messages (~> 18.0, >= 18.0.0)
cucumber-tag-expressions (~> 4.1, >= 4.1.0)
cucumber-cucumber-expressions (15.2.0)
cucumber-gherkin (23.0.1)
cucumber-messages (~> 18.0, >= 18.0.0)
cucumber-html-formatter (19.2.0)
cucumber-messages (~> 18.0, >= 18.0.0)
cucumber-messages (18.0.0)
cucumber-tag-expressions (4.1.0)
diff-lcs (1.5.1)
docile (1.4.0)
drb (2.2.1)
Expand Down Expand Up @@ -127,9 +103,6 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
memory_profiler (1.0.1)
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0305)
mini_portile2 (2.8.5)
minitest (5.22.3)
minitest-profile (0.0.2)
Expand All @@ -138,7 +111,6 @@ GEM
builder
minitest (>= 5.0)
ruby-progressbar
multi_test (1.1.0)
mutex_m (0.2.0)
net-http (0.4.1)
uri
Expand Down Expand Up @@ -177,15 +149,6 @@ GEM
roda (3.78.0)
rack
rouge (4.2.0)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
Expand All @@ -203,7 +166,7 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-bridgetown (0.3.2)
rubocop-bridgetown (0.4.1)
rubocop (~> 1.23)
rubocop-performance (~> 1.12)
rubocop-performance (1.20.2)
Expand Down Expand Up @@ -242,8 +205,6 @@ GEM
thor (~> 1.0)
tilt (~> 2.0)
yard (~> 0.9, >= 0.9.24)
sys-uname (1.2.3)
ffi (~> 1.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
thor (1.3.1)
Expand All @@ -267,7 +228,6 @@ DEPENDENCIES
bridgetown-builder!
bridgetown-core!
bridgetown-paginate!
cucumber (~> 8.0)
memory_profiler
minitest
minitest-profile
Expand All @@ -276,9 +236,8 @@ DEPENDENCIES
nokolexbor
rack-test
rake (~> 13.0)
rspec
rspec-mocks
rubocop-bridgetown (~> 0.3.0)
rubocop-bridgetown (~> 0.4)
shoulda
simplecov
solargraph
Expand Down
12 changes: 6 additions & 6 deletions bridgetown-builder/lib/bridgetown-builder/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ def register
Bridgetown::Builders::PluginBuilder.plugin_registrations << self
end

def before_build(*args, **kwargs, &block)
set_callback :build, :before, *args, **kwargs, &block
def before_build(...)
set_callback(:build, :before, ...)
end

def after_build(*args, **kwargs, &block)
set_callback :build, :after, *args, **kwargs, &block
def after_build(...)
set_callback(:build, :after, ...)
end

def around_build(*args, **kwargs, &block)
set_callback :build, :around, *args, **kwargs, &block
def around_build(...)
set_callback(:build, :around, ...)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def generate(_site)
site.generators << anon_generator.new(site.config)
site.generators.sort!

functions << { name: name, generator: anon_generator }
functions << { name:, generator: anon_generator }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion bridgetown-builder/lib/bridgetown-builder/dsl/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def helper(helper_name, method_name = nil, helpers_scope: false, &block)

Bridgetown::RubyTemplateView::Helpers.include(m)

functions << { name: name, filter: m }
functions << { name:, filter: m }
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions bridgetown-builder/lib/bridgetown-builder/dsl/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ def hook(
)
block = method(method_name) if method_name.is_a?(Symbol)

hook_block = Bridgetown::Hooks.register_one(owner, event, priority: priority, &block)
functions << { name: name, hook: [owner, event, priority, hook_block] }
hook_block = Bridgetown::Hooks.register_one(owner, event, priority:, &block)
functions << { name:, hook: [owner, event, priority, hook_block] }
end

def add_data(data_key)
Expand Down
4 changes: 2 additions & 2 deletions bridgetown-builder/lib/bridgetown-builder/dsl/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module DSL
module HTTP
def get(url, headers: {}, parse_json: true, **params)
body = begin
connection(parse_json: parse_json).get(url, params, headers).body
connection(parse_json:).get(url, params, headers).body
rescue Faraday::ParsingError
Bridgetown.logger.error(
"Faraday::ParsingError",
Expand All @@ -22,7 +22,7 @@ def get(url, headers: {}, parse_json: true, **params)
def connection(headers: {}, parse_json: true)
headers["Content-Type"] = "application/json" if parse_json

Faraday.new(headers: headers) do |faraday|
Faraday.new(headers:) do |faraday|
faraday.response :follow_redirects

if parse_json
Expand Down
4 changes: 2 additions & 2 deletions bridgetown-builder/lib/bridgetown-builder/dsl/liquid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def liquid_filter(filter_name, method_name = nil, filters_scope: false, &block)

::Liquid::Template.register_filter(m)

functions << { name: name, filter: m }
functions << { name:, filter: m }
end

def liquid_tag(tag_name, method_name = nil, as_block: false, &block)
Expand All @@ -68,7 +68,7 @@ def render(context)
end

::Liquid::Template.register_tag tag_name, tag
functions << { name: name, tag: [tag_name, tag] }
functions << { name:, tag: [tag_name, tag] }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion bridgetown-core/bridgetown-core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Gem::Specification.new do |s|

s.rdoc_options = ["--charset=UTF-8"]

s.required_ruby_version = ">= 2.7.0"
s.required_ruby_version = ">= 3.1.0"

s.add_runtime_dependency("activemodel", [">= 6.0", "< 8.0"])
s.add_runtime_dependency("activesupport", [">= 6.0", "< 8.0"])
Expand Down
Loading

0 comments on commit 6b577e3

Please sign in to comment.