Skip to content

Commit

Permalink
Refactor gemfiles
Browse files Browse the repository at this point in the history
We aren't using groups, so we can take a simpler approach by keeping runtime
dependencies in the gemspec, and everything else in Gemfile.

We can also use eval_gemfile to avoid repeating ourselves.

Instance variable approach based on Shopify/maintenance_tasks.
  • Loading branch information
sambostock committed Mar 10, 2022
1 parent 26cd95f commit 0de978c
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 51 deletions.
15 changes: 9 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ source "https://rubygems.org"

gemspec

group :deployment do
gem "rake"
gem "rubocop"
end
gem "bundler"
gem "minitest"
gem "rake"
gem "rspec"
gem "rubocop-shopify"

group :test do
gem "rubocop-shopify"
if defined?(@activesupport_gem_requirement) && @activesupport_gem_requirement
# causes Dependabot to ignore the next line
activesupport = "activesupport"
gem activesupport, @activesupport_gem_requirement
end
7 changes: 3 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ PLATFORMS
ruby

DEPENDENCIES
bundler (>= 1.16)
bundler
deprecation_toolkit!
minitest (~> 5.0)
minitest
rake
rspec (~> 3.0)
rubocop
rspec
rubocop-shopify

BUNDLED WITH
Expand Down
5 changes: 0 additions & 5 deletions deprecation_toolkit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,4 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_runtime_dependency("activesupport", ">= 5.2")

spec.add_development_dependency("bundler", ">= 1.16")
spec.add_development_dependency("minitest", "~> 5.0")
spec.add_development_dependency("rake", "~> 10.0")
spec.add_development_dependency("rspec", "~> 3.0")
end
11 changes: 2 additions & 9 deletions gemfiles/activesupport_5.2.gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"
@activesupport_gem_requirement = "~> 5.2"

gem "activesupport", "~> 5.2"

group :deployment do
gem "rake"
gem "rubocop"
end

gemspec path: "../"
eval_gemfile "../Gemfile"
11 changes: 2 additions & 9 deletions gemfiles/activesupport_6.0.gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"
@activesupport_gem_requirement = "~> 6.0"

gem "activesupport", "~> 6.0"

group :deployment do
gem "rake"
gem "rubocop"
end

gemspec path: "../"
eval_gemfile "../Gemfile"
11 changes: 2 additions & 9 deletions gemfiles/activesupport_6.1.gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"
@activesupport_gem_requirement = "~> 6.1"

gem "activesupport", "~> 6.1"

group :deployment do
gem "rake"
gem "rubocop"
end

gemspec path: "../"
eval_gemfile "../Gemfile"
11 changes: 2 additions & 9 deletions gemfiles/activesupport_7.0.gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"
@activesupport_gem_requirement = "~> 7.0"

gem "activesupport", "~> 7.0"

group :deployment do
gem "rake"
gem "rubocop"
end

gemspec path: "../"
eval_gemfile "../Gemfile"

0 comments on commit 0de978c

Please sign in to comment.