lib/spree/sample.rb in solidus_sample-3.2.9 vs lib/spree/sample.rb in solidus_sample-3.3.0
- old
+ new
@@ -1,22 +1,24 @@
# frozen_string_literal: true
+require 'thor'
require 'spree_core'
+
module Spree
module Sample
class << self
- def load_sample(file)
+ def load_sample(file, shell: Thor::Base.shell.new)
# If file is exists within application it takes precendence.
if File.exist?(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
path = File.expand_path(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
else
# Otherwise we will use this gems default file.
path = File.expand_path(samples_path + "#{file}.rb")
end
# Check to see if the specified file has been loaded before
- if !$LOADED_FEATURES.include?(path)
+ unless $LOADED_FEATURES.include?(path)
+ shell.say_status :sample, file.titleize
require path
- puts "Loaded #{file.titleize} samples"
end
end
private