Created
March 1, 2016 23:47
-
-
Save denstepa/bc4ddea61e5f8d668ef8 to your computer and use it in GitHub Desktop.
capistrano 3 task to update robots.txt for staging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Uploads a robots.txt that mandates the site as off-limits to crawlers" | |
task :block_robots do | |
content = [ | |
'# This is a staging site. Do not index.', | |
'User-agent: *', | |
'Disallow: /' | |
].join($/) | |
on roles(:all) do | |
within release_path do | |
puts "Uploading blocking robots.txt" | |
execute(:echo, "\"#{content}\" > public/robots.txt") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment