Plugin gem install error when source is Taobao

Plugin uses gem failed because of a type error. It seems only happens when gem source is Taobao no matter which gems specified or plugin required them.

ERROR: While executing gem ... (TypeError)
no implicit conversion of nil into String
I, [2015-06-04T06:21:40.571504 #37] INFO -- : gem install akismet -v 1.0.2 -i /var/www/discourse/plugins/discourse-akismet/gems/2.0.0 --no-document --ignore-dependencies

The problem is that gem can’t be downloaded. However I can manually install the gem by putting the same command which is weird to me.

Bundler now supports inline Gemfile. Maybe helpful.

https://github.com/bundler/bundler/pull/3440

one option I discussed with andre is a git repo that has all the gems you can simply pull from.

I tried to add the following code in my plugin.rb

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'polymer-elements-rails', :github => "https://github.com/scarhand/polymer-elements-rails"
end

and I tried to launch bundle install (or also bundle exec bundle install) in the vagrant box, but it doesn’t seem to see it.

What I am doing wrong?