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

Check for user input in cloudfront_client.rb #24

Open
wants to merge 2 commits 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/configure-s3-website/cloudfront_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def self.create_distribution_if_user_agrees(options, standard_input)
# Do nothing
else
puts 'Do you want to deliver your website via CloudFront, Amazon’s CDN service? [y/N]'
case standard_input.gets.chomp
user_answer = standard_input.gets
print_headless_hint_and_exit if user_answer.nil?
case user_answer.chomp
when /(y|Y)/ then create_distribution options
end
end
Expand Down Expand Up @@ -71,6 +73,11 @@ def self.create_distribution(options)
end
end

def self.print_headless_hint_and_exit
puts 'No response detected. If you are running the command in a non-interactive session, you can use s3_website cfg apply --headless'
exit 1
end

def self.print_report_on_custom_distribution_config(custom_distribution_config, left_padding = 4)
puts ' Applied custom distribution settings:'
puts custom_distribution_config.
Expand Down