2 require 'rubygems/package_task'
5 require 'spree/testing_support/common_rake'
7 raise "Could not find spree/testing_support/common_rake. You need to run this command using Bundler."
10 SPREE_GEMS = %w(core api cmd backend emails frontend sample).freeze
14 desc "Runs all tests in all Spree engines"
15 task test: :test_app do
16 SPREE_GEMS.each do |gem_name|
17 Dir.chdir("#{File.dirname(__FILE__)}/#{gem_name}") do
23 desc "Generates a dummy app for testing for every Spree engine"
25 SPREE_GEMS.each do |gem_name|
26 Dir.chdir("#{File.dirname(__FILE__)}/#{gem_name}") do
32 desc "clean the whole repository by removing all the generated files"
38 SPREE_GEMS.each do |gem_name|
39 rm_f "#{gem_name}/Gemfile.lock"
40 rm_rf "#{gem_name}/pkg"
41 rm_rf "#{gem_name}/spec/dummy"
47 require 'spree/core/version'
52 SPREE_GEMS.each do |gem_name|
53 yield "pkg/spree_#{gem_name}-#{version}.gem"
55 yield "pkg/spree-#{version}.gem"
58 desc "Build all spree gems"
60 pkgdir = File.expand_path("../pkg", __FILE__)
61 FileUtils.mkdir_p pkgdir
63 SPREE_GEMS.each do |gem_name|
64 Dir.chdir(gem_name) do
65 sh "gem build spree_#{gem_name}.gemspec"
66 mv "spree_#{gem_name}-#{version}.gem", pkgdir
70 sh "gem build spree.gemspec"
71 mv "spree-#{version}.gem", pkgdir
74 desc "Install all spree gems"
75 task install: :build do
76 for_each_gem do |gem_path|
77 Bundler.with_clean_env do
78 sh "gem install #{gem_path}"
83 desc "Release all gems to rubygems"
84 task release: :build do
85 sh "git tag -a -m \"Version #{version}\" v#{version}"
87 for_each_gem do |gem_path|
88 sh "gem push '#{gem_path}'"
93 desc "Creates a sandbox application for simulating the Spree code in a deployed Rails app"
95 Bundler.with_clean_env do
96 exec("bin/sandbox.sh")