diff options
author | Nick LaMuro <nicklamuro@gmail.com> | 2017-08-08 18:40:50 -0500 |
---|---|---|
committer | Nick LaMuro <nicklamuro@gmail.com> | 2017-08-14 15:56:50 -0500 |
commit | d240d54a52107ba25049ebf7cf18910bd7c6d6d4 (patch) | |
tree | 7f259835b43db90939af45df24053b28d8d5a237 | |
parent | 0d84c9c5156df8f722e91e961a63849b51a4ed11 (diff) | |
download | bundler-d240d54a52107ba25049ebf7cf18910bd7c6d6d4.tar.gz |
Use universal rubygems method for installing gems
The current implementation for installing gems via `rake spec:deps`
builds a rubygems command that includes all of the gems in a single
oneliner with gem names and versions that are colon delimited:
$ ruby -S gem install --no-ri --no-rdoc --conservative 'automatiek:~> 1.0.0' 'mustache:0.99.6' ...
This functionality does not exist prior to rubygems 2.0, so this will
not function with the rubygems that ships with ruby 1.9.3
Splitting this into individual `ruby -S gem install` calls for rubygems
versions prior to 2.0, and using the `-v` flag allows this to function
on older implemetations.
-rw-r--r-- | Rakefile | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -47,10 +47,17 @@ namespace :spec do deps.delete("rdiscount") end - gem_install_command = "install --no-ri --no-rdoc --conservative " + deps.sort_by {|name, _| name }.map do |name, version| - "'#{name}:#{version}'" - end.join(" ") - sh %(#{Gem.ruby} -S gem #{gem_install_command}) + if Gem::VERSION < "2.0.0" + deps.sort_by {|name, _| name }.map do |name, version| + gem_install_command = "install --no-ri --no-rdoc --conservative #{name} -v '#{version}'" + sh %(#{Gem.ruby} -S gem #{gem_install_command}) + end + else + gem_install_command = "install --no-ri --no-rdoc --conservative " + deps.sort_by {|name, _| name }.map do |name, version| + "'#{name}:#{version}'" + end.join(" ") + sh %(#{Gem.ruby} -S gem #{gem_install_command}) + end # Download and install gems used inside tests $LOAD_PATH.unshift("./spec") |