lib/specinfra/command/base/file.rb in specinfra-2.0.0.beta39 vs lib/specinfra/command/base/file.rb in specinfra-2.0.0.beta40

- old
+ new

@@ -33,14 +33,14 @@ 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" + sed += " | sed -n 1,#{escape(to)}p" if from != '1' and to != '$' checker_with_regexp = check_contains_with_regexp("-", expected_pattern) checker_with_fixed = check_contains_with_fixed_strings("-", expected_pattern) - "#{sed} | #{sed_end} | #{checker_with_regexp} || #{sed} | #{sed_end} | #{checker_with_fixed}" + "#{sed} | #{checker_with_regexp} || #{sed} | #{checker_with_fixed}" end def check_contains_lines(file, expected_lines, from=nil, to=nil) require 'digest/md5' from ||= '1' @@ -71,10 +71,10 @@ def get_content(file) "cat #{file} 2> /dev/null || echo -n" end def check_is_mounted(path) - regexp = "on #{path}" + regexp = "on #{path} " "mount | grep -w -- #{escape(regexp)}" end def get_mode(file) "stat -c %a #{escape(file)}"