Skip to content

Commit

Permalink
Use bundler gem tasks instead of gem_release
Browse files Browse the repository at this point in the history
Now that we also have a solidus_admin that follows a different release
track we need more control over what gems are released. `gem_release`
has no such control available and simply has a configuration for
recursing. Also all the features of `gem_relerase` regarding version
numbers manipulation are no longer relevant as it all happens within
GitHub actions using dev_tools.

Bundler gem tasks are now the standard for all our extensions and are
a simpler, already available, tool that can be leveraged here as well.
  • Loading branch information
elia committed Oct 4, 2023
1 parent 743f888 commit 63fc31e
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 51 deletions.
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
48 changes: 5 additions & 43 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,55 +53,17 @@ task :clean do
end

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

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"
end
print_title
yield "pkg/solidus-#{version}.gem"
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
sh "rake #{task_name}"
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"
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
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

0 comments on commit 63fc31e

Please sign in to comment.