class RubyInstaller::Build::Components::Base
Attributes
msys[W]
pacman_args[RW]
task_index[RW]
Public Class Methods
depends()
click to toggle source
# File lib/ruby_installer/build/components/base.rb, line 11 def self.depends [] end
new(*_)
click to toggle source
Calls superclass method
# File lib/ruby_installer/build/components/base.rb, line 15 def initialize(*_) @msys = nil enable_colors super end
Public Instance Methods
msys()
click to toggle source
# File lib/ruby_installer/build/components/base.rb, line 21 def msys @msys ||= BuildOrRuntime.msys2_installation end
puts(*args)
click to toggle source
# File lib/ruby_installer/build/components/base.rb, line 52 def puts(*args) $stderr.puts *args end
run_verbose(*args)
click to toggle source
# File lib/ruby_installer/build/components/base.rb, line 47 def run_verbose(*args) puts "> #{ cyan(shell_join(args)) }" system(*args) end
shell_escape(str)
click to toggle source
This is extracted from github.com/larskanis/shellwords
# File lib/ruby_installer/build/components/base.rb, line 26 def shell_escape(str) str = str.to_s # An empty argument will be skipped, so return empty quotes. return '""' if str.empty? str = str.dup str.gsub!(/((?:\\)*)"/){ "\\" * ($1.length*2) + "\\\"" } if str =~ /\s/ str.gsub!(/(\\+)\z/){ "\\" * ($1.length*2) } str = "\"#{str}\"" end return str end
shell_join(array)
click to toggle source
# File lib/ruby_installer/build/components/base.rb, line 43 def shell_join(array) array.map { |arg| shell_escape(arg) }.join(' ') end