forked from solidusio/solidus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
95 lines (81 loc) · 2.33 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
require 'rake'
require 'thor/group'
begin
require 'spree/testing_support/common_rake'
rescue LoadError
raise "Could not find spree/testing_support/common_rake. You need to run this command using Bundler."
exit
end
task default: :test
desc "Runs all tests in all Spree engines"
task :test => :test_app do
%w(api backend core frontend sample).each do |gem_name|
Dir.chdir("#{File.dirname(__FILE__)}/#{gem_name}") do
sh 'rspec'
end
end
end
desc "Generates a dummy app for testing for every Spree engine"
task :test_app do
%w(api backend core frontend sample).each do |engine|
ENV['LIB_NAME'] = File.join('spree', engine)
ENV['DUMMY_PATH'] = File.expand_path("../#{engine}/spec/dummy", __FILE__)
Rake::Task['common:test_app'].execute
end
end
desc "clean the whole repository by removing all the generated files"
task :clean do
rm_f "Gemfile.lock"
rm_rf "sandbox"
rm_rf "pkg"
%w(api backend core frontend sample).each do |gem_name|
rm_f "#{gem_name}/Gemfile.lock"
rm_rf "#{gem_name}/pkg"
rm_rf "#{gem_name}/spec/dummy"
end
end
namespace :gem do
def version
File.read(File.expand_path("../SOLIDUS_VERSION", __FILE__)).strip
end
def for_each_gem
%w(core api backend frontend sample).each do |gem_name|
yield "pkg/solidus_#{gem_name}-#{version}.gem"
end
yield "pkg/solidus-#{version}.gem"
end
desc "Build all solidus gems"
task :build do
pkgdir = File.expand_path("../pkg", __FILE__)
FileUtils.mkdir_p pkgdir
%w(core api backend frontend sample).each do |gem_name|
Dir.chdir(gem_name) do
sh "gem build solidus_#{gem_name}.gemspec"
mv "solidus_#{gem_name}-#{version}.gem", pkgdir
end
end
sh "gem build solidus.gemspec"
mv "solidus-#{version}.gem", pkgdir
end
desc "Install all solidus gems"
task :install => :build do
for_each_gem do |gem_path|
Bundler.with_clean_env do
sh "gem install #{gem_path}"
end
end
end
desc "Release all gems to rubygems"
task :release => :build do
sh "git tag -a -m \"Version #{version}\" v#{version}"
for_each_gem do |gem_path|
sh "gem push '#{gem_path}'"
end
end
end
desc "Creates a sandbox application for simulating the Spree code in a deployed Rails app"
task :sandbox do
Bundler.with_clean_env do
exec("lib/sandbox.sh")
end
end