-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
48 lines (39 loc) · 1.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
# Rakefile for gem development.
MRUBY_CONFIG=File.expand_path(ENV["MRUBY_CONFIG"] || "test_build_config.rb")
MRUBY_VERSION=ENV["MRUBY_VERSION"] || "stable"
# Rule to check out the mruby sources indicated in MRUBY_VERSION to
# use for gem development.
file :mruby do
# If we're using one of the common branches, we can clone it
# directly and also skip a lot of the history, letting us save some
# bandwidth. Otherwise, we need to fetch the whole thing and then
# checkout the desired commit.
common_branch = %w{master stable}.include?(MRUBY_VERSION)
depth = "--depth=1 --branch=#{MRUBY_VERSION}" if common_branch
sh "git clone #{depth} https://github.com/mruby/mruby.git"
unless common_branch
Dir.chdir 'mruby' do
sh "git fetch --tags"
rev = %x{git rev-parse #{MRUBY_VERSION}}
sh "git checkout #{rev}"
end
end
end
desc "compile binary"
task :compile => :mruby do
sh "cd mruby && rake all MRUBY_CONFIG=#{MRUBY_CONFIG}"
end
desc "test"
task :test => :mruby do
sh "cd mruby && rake all test MRUBY_CONFIG=#{MRUBY_CONFIG}"
end
desc "cleanup"
task :clean do
sh "cd mruby && rake deep_clean" if File.directory?('mruby')
sh "rm -rf *.lock test_support/*.mrb tools_ruby/*/*.mrb"
end
task :default => :compile
desc "thorough cleanup; gemdev only"
task :spotless => :clean do
sh "rm -rf mruby *.lock"
end