Sha256: 68a5d534f329e97d3aa3b6c36687ab1a13aa6a1815703bc2a1c6ce319de59108
Contents?: true
Size: 788 Bytes
Versions: 28
Compression:
Stored size: 788 Bytes
Contents
require 'spree_core' module Spree module Sample def self.load_sample(file) # If file is exists within application it takes precendence. if File.exists?(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 self.samples_path Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'db', 'samples')) end end end
Version data entries
28 entries across 28 versions & 1 rubygems