Skip to content

Commit

Permalink
Merge pull request solidusio#3985 from nebulab/kennyadsl/post-install…
Browse files Browse the repository at this point in the history
…-message

Add Post-Install message to Solidus 3.0
  • Loading branch information
kennyadsl authored and mamhoff committed Mar 29, 2021
2 parents 7fa3f8e + f9b317c commit 4d1cef6
Show file tree
Hide file tree
Showing 16 changed files with 65 additions and 415 deletions.
18 changes: 0 additions & 18 deletions core/app/models/spree/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,12 @@ class Spree::Base < ActiveRecord::Base
include Spree::Core::Permalinks
include Spree::RansackableAttributes

def preferences
read_attribute(:preferences) || self.class.preferences_coder_class.new
end

def initialize_preference_defaults
if has_attribute?(:preferences)
self.preferences = default_preferences.merge(preferences)
end
end

# Only run preference initialization on models which requires it. Improves
# performance of record initialization slightly.
def self.preference(*args)
# after_initialize can be called multiple times with the same symbol, it
# will only be called once on initialization.
serialize :preferences, preferences_coder_class
after_initialize :initialize_preference_defaults
super
end

def self.preferences_coder_class
Hash
end

self.abstract_class = true

# Provides a scope that should be included any time products
Expand Down
3 changes: 3 additions & 0 deletions core/app/models/spree/calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

module Spree
class Calculator < Spree::Base
serialize :preferences, Hash
after_initialize :initialize_preference_defaults

belongs_to :calculable, polymorphic: true, optional: true

# This method calls a compute_<computable> method. must be overriden in concrete calculator.
Expand Down
3 changes: 3 additions & 0 deletions core/app/models/spree/payment_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ module Spree
# This class is not meant to be instantiated. Please create instances of concrete payment methods.
#
class PaymentMethod < Spree::Base
serialize :preferences, Hash
after_initialize :initialize_preference_defaults

preference :server, :string, default: 'test'
preference :test_mode, :boolean, default: true

Expand Down
3 changes: 3 additions & 0 deletions core/app/models/spree/promotion_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ module Spree
# PromotionActions perform the necessary tasks when a promotion is activated
# by an event and determined to be eligible.
class PromotionAction < Spree::Base
serialize :preferences, Hash
after_initialize :initialize_preference_defaults

include Spree::SoftDeletable

belongs_to :promotion, class_name: 'Spree::Promotion', inverse_of: :promotion_actions, optional: true
Expand Down
3 changes: 3 additions & 0 deletions core/app/models/spree/promotion_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
module Spree
# Base class for all promotion rules
class PromotionRule < Spree::Base
serialize :preferences, Hash
after_initialize :initialize_preference_defaults

belongs_to :promotion, class_name: 'Spree::Promotion', inverse_of: :promotion_rules, optional: true

scope :of_type, ->(type) { where(type: type) }
Expand Down
158 changes: 0 additions & 158 deletions core/lib/tasks/migrations/migrate_address_names.rake

This file was deleted.

This file was deleted.

12 changes: 7 additions & 5 deletions core/lib/tasks/upgrade.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

namespace :solidus do
namespace :upgrade do
desc "Upgrade Solidus to version 2.11"
task two_point_eleven: [
'solidus:migrations:migrate_default_billing_addresses_to_address_book:up',
'solidus:migrations:migrate_address_names:up'
task three_point_zero: [
'railties:install:migrations',
'db:migrate'
] do
puts "Your Solidus install is ready for Solidus 2.11"
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
20 changes: 20 additions & 0 deletions core/solidus_core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,24 @@ Gem::Specification.new do |s|
s.add_dependency 'kt-paperclip', '~> 6.3'
s.add_dependency 'ransack', '~> 2.0'
s.add_dependency 'state_machines-activerecord', '~> 0.6'

s.post_install_message = <<-MSG
-------------------------------------------------------------
Thank you for using Solidus
-------------------------------------------------------------
If this is a fresh install, don't forget to run the Solidus
installer with the following command:
$ bin/rails g solidus:install
If you are updating Solidus from an older version, please run
the following commands to complete the update:
$ bin/rails solidus:upgrade
Please report any issues at:
- https://github.com/solidusio/solidus/issues
- http://slack.solidus.io/
-------------------------------------------------------------
MSG
end
Loading

0 comments on commit 4d1cef6

Please sign in to comment.