From 944706e573a5fbe3b8344ae955f5777702ac767f Mon Sep 17 00:00:00 2001 From: George Ma Date: Wed, 3 Apr 2024 16:10:08 -0400 Subject: [PATCH 1/5] Centralize Ruby Version to `.ruby-version` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `.ruby-version` file is the ecosystem standard for defining a Ruby version. This PR adds the `.ruby-version` file, ensures a `required_ruby_version` is set, and removes all other references to Ruby in this repository, aligning it with the standard. > [!IMPORTANT] > Please verify the following before merging: Verify that the changes in the PR meets the following requirements or adjust manually to make it compliant: - [ ] `.ruby-version` file is present with the correct Ruby version defined - [ ] A `required_ruby_version` in your gemspec is set - [ ] There is no Ruby version present in the `dev.yml` Ruby task (before: `- ruby: x.x.x`, after: `- ruby`) - [ ] There is no Ruby version/requirement referenced in the `Gemfile` (no lines with `ruby `) - [ ] A `Gemfile.lock` is built with the defined Ruby version - [ ] The version of Rubocop installed is 1.61.0 or greater - [ ] There is no `TargetRubyVersion` defined in `rubocop.yml` (reads from `required_ruby_version` on Rubocop 1.61.0) - [ ] There is no Ruby argument present in `ruby/setup-ruby` Github Actions that do **not** run on a Ruby matrix (no lines with `ruby-version: “x.x”`) To establish consistency, the `required_ruby_version` is set to 2.7. If you think that another version is a better fit, please make the applicable changes. Please merge this PR if it looks good, this PR will be addressed if there isn't any activity after 4 weeks. --- .github/workflows/ci.yml | 2 +- .rubocop.yml | 1 - Gemfile | 2 +- graphql-batch.gemspec | 2 ++ 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4f3296..ed0226c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.7, 3.1, 3.3] + ruby: [2.7, 3.0, 3.1, 3.2, 3.3] graphql_version: ['~> 1.12.18', '~> 1.13', '~> 2.0'] include: - ruby: 2.4 diff --git a/.rubocop.yml b/.rubocop.yml index 8e0a2a5..9108e60 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,6 +6,5 @@ inherit_from: AllCops: SuggestExtensions: false - TargetRubyVersion: 2.7 Exclude: - vendor/**/* diff --git a/Gemfile b/Gemfile index 3ed7694..b61c9b1 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,6 @@ gemspec gem 'graphql', ENV['GRAPHQL_VERSION'] if ENV['GRAPHQL_VERSION'] if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0') - gem 'rubocop', '~> 1.12.0', require: false + gem 'rubocop', '~> 1.61.0', require: false gem "rubocop-shopify", '~> 1.0.7', require: false end diff --git a/graphql-batch.gemspec b/graphql-batch.gemspec index e981897..68dfd31 100644 --- a/graphql-batch.gemspec +++ b/graphql-batch.gemspec @@ -10,6 +10,8 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/Shopify/graphql-batch" spec.license = "MIT" + spec.required_ruby_version = ">= 2.7" + spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } From 076919826cb8af5a9733d8abe5be704d6f9e8f4a Mon Sep 17 00:00:00 2001 From: George Ma Date: Wed, 3 Apr 2024 16:12:25 -0400 Subject: [PATCH 2/5] Run rubocop autocorrects --- .ruby-version | 1 + lib/graphql/batch/loader.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..a603bb5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.7.5 diff --git a/lib/graphql/batch/loader.rb b/lib/graphql/batch/loader.rb index 378a982..0484df5 100644 --- a/lib/graphql/batch/loader.rb +++ b/lib/graphql/batch/loader.rb @@ -66,7 +66,7 @@ def prime(key, value) cache[cache_key(key)] ||= ::Promise.resolve(value).tap { |p| p.source = self } end - def resolve #:nodoc: + def resolve # :nodoc: return if resolved? load_keys = queue @queue = nil @@ -86,7 +86,7 @@ def around_perform end # For Promise#sync - def wait #:nodoc: + def wait # :nodoc: if executor executor.resolve(self) else From 8afcdbbfbc6027d75d3fd496cffe97c1ce822e30 Mon Sep 17 00:00:00 2001 From: Scott Walkinshaw Date: Fri, 5 Apr 2024 09:47:16 -0400 Subject: [PATCH 3/5] Update versions --- .ruby-version | 2 +- graphql-batch.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruby-version b/.ruby-version index a603bb5..15a2799 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.5 +3.3.0 diff --git a/graphql-batch.gemspec b/graphql-batch.gemspec index 68dfd31..18b44de 100644 --- a/graphql-batch.gemspec +++ b/graphql-batch.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/Shopify/graphql-batch" spec.license = "MIT" - spec.required_ruby_version = ">= 2.7" + spec.required_ruby_version = ">= 2.4" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "exe" From f4d4f34019e5cc6b688caeda516bf39ddd208193 Mon Sep 17 00:00:00 2001 From: Scott Walkinshaw Date: Fri, 5 Apr 2024 13:35:32 -0400 Subject: [PATCH 4/5] Drop Ruby 2.4 support --- .github/workflows/ci.yml | 5 ----- Gemfile | 6 ++---- Rakefile | 12 +++++------- graphql-batch.gemspec | 2 +- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed0226c..0ba089f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,11 +12,6 @@ jobs: matrix: ruby: [2.7, 3.0, 3.1, 3.2, 3.3] graphql_version: ['~> 1.12.18', '~> 1.13', '~> 2.0'] - include: - - ruby: 2.4 - graphql_version: '~> 1.12.18' - - ruby: 2.4 - graphql_version: '~> 1.13' steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 diff --git a/Gemfile b/Gemfile index b61c9b1..66e5539 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,5 @@ source 'https://rubygems.org' gemspec gem 'graphql', ENV['GRAPHQL_VERSION'] if ENV['GRAPHQL_VERSION'] -if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0') - gem 'rubocop', '~> 1.61.0', require: false - gem "rubocop-shopify", '~> 1.0.7', require: false -end +gem 'rubocop', '~> 1.61.0', require: false +gem "rubocop-shopify", '~> 1.0.7', require: false diff --git a/Rakefile b/Rakefile index 6c6da42..21267af 100644 --- a/Rakefile +++ b/Rakefile @@ -9,11 +9,9 @@ end task(default: :test) -if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0') - task :rubocop do - require 'rubocop/rake_task' - RuboCop::RakeTask.new - end - - task(default: :rubocop) +task :rubocop do + require 'rubocop/rake_task' + RuboCop::RakeTask.new end + +task(default: :rubocop) diff --git a/graphql-batch.gemspec b/graphql-batch.gemspec index 18b44de..68dfd31 100644 --- a/graphql-batch.gemspec +++ b/graphql-batch.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/Shopify/graphql-batch" spec.license = "MIT" - spec.required_ruby_version = ">= 2.4" + spec.required_ruby_version = ">= 2.7" spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "exe" From 33fa8d20ee4a7ccf054652b3bf29bf1f150592c9 Mon Sep 17 00:00:00 2001 From: Scott Walkinshaw Date: Fri, 5 Apr 2024 13:38:58 -0400 Subject: [PATCH 5/5] Drop graphql 1.12 support --- .github/workflows/ci.yml | 2 +- graphql-batch.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ba089f..2edf964 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: ruby: [2.7, 3.0, 3.1, 3.2, 3.3] - graphql_version: ['~> 1.12.18', '~> 1.13', '~> 2.0'] + graphql_version: ['~> 1.13', '~> 2.0'] steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 diff --git a/graphql-batch.gemspec b/graphql-batch.gemspec index 68dfd31..b094bd8 100644 --- a/graphql-batch.gemspec +++ b/graphql-batch.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.metadata['allowed_push_host'] = "https://rubygems.org" - spec.add_runtime_dependency "graphql", ">= 1.12.18", "< 3" + spec.add_runtime_dependency "graphql", ">= 1.13", "< 3" spec.add_runtime_dependency "promise.rb", "~> 0.7.2" spec.add_development_dependency "byebug" if RUBY_ENGINE == 'ruby'