Sha256: 46ec2e4d40369a7e8b7b010802bcd6a744cda9ddefda45d2dc39af7065010507

Contents?: true

Size: 593 Bytes

Versions: 4

Compression:

Stored size: 593 Bytes

Contents

require 'find'
# make sure the product images directory exists
FileUtils.mkdir_p "#{Rails.root}/public/assets/products/"

# make product images available to the app
target = "#{Rails.root}/public/assets/products/"
source = "#{SPREE_ROOT}/lib/tasks/sample/products/"

Find.find(source) do |f|
  # omit hidden directories (SVN, etc.)
  if File.basename(f) =~ /^[.]/
    Find.prune
    next
  end

  src_path = source + f.sub(source, '')
  target_path = target + f.sub(source, '')

  if File.directory?(f)
    FileUtils.mkdir_p target_path
  else
    FileUtils.cp src_path, target_path
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree-0.11.4 db/sample/products.rb
spree-0.11.3 db/sample/products.rb
spree-0.11.2 db/sample/products.rb
spree-0.11.1 db/sample/products.rb