-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
66 lines (56 loc) · 1.84 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
# frozen_string_literal: true
MRUBY_CONFIG = File.expand_path(ENV['MRUBY_CONFIG'] || File.join('build_configs', 'ci.rb'))
MRUBY_VERSION = ENV['MRUBY_VERSION'] || '3.2.0'
require_relative 'build_configs/utils/gems'
file :mruby do
sh 'git clone --depth=1 https://github.com/mruby/mruby.git'
if MRUBY_VERSION != 'master'
Dir.chdir 'mruby' do
sh 'git fetch --tags'
rev = `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
exit 0 unless File.directory?('mruby')
sh 'cd mruby && rake deep_clean'
end
task doc_files: :mruby do
GITHUB_GEMS.each do |gem|
unless File.exist?(".doc_tmp/#{gem}")
sh "git clone https://github.com/#{gem}.git .doc_tmp/#{gem}"
end
end
end
desc 'generate documentation'
task docs: :doc_files do
gem_list = CARBUNCLE_GEMS.map {|i| "carbuncle-#{i}" }.join(',')
core_gems = CORE_GEMS.join(',')
carbuncle_dirs = "gems/{#{gem_list}}/{src,mrblib}/{**}/*.{rb,c}"
mruby_dirs = "mruby/{src,mrblib}/*.{c,rb} mruby/mrbgems/{#{core_gems}}/{src,mrblib}/**/*.{c,rb}"
github_dirs = ".doc_tmp/**/{src,mrblib}/*.{c,rb}"
gem_files = "#{carbuncle_dirs} #{mruby_dirs} #{github_dirs}"
sh "mrbdoc #{gem_files} -o website/out/docs"
end
desc 'move bin folder'
task bins: :compile do
dst_folder = File.join(__dir__, 'bin')
FileUtils.mkdir_p(dst_folder)
Dir[File.join(__dir__, 'mruby', 'bin', '*')].each do |src|
name = File.basename(src)
dst = File.join(dst_folder, name)
FileUtils.rm_r(dst) if File.exist?(dst)
FileUtils.cp_r(src, dst)
end
end
task default: :bins