lib/hoe/travis.rb in hoe-travis-1.4 vs lib/hoe/travis.rb in hoe-travis-1.4.1

- old
+ new

@@ -109,11 +109,11 @@ module Hoe::Travis ## # This version of Hoe::Travis - VERSION = '1.4' + VERSION = '1.4.1' YAML_EXCEPTIONS = if defined?(Psych) then # :nodoc: if Psych.const_defined? :Exception then [Psych::SyntaxError] # Ruby 1.9.2 else @@ -596,5 +596,31 @@ end end end end + +require 'hoe/package' + +## +# Override Hoe::Package#install_gem that does not work with RubyGems 3 + +module Hoe::Package + remove_method :install_gem + def install_gem name, version = nil, rdoc = true + should_not_sudo = Hoe::WINDOZE || ENV["NOSUDO"] || File.writable?(Gem.dir) + null_dev = Hoe::WINDOZE ? "> NUL 2>&1" : "> /dev/null 2>&1" + + gem_cmd = Gem.default_exec_format % "gem" + sudo = "sudo " unless should_not_sudo + local = "--local" unless version + version = "--version '#{version}'" if version + + cmd = "#{sudo}#{gem_cmd} install #{local} #{name} #{version}" + cmd += " --no-document" unless rdoc + cmd += " #{null_dev}" unless Rake.application.options.trace + + puts cmd if Rake.application.options.trace + system cmd + end +end +