Module: CrossplatformShellwords

Defined in:
fastlane_core/lib/fastlane_core/core_ext/shellwords.rb

Overview

Here be helper

Class Method Summary collapse

Class Method Details

.shellescape(str) ⇒ Object

handle switching between implementations of shellescape



23
24
25
26
27
28
29
30
31
32
# File 'fastlane_core/lib/fastlane_core/core_ext/shellwords.rb', line 23

def shellescape(str)
  if FastlaneCore::Helper.windows?
    WindowsShellwords.shellescape(str)
  else
    # using `escape` instead of expected `shellescape` here
    # which corresponds to Shellword's `String.shellescape` implementation
    # https://github.com/ruby/ruby/blob/1cf2bb4b2085758112503e7da7414d1ef52d4f48/lib/shellwords.rb#L216
    Shellwords.escape(str)
  end
end

.shelljoin(array) ⇒ Object

make sure local implementation is also used in shelljoin



36
37
38
# File 'fastlane_core/lib/fastlane_core/core_ext/shellwords.rb', line 36

def shelljoin(array)
  array.map { |arg| shellescape(arg) }.join(' ')
end