Method: Specinfra::Command::Windows::Base::File.check_contains_within

Defined in:
lib/specinfra/command/windows/base/file.rb

.check_contains_within(file, pattern, from = nil, to = nil) ⇒ Object

[View source]

95
96
97
98
99
100
101
102
# File 'lib/specinfra/command/windows/base/file.rb', line 95

def check_contains_within file, pattern, from=nil, to=nil
  from ||= '^'
  to ||= '$'
  Backend::PowerShell::Command.new do
    using 'crop_text.ps1'
    exec %Q!(CropText -text (Get-Content("#{file}") | Out-String) -fromPattern '#{convert_regexp(from)}' -toPattern '#{convert_regexp(to)}') -match '#{pattern}'!
  end
end