summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick LaMuro <nicklamuro@gmail.com>2017-08-08 18:40:50 -0500
committerNick LaMuro <nicklamuro@gmail.com>2017-08-14 15:56:50 -0500
commitd240d54a52107ba25049ebf7cf18910bd7c6d6d4 (patch)
tree7f259835b43db90939af45df24053b28d8d5a237
parent0d84c9c5156df8f722e91e961a63849b51a4ed11 (diff)
downloadbundler-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--Rakefile15
1 files 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")