For example:
code = <<-EOH
bundle install
bundle exec unicorn -c /etc/unicorn.cfg -D
EOH
What does this code do? What is
It's called heredoc. An easy way to define multiline strings which may include single or double quotes without needing to escape them.
See more here, for example.
Often you use heredocs to define large chunks of code. Some editors know about this and can highlight syntax for you there (if you specify language). Look:
You can pass multiple commands in one block like this in Chef Recipe
bash 'Install ftppwd' do
code <<-EOH
mkdir #{ftppwd_dir}
chmod 775 #{ftppwd_dir}
chgrp #{batch_id} #{ftppwd_dir}/*
chown #{batch_id} #{ftppwd_dir}/*
EOH
Looks to me like heredoc. The -
allows the ending delimiter to ignore whitespace before it.
A simple Google Search gave me this.
There is also a newer HEREDOC syntax for Ruby <<~END
that more closely resembles what you would typically see in most shells and other languages with the ~
instead of the -
to tell Ruby to strip the leading whitespace to match the least indented line in the block.
https://infinum.co/the-capsized-eight/multiline-strings-ruby-2-3-0-the-squiggly-heredoc