Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use heredocs #2197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 17 additions & 13 deletions scripts/barclamp_install.rb
Expand Up @@ -135,23 +135,27 @@ def usage()
debug "#{target}/sha1sums file exists"
unless force_install or system "cd \"#{target}\"; sha1sum --status -c sha1sums"
debug "force_install mode is disabled and not all file checksums do match"
puts "Refusing to install over non-pristine target #{target}"
puts "Please back up the following files:"
system "cd \"#{target}\"; sha1sum -c sha1sums |grep -v OK"
puts "and rerun the install after recreating the checksum file with:"
puts " cd \"#{target}\"; find -type f -not -name sha1sums -print0 | \\"
puts" xargs -0 sha1sum -b >sha1sums"
puts "(or use the --force switch)"
print <<-EOF.gsub(/^ *\| /, '')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)

| Refusing to install over non-pristine target #{target}
| Please back up the following files:
| #{`system "cd \"#{target}\""; sha1sum -c sha1sums |grep -v OK`}
| and rerun the install after recreating the checksum file with:
| cd \"#{target}\"; find -type f -not -name sha1sums -print0 | \\
| xargs -0 sha1sum -b >sha1sums
| (or use the --force switch)
EOF
exit -1
end
elsif not force_install
debug "force_install mode is disabled and #{target}/sha1sums file does not exist"
puts "#{target} already exists, but it does not have checksums."
puts "Please back up any local changes you may have made, and then"
puts "create a checksums file with:"
puts " cd \"#{target}\"; find -type f -not -name sha1sums -print0 | \\"
puts" xargs -0 sha1sum -b >sha1sums"
puts "(or use the --force switch)"
print <<-EOF.gsub(/^ *\| /, '')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. (https://github.com/bbatsov/ruby-style-guide#consistent-string-literals)

| #{target} already exists, but it does not have checksums.
| Please back up any local changes you may have made, and then
| create a checksums file with:
| cd \"#{target}\"; find -type f -not -name sha1sums -print0 | \\
| xargs -0 sha1sum -b >sha1sums
| (or use the --force switch)
EOF
exit -1
end
end
Expand Down