Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use bundler gem tasks instead of gem_release #5413

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .gem_release.yml

This file was deleted.

1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ group :utils do
gem 'rubocop', '~> 1', require: false
gem 'rubocop-performance', '~> 1.4', require: false
gem 'rubocop-rails', '~> 2.9', require: false
gem 'gem-release', require: false
end

gem 'rspec_junit_formatter', require: false, group: :ci
Expand Down
55 changes: 11 additions & 44 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'bundler'
require 'bundler/gem_tasks'

task default: :spec

Expand Down Expand Up @@ -53,55 +54,21 @@ task :clean do
end

SOLIDUS_GEM_NAMES = %w[core api backend sample]
GEM_TASKS_NAME = %w[build install]

namespace :gem do
def version
require_relative 'core/lib/spree/core/version'
Spree.solidus_version
end

def for_each_gem
GEM_TASKS_NAME.each do |task_name|
desc "Run rake gem:#{task} for each Solidus gem"
task task_name do
SOLIDUS_GEM_NAMES.each do |gem_name|
print_title(gem_name)
yield "pkg/solidus_#{gem_name}-#{version}.gem"
cd(gem_name) { sh "rake #{task_name}" }
end
print_title
yield "pkg/solidus-#{version}.gem"
end
end

desc "Build all solidus gems"
task :build do
pkgdir = File.expand_path('pkg', __dir__)
FileUtils.mkdir_p pkgdir

SOLIDUS_GEM_NAMES.each do |gem_name|
Dir.chdir(gem_name) do
sh "gem build solidus_#{gem_name}.gemspec"
mv "solidus_#{gem_name}-#{version}.gem", pkgdir
end
end

print_title
sh "gem build solidus.gemspec"
mv "solidus-#{version}.gem", pkgdir
end

desc "Install all solidus gems"
task install: :build do
for_each_gem do |gem_path|
Bundler.with_clean_env do
sh "gem install #{gem_path}"
end
end
end

desc "Release all gems to rubygems"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that all of this code was not used at all by gem-release. Instead, this was the previous system used to release (see #83). I think the subgems release was managed by the recurse option set in the gem-release config.

That said, I'm in favor of removing the dependency and simplifying the process but I have two concerns:

  1. I suspect with the proposed changes we are not releasing the main solidus gem but only the subgems.
  2. Having two different ways of releasing for new/older versions might create complications. Is there a way to uniform the two? Both having the same interface or backporting is ok for me, but if you have other ideas, they are welcome.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, yes the recurse option is what got in the way with solidus_admin.

  1. Good catch! Fixed 👍
  2. Added back ports labels for all supported versions

task release: :build do
sh "git tag -a -m \"Version #{version}\" v#{version}"

for_each_gem do |gem_path|
sh "gem push '#{gem_path}'"
end
task :releasez do
require_relative 'core/lib/spree/core/version'
SOLIDUS_GEM_NAMES.each do |gem_name|
sh "gem push #{gem_name}/pkg/solidus_#{gem_name}-#{Spree.solidus_version}.gem"
end
end

Expand Down
1 change: 1 addition & 0 deletions api/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ require 'rake'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'spree/testing_support/dummy_app/rake_tasks'
require 'bundler/gem_tasks'

RSpec::Core::RakeTask.new
task default: :spec
Expand Down
1 change: 1 addition & 0 deletions backend/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'bundler/gem_tasks'

require 'solidus_backend'
require 'spree/testing_support/dummy_app/rake_tasks'
Expand Down
1 change: 1 addition & 0 deletions core/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ require 'rake'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'spree/testing_support/dummy_app/rake_tasks'
require 'bundler/gem_tasks'

RSpec::Core::RakeTask.new
task default: :spec
Expand Down
1 change: 1 addition & 0 deletions sample/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ require 'rake'
require 'rake/testtask'
require 'rspec/core/rake_task'
require 'spree/testing_support/dummy_app/rake_tasks'
require 'bundler/gem_tasks'

RSpec::Core::RakeTask.new
task default: :spec
Expand Down