From d240d54a52107ba25049ebf7cf18910bd7c6d6d4 Mon Sep 17 00:00:00 2001 From: Nick LaMuro Date: Tue, 8 Aug 2017 18:40:50 -0500 Subject: 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. --- Rakefile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index 6f08086731..ff73441bd4 100644 --- a/Rakefile +++ b/Rakefile @@ -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") -- cgit v1.2.1