summaryrefslogtreecommitdiffhomepage
path: root/tasks/mruby_build_gem.rake
diff options
context:
space:
mode:
authorAsmod4n <[email protected]>2015-09-17 13:24:17 +0200
committerAsmod4n <[email protected]>2015-09-17 13:24:17 +0200
commite6d9b450bab46f218e6bee2c95114b733660951a (patch)
treee6e296d99ad3780e769a5bae0d71bb5a6de75c9a /tasks/mruby_build_gem.rake
parent13a2cc3e5d27c33db7f4cf06ece4c44a79c79c53 (diff)
parent070e04ea22d832c323e56ff75242f08ca3022fa8 (diff)
downloadmruby-e6d9b450bab46f218e6bee2c95114b733660951a.tar.gz
mruby-e6d9b450bab46f218e6bee2c95114b733660951a.zip
Merge remote-tracking branch 'mruby/master'
Diffstat (limited to 'tasks/mruby_build_gem.rake')
-rw-r--r--tasks/mruby_build_gem.rake24
1 files changed, 24 insertions, 0 deletions
diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake
index dbbade487..896aeb147 100644
--- a/tasks/mruby_build_gem.rake
+++ b/tasks/mruby_build_gem.rake
@@ -52,10 +52,33 @@ module MRuby
else
params[:git] = "https://bitbucket.org/#{params[:bitbucket]}.git"
end
+ elsif params[:mgem]
+ mgem_list_dir = "#{gem_clone_dir}/mgem-list"
+ mgem_list_url = 'https://github.com/mruby/mgem-list.git'
+ if File.exist? mgem_list_dir
+ git.run_pull mgem_list_dir, mgem_list_url if $pull_gems
+ else
+ FileUtils.mkdir_p mgem_list_dir
+ git.run_clone mgem_list_dir, mgem_list_url, "--depth 1"
+ end
+
+ require 'yaml'
+
+ conf_path = "#{mgem_list_dir}/#{params[:mgem]}.gem"
+ conf_path = "#{mgem_list_dir}/mruby-#{params[:mgem]}.gem" unless File.exist? conf_path
+ fail "mgem not found: #{params[:mgem]}" unless File.exist? conf_path
+ conf = YAML.load File.read conf_path
+
+ fail "unknown mgem protocol: #{conf['protocol']}" if conf['protocol'] != 'git'
+ params[:git] = conf['repository']
+ params[:branch] = conf['branch'] if conf['branch']
end
if params[:core]
gemdir = "#{root}/mrbgems/#{params[:core]}"
+ elsif params[:path]
+ require 'pathname'
+ gemdir = Pathname.new(params[:path]).absolute? ? params[:path] : "#{root}/#{params[:path]}"
elsif params[:git]
url = params[:git]
gemdir = "#{gem_clone_dir}/#{url.match(/([-\w]+)(\.[-\w]+|)$/).to_a[1]}"
@@ -71,6 +94,7 @@ module MRuby
end
else
options = [params[:options]] || []
+ options << "--recursive"
options << "--branch \"#{branch}\""
options << "--depth 1" unless params[:checksum_hash]
FileUtils.mkdir_p "#{gem_clone_dir}"