Commit ab8a5aa5 authored by Yuichiro MASUI's avatar Yuichiro MASUI

Change default gem path.

parent b783311e
...@@ -9,10 +9,8 @@ load "#{MRUBY_ROOT}/tasks/mruby_build.rake" ...@@ -9,10 +9,8 @@ load "#{MRUBY_ROOT}/tasks/mruby_build.rake"
load "#{MRUBY_ROOT}/tasks/mrbgem_spec.rake" load "#{MRUBY_ROOT}/tasks/mrbgem_spec.rake"
# load configuration file # load configuration file
MRUBY_CONFIGS = ["#{MRUBY_ROOT}/build_config.rb", ENV['MRUBY_CONFIG']].compact MRUBY_CONFIG = (ENV['MRUBY_CONFIG'] && ENV['MRUBY_CONFIG'] != '') ? ENV['MRUBY_CONFIG'] : "#{MRUBY_ROOT}/build_config.rb"
MRUBY_CONFIGS.each do |config| load MRUBY_CONFIG
load config unless config.empty?
end
# load basic rules # load basic rules
MRuby.each_target do |build| MRuby.each_target do |build|
......
...@@ -12,22 +12,22 @@ MRuby::Build.new do |conf| ...@@ -12,22 +12,22 @@ MRuby::Build.new do |conf|
# conf.gem :git => 'git@github.com:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v' # conf.gem :git => 'git@github.com:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v'
# Use standard Math module # Use standard Math module
conf.gem 'mrbgems/mruby-math' conf.gem "#{root}/mrbgems/mruby-math"
# Use standard Time class # Use standard Time class
conf.gem 'mrbgems/mruby-time' conf.gem "#{root}/mrbgems/mruby-time"
# Use standard Struct class # Use standard Struct class
conf.gem 'mrbgems/mruby-struct' conf.gem "#{root}/mrbgems/mruby-struct"
# Use standard Kernel#sprintf method # Use standard Kernel#sprintf method
conf.gem 'mrbgems/mruby-sprintf' conf.gem "#{root}/mrbgems/mruby-sprintf"
# Use extensional String class # Use extensional String class
conf.gem 'mrbgems/mruby-string-ext' conf.gem "#{root}/mrbgems/mruby-string-ext"
# Use extensional Numeric class # Use extensional Numeric class
conf.gem 'mrbgems/mruby-numeric-ext' conf.gem "#{root}/mrbgems/mruby-numeric-ext"
# Generate binaries # Generate binaries
# conf.bins = %w(mrbc mruby mirb) # conf.bins = %w(mrbc mruby mirb)
......
...@@ -9,7 +9,7 @@ MRuby.each_target do ...@@ -9,7 +9,7 @@ MRuby.each_target do
# loader all gems # loader all gems
self.libmruby << objfile("#{build_dir}/mrbgems/gem_init") self.libmruby << objfile("#{build_dir}/mrbgems/gem_init")
file objfile("#{build_dir}/mrbgems/gem_init") => "#{build_dir}/mrbgems/gem_init.c" file objfile("#{build_dir}/mrbgems/gem_init") => "#{build_dir}/mrbgems/gem_init.c"
file "#{build_dir}/mrbgems/gem_init.c" => MRUBY_CONFIGS.flatten do |t| file "#{build_dir}/mrbgems/gem_init.c" => [MRUBY_CONFIG] do |t|
FileUtils.mkdir_p "#{build_dir}/mrbgems" FileUtils.mkdir_p "#{build_dir}/mrbgems"
open(t.name, 'w') do |f| open(t.name, 'w') do |f|
f.puts %Q[/*] f.puts %Q[/*]
......
module MRuby module MRuby
module LoadGems module LoadGems
def gem(gemdir, &block) def gem(gemdir, &block)
gemdir = load_external_gem(gemdir) if gemdir.is_a?(Hash) caller_dir = File.expand_path(File.dirname(/^(.*?):\d/.match(caller.first).to_a[1]))
if gemdir.is_a?(Hash)
gemdir = load_external_gem(gemdir)
else
gemdir = File.expand_path(gemdir, caller_dir)
end
gemrake = File.join(gemdir, "mrbgem.rake") gemrake = File.join(gemdir, "mrbgem.rake")
fail "Can't find #{gemrake}" unless File.exists?(gemrake) fail "Can't find #{gemrake}" unless File.exists?(gemrake)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment