diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-20 21:26:36 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-04-20 21:26:36 +0900 |
| commit | 1abac345cf409c930f7ab973de36dca4ba4b0931 (patch) | |
| tree | b2e42884c11bd993b4876e6c4ee2dafe60864359 /tasks/mruby_build_gem.rake | |
| parent | 21ae09c0a05041a1bc08e274d26fca88be3fa7c0 (diff) | |
| parent | 874bec2af5800b0847d702999efbe796b1c20cfa (diff) | |
| download | mruby-1abac345cf409c930f7ab973de36dca4ba4b0931.tar.gz mruby-1abac345cf409c930f7ab973de36dca4ba4b0931.zip | |
Merge pull request #2086 from bovi/checksum_hash
Implement :checksum_hash mrbgem option
Diffstat (limited to 'tasks/mruby_build_gem.rake')
| -rw-r--r-- | tasks/mruby_build_gem.rake | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tasks/mruby_build_gem.rake b/tasks/mruby_build_gem.rake index 42d0d6b89..766266680 100644 --- a/tasks/mruby_build_gem.rake +++ b/tasks/mruby_build_gem.rake @@ -59,6 +59,9 @@ module MRuby url = params[:git] gemdir = "#{gem_clone_dir}/#{url.match(/([-\w]+)(\.[-\w]+|)$/).to_a[1]}" + # by default the 'master' branch is used + branch = params[:branch] ? params[:branch] : 'master' + if File.exist?(gemdir) if $pull_gems git.run_pull gemdir, url @@ -67,10 +70,19 @@ module MRuby end else options = [params[:options]] || [] - options << "--branch \"#{params[:branch]}\"" if params[:branch] + options << "--branch \"#{branch}\"" + options << "--depth 1" unless params[:checksum_hash] FileUtils.mkdir_p "#{gem_clone_dir}" git.run_clone gemdir, url, options end + + if params[:checksum_hash] + # Jump to the specified commit + git.run_checkout gemdir, params[:checksum_hash] + else + # Jump to the top of the branch + git.run_checkout gemdir, branch + end else fail "unknown gem option #{params}" end |
