LoginSignup
0

More than 5 years have passed since last update.

Chefのnot_ifで、あるファイルにある複数行が存在するかをチェック

Last updated at Posted at 2018-05-29
add_text <<'EOC'
foo
bar
EOC

...
   not_if { `cat #{path}`.match('^' + Regexp.escape(add_text)) }
...

grep, diff, awk -v RS="", .include?など色々試しましたが、上の様になりました。
(.include?の場合、最初の行の先頭のチェックが難しい。)

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0