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

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

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


3
4
5
6
7
8
9
10
11
# File 'lib/specinfra/command/solaris/base/file.rb', line 3

def check_contains_within(file, expected_pattern, from=nil, to=nil)
  from ||= '1'
  to ||= '$'
  sed = "sed -n #{escape(from)},#{escape(to)}p #{escape(file)}"
  sed_end = "sed -n 1,#{escape(to)}p"
  checker_with_regexp = check_contains_with_regexp("/dev/stdin", expected_pattern)
  checker_with_fixed  = check_contains_with_fixed_strings("/dev/stdin", expected_pattern)
  "#{sed} | #{sed_end} | #{checker_with_regexp}|| #{sed} | #{sed_end} | #{checker_with_fixed}"
end