diff --git a/core/lib/generators/solidus/update/update_generator.rb b/core/lib/generators/solidus/update/update_generator.rb index 23166fba897..b32f1c00b14 100644 --- a/core/lib/generators/solidus/update/update_generator.rb +++ b/core/lib/generators/solidus/update/update_generator.rb @@ -57,6 +57,22 @@ def create_new_defaults_initializer File.join(options[:initializer_directory], "#{options[:initializer_basename]}.rb") end + def print_message + say <<~MSG + + *********************************************************************** + + Other tasks may be needed to update to the new Solidus version. Please, + check https://github.com/solidusio/solidus/blob/v#{options[:to]}/CHANGELOG.md + for details. + + Thanks for using Solidus! + + *********************************************************************** + + MSG + end + private def core_changes_template(from, to) diff --git a/core/lib/tasks/migrations/delete_prices_with_nil_amount.rake b/core/lib/tasks/migrations/delete_prices_with_nil_amount.rake deleted file mode 100644 index 96cbaafda3b..00000000000 --- a/core/lib/tasks/migrations/delete_prices_with_nil_amount.rake +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -namespace :solidus do - namespace :migrations do - namespace :delete_prices_with_nil_amount do - task up: :environment do - print "Deleting prices wich amount attribute is nil ... " - Spree::Price.where(amount: nil).delete_all - puts "Success" - end - end - end -end diff --git a/core/lib/tasks/solidus/delete_prices_with_nil_amount.rake b/core/lib/tasks/solidus/delete_prices_with_nil_amount.rake new file mode 100644 index 00000000000..abc328d3105 --- /dev/null +++ b/core/lib/tasks/solidus/delete_prices_with_nil_amount.rake @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +namespace :solidus do + desc "Delete Spree::Price records which amount field is NULL" + task delete_prices_with_nil_amount: :environment do + Spree::Price.where(amount: nil).delete_all + end +end diff --git a/core/lib/tasks/upgrade.rake b/core/lib/tasks/upgrade.rake deleted file mode 100644 index 4d64116c37f..00000000000 --- a/core/lib/tasks/upgrade.rake +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -namespace :solidus do - namespace :upgrade do - task three_point_zero: [ - 'railties:install:migrations', - 'db:migrate' - ] do - puts "Your Solidus install is ready for Solidus 3.0" - end - - desc "Upgrade Solidus to version 3.0" - task three_point_zero: [ - 'solidus:migrations:delete_prices_with_nil_amount:up', - ] do - puts "Your Solidus install is ready for Solidus 3.0" - end - end - - desc "Upgrade to the current Solidus version" - task upgrade: 'upgrade:three_point_zero' -end diff --git a/core/spec/lib/tasks/migrations/delete_prices_with_nil_amount_spec.rb b/core/spec/lib/tasks/solidus/delete_prices_with_nil_amount_spec.rb similarity index 62% rename from core/spec/lib/tasks/migrations/delete_prices_with_nil_amount_spec.rb rename to core/spec/lib/tasks/solidus/delete_prices_with_nil_amount_spec.rb index 331fab94b89..e875b1acb8c 100644 --- a/core/spec/lib/tasks/migrations/delete_prices_with_nil_amount_spec.rb +++ b/core/spec/lib/tasks/solidus/delete_prices_with_nil_amount_spec.rb @@ -2,14 +2,14 @@ require 'rails_helper' -path = Spree::Core::Engine.root.join('lib/tasks/migrations/delete_prices_with_nil_amount.rake') +path = Spree::Core::Engine.root.join('lib/tasks/solidus/delete_prices_with_nil_amount.rake') -RSpec.describe 'solidus:migrations:delete_prices_with_nil_amount' do - describe 'up' do +RSpec.describe 'solidus' do + describe 'delete_prices_with_nil_amount' do include_context( 'rake', task_path: path, - task_name: 'solidus:migrations:delete_prices_with_nil_amount:up' + task_name: 'solidus:delete_prices_with_nil_amount' ) it 'removes all prices which amount column is NULL' do