-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathmkmruby
More file actions
executable file
·45 lines (38 loc) · 950 Bytes
/
mkmruby
File metadata and controls
executable file
·45 lines (38 loc) · 950 Bytes
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
#!/usr/bin/env ruby
require "pathname"
require "rake"
MRUBY_DIR = Pathname.new(__dir__).join("../ext/mruby_engine/mruby")
raise(<<-MESSAGE) unless Dir.exist?(MRUBY_DIR.join("src"))
The mruby source code appears to be missing. Did you clone this gem with
submodules? If that is not the case or you are unsure, you can run the
following commands:
$ git submodule init
$ git submodule update
MESSAGE
def within_mruby
Dir.chdir(MRUBY_DIR) do
original_mruby_config = ENV['MRUBY_CONFIG']
begin
ENV['MRUBY_CONFIG'] = '../mruby_config.rb'
yield
ensure
ENV['MRUBY_CONFIG'] = original_mruby_config
end
end
end
case ARGV[0]
when "compile"
within_mruby do
sh("ruby", "./minirake")
end
when "clean"
within_mruby do
sh("ruby", "./minirake", "clean")
end
when "clobber"
within_mruby do
sh("ruby", "./minirake", "deep_clean")
end
else
puts("#{__FILE__} compile|clean|clobber")
end