summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-03-22 17:06:31 +0900
committerGitHub <[email protected]>2018-03-22 17:06:31 +0900
commit8e8bc9e40b2054881cde7bb16b29173c9ca6a048 (patch)
treee42883e587d5145628e0a7998d1d2fb6fa28960d
parentfb78f1089304e09932f022800395a6c0f507dda0 (diff)
parent4940ddb9fcc1484730781a9a0b2e30957a8f6735 (diff)
downloadmruby-8e8bc9e40b2054881cde7bb16b29173c9ca6a048.tar.gz
mruby-8e8bc9e40b2054881cde7bb16b29173c9ca6a048.zip
Merge pull request #3974 from take-cheeze/repo_path
Add `:path` option for git repository.
-rw-r--r--doc/guides/mrbgems.md5
-rw-r--r--lib/mruby/build/load_gems.rb8
2 files changed, 10 insertions, 3 deletions
diff --git a/doc/guides/mrbgems.md b/doc/guides/mrbgems.md
index 258f405b5..8dac0dc86 100644
--- a/doc/guides/mrbgems.md
+++ b/doc/guides/mrbgems.md
@@ -26,6 +26,11 @@ conf.gem :github => 'masuidrive/mrbgems-example', :branch => 'master'
conf.gem :bitbucket => 'mruby/mrbgems-example', :branch => 'master'
```
+You can specify the sub directory of the repository with `:path` option:
+```ruby
+conf.gem github: 'mruby/mruby', path: 'mrbgems/mruby-socket'
+```
+
To use mrbgem from [mgem-list](https://github.com/mruby/mgem-list) use `:mgem` option:
```ruby
conf.gem :mgem => 'mruby-yaml'
diff --git a/lib/mruby/build/load_gems.rb b/lib/mruby/build/load_gems.rb
index b48df6510..723be6ffc 100644
--- a/lib/mruby/build/load_gems.rb
+++ b/lib/mruby/build/load_gems.rb
@@ -76,9 +76,6 @@ module MRuby
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]}"
@@ -108,6 +105,11 @@ module MRuby
# Jump to the top of the branch
git.run_checkout gemdir, branch if $pull_gems
end
+
+ gemdir << "/#{params[:path]}" if params[:path]
+ elsif params[:path]
+ require 'pathname'
+ gemdir = Pathname.new(params[:path]).absolute? ? params[:path] : "#{root}/#{params[:path]}"
else
fail "unknown gem option #{params}"
end