Sha256: 35b855487d3a29f2b0ffda5d031a79104d33240d5559847f5c2955da8849d99d
Contents?: true
Size: 834 Bytes
Versions: 43
Compression:
Stored size: 834 Bytes
Contents
require 'spree_core' module Spree module Sample class << self def load_sample(file) # 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) require path puts "Loaded #{file.titleize} samples" end end private def samples_path Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'db', 'samples')) end end end end
Version data entries
43 entries across 43 versions & 1 rubygems