diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8828e6d93..17ab2756b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby_version: [2.7.2, 3.0.0, 3.1.2, 3.2.0] + ruby_version: [3.0.0, 3.1.2, 3.2.0, 3.3.0] continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} # Has to be top level to cache properly env: diff --git a/.ruby-version b/.ruby-version index f2f33d6c7..456bc36ed 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-2.7.2 \ No newline at end of file +ruby-3.0.6 \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 0432e6034..a91665e25 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,6 +13,7 @@ PATH addressable (~> 2.4) amazing_print (~> 1.2) colorator (~> 1.0) + csv (~> 3.2) erubi (~> 1.9) faraday (~> 2.0) faraday-follow_redirects (~> 0.3) @@ -47,25 +48,33 @@ PATH GEM remote: https://rubygems.org/ specs: - activemodel (7.0.7.2) - activesupport (= 7.0.7.2) - activesupport (7.0.7.2) + activemodel (7.1.2) + activesupport (= 7.1.2) + activesupport (7.1.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - addressable (2.8.5) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) amazing_print (1.5.0) ansi (1.5.0) ast (2.4.2) backport (1.2.0) - base64 (0.1.1) - benchmark (0.2.1) - benchmark-ips (2.12.0) + base64 (0.2.0) + benchmark (0.3.0) + benchmark-ips (2.13.0) + bigdecimal (3.1.5) builder (3.2.4) colorator (1.1.0) concurrent-ruby (1.2.2) + 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) @@ -92,21 +101,24 @@ GEM cucumber-tag-expressions (4.1.0) diff-lcs (1.5.0) docile (1.4.0) + drb (2.2.0) + ruby2_keywords e2mmap (0.1.0) erubi (1.12.0) - faraday (2.7.10) + faraday (2.8.1) + base64 faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-follow_redirects (0.3.0) faraday (>= 1, < 3) faraday-net_http (3.0.2) - ffi (1.15.5) + ffi (1.16.3) hash_with_dot_access (1.2.0) activesupport (>= 5.0.0, < 8.0) i18n (1.14.1) concurrent-ruby (~> 1.0) jaro_winkler (1.5.6) - json (2.6.3) + json (2.7.1) kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -119,9 +131,9 @@ GEM memory_profiler (1.0.1) mime-types (3.5.1) mime-types-data (~> 3.2015) - mime-types-data (3.2023.0808) - mini_portile2 (2.8.4) - minitest (5.19.0) + mime-types-data (3.2023.1205) + mini_portile2 (2.8.5) + minitest (5.20.0) minitest-profile (0.0.2) minitest-reporters (1.6.1) ansi @@ -129,39 +141,37 @@ GEM minitest (>= 5.0) ruby-progressbar multi_test (1.1.0) - nokogiri (1.15.4) + mutex_m (0.2.0) + nokogiri (1.16.0) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.15.4-arm64-darwin) + nokogiri (1.16.0-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-darwin) + nokogiri (1.16.0-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.0-x86_64-linux) racc (~> 1.4) - nokolexbor (0.5.0) - nokolexbor (0.5.0-arm64-darwin) - nokolexbor (0.5.0-x86_64-darwin) - nokolexbor (0.5.0-x86_64-linux) - parallel (1.23.0) - parser (3.2.2.3) + nokolexbor (0.5.2) + parallel (1.24.0) + parser (3.2.2.4) ast (~> 2.4.1) racc - public_suffix (5.0.3) - racc (1.7.1) + public_suffix (5.0.4) + racc (1.7.3) rack (3.0.8) rack-test (2.1.0) rack (>= 1.3) rainbow (3.1.1) - rake (13.0.6) + rake (13.1.0) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) rbs (2.8.4) - regexp_parser (2.8.1) + regexp_parser (2.8.3) reverse_markdown (2.1.1) nokogiri rexml (3.2.6) - roda (3.71.0) + roda (3.75.0) rack rouge (3.30.0) rspec (3.12.0) @@ -177,26 +187,25 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (1.56.2) - base64 (~> 0.1.1) + rubocop (1.59.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.2.2.4) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) rubocop-bridgetown (0.3.2) rubocop (~> 1.23) rubocop-performance (~> 1.12) - rubocop-performance (1.19.0) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) + rubocop-performance (1.20.1) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) serbea (1.0.1) @@ -215,7 +224,7 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - solargraph (0.49.0) + solargraph (0.50.0) backport (~> 1.2) benchmark bundler (~> 2.0) @@ -235,13 +244,13 @@ GEM ffi (~> 1.1) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (1.2.2) - tilt (2.2.0) + thor (1.3.0) + tilt (2.3.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) yard (0.9.34) - zeitwerk (2.6.11) + zeitwerk (2.6.12) PLATFORMS arm64-darwin-22 @@ -274,4 +283,4 @@ DEPENDENCIES yard (~> 0.9) BUNDLED WITH - 2.4.6 + 2.5.3 diff --git a/bridgetown-core/bridgetown-core.gemspec b/bridgetown-core/bridgetown-core.gemspec index 1aaa7ab33..610ad74b9 100644 --- a/bridgetown-core/bridgetown-core.gemspec +++ b/bridgetown-core/bridgetown-core.gemspec @@ -36,6 +36,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency("addressable", "~> 2.4") s.add_runtime_dependency("amazing_print", "~> 1.2") s.add_runtime_dependency("colorator", "~> 1.0") + s.add_runtime_dependency("csv", "~> 3.2") s.add_runtime_dependency("erubi", "~> 1.9") s.add_runtime_dependency("faraday", "~> 2.0") s.add_runtime_dependency("faraday-follow_redirects", "~> 0.3") diff --git a/bridgetown-core/lib/bridgetown-core/commands/console.rb b/bridgetown-core/lib/bridgetown-core/commands/console.rb index e3ade69c4..bace48fac 100644 --- a/bridgetown-core/lib/bridgetown-core/commands/console.rb +++ b/bridgetown-core/lib/bridgetown-core/commands/console.rb @@ -66,9 +66,15 @@ def self.banner type: :boolean, desc: "Print verbose output." - def console + def console # rubocop:disable Metrics require "irb" - require "irb/ext/save-history" + new_history_behavior = false + begin + require "irb/ext/save-history" + rescue LoadError + # Code path for Ruby 3.3+ + new_history_behavior = true + end require "amazing_print" unless options[:"bypass-ap"] Bridgetown.logger.adjust_verbosity(options) @@ -96,6 +102,7 @@ def console irb = IRB::Irb.new(workspace) IRB.conf[:IRB_RC]&.call(irb.context) IRB.conf[:MAIN_CONTEXT] = irb.context + irb.context.io.load_history if new_history_behavior Bridgetown.logger.info "Console:", "Your site is now available as #{"site".cyan}" Bridgetown.logger.info "", "You can also access #{"collections".cyan} or perform a " \ @@ -117,6 +124,7 @@ def console end ensure IRB.conf[:AT_EXIT].each(&:call) + irb.context.io.save_history if new_history_behavior end end end diff --git a/bridgetown-core/lib/bridgetown-core/generated_page.rb b/bridgetown-core/lib/bridgetown-core/generated_page.rb index dad9678d9..0989a84e5 100644 --- a/bridgetown-core/lib/bridgetown-core/generated_page.rb +++ b/bridgetown-core/lib/bridgetown-core/generated_page.rb @@ -168,7 +168,7 @@ def relative_path # # @return [String] def output_ext - @output_ext ||= (permalink_ext || converter_output_ext) + @output_ext ||= permalink_ext || converter_output_ext end def permalink_ext diff --git a/bridgetown-core/lib/bridgetown-core/log_writer.rb b/bridgetown-core/lib/bridgetown-core/log_writer.rb index bf84e5388..be68a12dc 100644 --- a/bridgetown-core/lib/bridgetown-core/log_writer.rb +++ b/bridgetown-core/lib/bridgetown-core/log_writer.rb @@ -2,18 +2,12 @@ module Bridgetown class LogWriter < ::Logger - def initialize # rubocop:disable Lint/MissingSuper - @progname = nil - @level = DEBUG - @default_formatter = Formatter.new - @logdev = $stdout - @formatter = proc do |_, _, _, msg| - msg.to_s - end + def initialize + super($stdout, formatter: proc { |_, _, _, msg| msg.to_s }) end def enable_prefix - @formatter = proc do |_, _, _, msg| + self.formatter = proc do |_, _, _, msg| "\e[32m[Bridgetown]\e[0m #{msg}" end end diff --git a/bridgetown-core/lib/bridgetown-core/resource/base.rb b/bridgetown-core/lib/bridgetown-core/resource/base.rb index 71b60aa9e..a77b19d1f 100644 --- a/bridgetown-core/lib/bridgetown-core/resource/base.rb +++ b/bridgetown-core/lib/bridgetown-core/resource/base.rb @@ -349,7 +349,7 @@ def normalize_categories_and_tags end def import_taxonomies_from_data - taxonomies.each do |_label, metadata| + taxonomies.each_value do |metadata| Array(data[metadata.type.key]).each do |term| metadata.terms << TaxonomyTerm.new( resource: self, label: term, type: metadata.type diff --git a/bridgetown-core/lib/bridgetown-core/resource/relations.rb b/bridgetown-core/lib/bridgetown-core/resource/relations.rb index 18c161302..b7d50dc60 100644 --- a/bridgetown-core/lib/bridgetown-core/resource/relations.rb +++ b/bridgetown-core/lib/bridgetown-core/resource/relations.rb @@ -24,7 +24,7 @@ def relation_schema def relation_types @relation_types ||= begin types = [] - relation_schema&.each do |_relation_type, collections| + relation_schema&.each_value do |collections| types << collections types << Array(collections).map { |item| ActiveSupport::Inflector.pluralize(item) } end diff --git a/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb b/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb index cd3a666fa..f20bc3671 100644 --- a/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb +++ b/bridgetown-core/lib/bridgetown-core/utils/loaders_manager.rb @@ -20,9 +20,7 @@ def initialize(config) def unload_loaders return if @loaders.keys.empty? - @loaders.each do |_path, loader| - loader.unload - end + @loaders.each_value(&:unload) @loaders = {} end diff --git a/bridgetown-paginate/lib/bridgetown-paginate/pagination_generator.rb b/bridgetown-paginate/lib/bridgetown-paginate/pagination_generator.rb index 3bdbc7c9e..700a97410 100644 --- a/bridgetown-paginate/lib/bridgetown-paginate/pagination_generator.rb +++ b/bridgetown-paginate/lib/bridgetown-paginate/pagination_generator.rb @@ -80,14 +80,14 @@ def generate(site) # rubocop:todo Metrics/AbcSize doc.data.key?("pagination") || doc.data.key?("paginate") end end - return coll + coll end # Create the proc that constructs the real-life site page # This is necessary to decouple the code from the Bridgetown site object page_add_lambda = ->(newpage) do site.add_generated_page newpage - return newpage # Return the site to the calling code + newpage # Return the site to the calling code end # lambda that removes a page from the site pages list diff --git a/bridgetown-website/Gemfile.lock b/bridgetown-website/Gemfile.lock index d5ac51708..160d3c69a 100644 --- a/bridgetown-website/Gemfile.lock +++ b/bridgetown-website/Gemfile.lock @@ -13,6 +13,7 @@ PATH addressable (~> 2.4) amazing_print (~> 1.2) colorator (~> 1.0) + csv (~> 3.2) erubi (~> 1.9) faraday (~> 2.0) faraday-follow_redirects (~> 0.3) @@ -69,6 +70,7 @@ GEM nokogiri colorator (1.1.0) concurrent-ruby (1.2.2) + csv (3.2.6) erubi (1.12.0) faraday (2.7.10) faraday-net_http (>= 2.0, < 3.1)