1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/bundler/support/sudo.rb
2022-05-20 17:32:19 +09:00

22 lines
473 B
Ruby

# frozen_string_literal: true
module Spec
module Sudo
def self.present?
@which_sudo ||= Bundler.which("sudo")
end
def self.write_safe_config
File.write(Spec::Path.tmp("gitconfig"), "[safe]\n\tdirectory = #{Spec::Path.git_root}")
end
def sudo(cmd)
raise "sudo not present" unless Sudo.present?
sys_exec("sudo #{cmd}")
end
def chown_system_gems_to_root
sudo "chown -R root #{system_gem_path}"
end
end
end