summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYuichiro MASUI <[email protected]>2013-03-10 14:19:14 +0900
committerYuichiro MASUI <[email protected]>2013-03-10 14:51:59 +0900
commitab8a5aa57272d081196061a89094789e15f696a4 (patch)
treef185ebb5f3fbcd4171d87b19fac208b250f11fa3
parentb783311ec442d4b27f67ecb287c413cac36df147 (diff)
downloadmruby-ab8a5aa57272d081196061a89094789e15f696a4.tar.gz
mruby-ab8a5aa57272d081196061a89094789e15f696a4.zip
Change default gem path.
-rw-r--r--Rakefile6
-rw-r--r--build_config.rb12
-rw-r--r--tasks/mrbgems.rake2
-rw-r--r--tasks/mruby_build_gem.rake7
4 files changed, 15 insertions, 12 deletions
diff --git a/Rakefile b/Rakefile
index b910e824a..9c0711453 100644
--- a/Rakefile
+++ b/Rakefile
@@ -9,10 +9,8 @@ load "#{MRUBY_ROOT}/tasks/mruby_build.rake"
load "#{MRUBY_ROOT}/tasks/mrbgem_spec.rake"
# load configuration file
-MRUBY_CONFIGS = ["#{MRUBY_ROOT}/build_config.rb", ENV['MRUBY_CONFIG']].compact
-MRUBY_CONFIGS.each do |config|
- load config unless config.empty?
-end
+MRUBY_CONFIG = (ENV['MRUBY_CONFIG'] && ENV['MRUBY_CONFIG'] != '') ? ENV['MRUBY_CONFIG'] : "#{MRUBY_ROOT}/build_config.rb"
+load MRUBY_CONFIG
# load basic rules
MRuby.each_target do |build|
diff --git a/build_config.rb b/build_config.rb
index f697ec97d..7ca020527 100644
--- a/build_config.rb
+++ b/build_config.rb
@@ -12,22 +12,22 @@ MRuby::Build.new do |conf|
# conf.gem :git => '[email protected]:masuidrive/mrbgems-example.git', :branch => 'master', :options => '-v'
# Use standard Math module
- conf.gem 'mrbgems/mruby-math'
+ conf.gem "#{root}/mrbgems/mruby-math"
# Use standard Time class
- conf.gem 'mrbgems/mruby-time'
+ conf.gem "#{root}/mrbgems/mruby-time"
# Use standard Struct class
- conf.gem 'mrbgems/mruby-struct'
+ conf.gem "#{root}/mrbgems/mruby-struct"
# Use standard Kernel#sprintf method
- conf.gem 'mrbgems/mruby-sprintf'
+ conf.gem "#{root}/mrbgems/mruby-sprintf"
# Use extensional String class
- conf.gem 'mrbgems/mruby-string-ext'
+ conf.gem "#{root}/mrbgems/mruby-string-ext"
# Use extensional Numeric class
- conf.gem 'mrbgems/mruby-numeric-ext'
+ conf.gem "#{root}/mrbgems/mruby-numeric-ext"
# Generate binaries
# conf.bins = %w(mrbc mruby mirb)
diff --git a/tasks/mrbgems.rake b/tasks/mrbgems.rake
index 17f266105..2d670227f 100644
--- a/tasks/mrbgems.rake
+++ b/tasks/mrbgems.rake
@@ -9,7 +9,7 @@ MRuby.each_target do
# loader all gems
self.libmruby << objfile("#{build_dir}/mrbgems/gem_init")
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"
open(t.name, 'w') do |f|
f.puts %Q[/*]
diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake
index 9f5804406..24f53a501 100644
--- a/tasks/mruby_build_gem.rake
+++ b/tasks/mruby_build_gem.rake
@@ -1,7 +1,12 @@
module MRuby
module LoadGems
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")
fail "Can't find #{gemrake}" unless File.exists?(gemrake)