Sha256: 2a8a0acbf010d3a8b41740a5fa69ff0018f8bc2cb2cf94b6b2be022a8ddb1a41

Contents?: true

Size: 776 Bytes

Versions: 84

Compression:

Stored size: 776 Bytes

Contents

module Spree
  module Sample
    def self.load_sample(file)
      # If file exists within application it takes precendence.
      path = if File.exist?(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
               File.expand_path(File.join(Rails.root, 'db', 'samples', "#{file}.rb"))
             else
               # Otherwise we will use this gems default file.
               File.expand_path(samples_path + "#{file}.rb")
             end
      # Check to see if the specified file has been loaded before
      unless $LOADED_FEATURES.include?(path)
        require path
        puts "Loaded #{file.titleize} samples"
      end
    end

    def self.samples_path
      Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'db', 'samples'))
    end
  end
end

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
spree_sample-4.0.9 lib/spree/sample.rb
spree_sample-4.1.15 lib/spree/sample.rb
spree_sample-4.2.7 lib/spree/sample.rb
spree_sample-4.3.3 lib/spree/sample.rb
spree_sample-4.2.6 lib/spree/sample.rb
spree_sample-4.3.2 lib/spree/sample.rb
spree_sample-4.3.1 lib/spree/sample.rb
spree_sample-4.3.0 lib/spree/sample.rb
spree_sample-4.3.0.rc3 lib/spree/sample.rb
spree_sample-4.3.0.rc2 lib/spree/sample.rb
spree_sample-4.3.0.rc1 lib/spree/sample.rb
spree_sample-4.2.5 lib/spree/sample.rb
spree_sample-4.1.14 lib/spree/sample.rb
spree_sample-4.0.8 lib/spree/sample.rb
spree_sample-4.2.4 lib/spree/sample.rb
spree_sample-3.7.14.1 lib/spree/sample.rb
spree_sample-4.2.3.1 lib/spree/sample.rb
spree_sample-4.1.13.1 lib/spree/sample.rb
spree_sample-4.0.7.1 lib/spree/sample.rb
spree_sample-4.2.3 lib/spree/sample.rb