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

Calculate new repository link from ssh path in configure script #1614

Merged
merged 3 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion bin/configure-scripts/deploy_button_heroku.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
add_button = ask_boolean "Would you like to add a 'Deploy to Heroku' button to your project.", "y"
if add_button
puts "Adding a 'Deploy to Heroku' button.".green
new_repo_link = ask "What is the https variant of your repo URL? (Something like: https://github.com/your-org/your-repo)"
new_repo_link = if SETUP_GITHUB
HTTP_PATH
else
ask "What is the https variant of your repo URL? (Something like: https://github.com/your-org/your-repo)"
end

File.open("README.md", "a") do |readme|
button = File.read(button_file)
Expand Down
6 changes: 5 additions & 1 deletion bin/configure-scripts/deploy_button_render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
add_button = ask_boolean "Would you like to add a 'Deploy to Render' button to your project.", "y"
if add_button
puts "Adding a 'Deploy to Render' button.".green
new_repo_link = ask "What is the https variant of your repo URL? (Something like: https://github.com/your-org/your-repo)"
new_repo_link = if SETUP_GITHUB
HTTP_PATH
else
ask "What is the https variant of your repo URL? (Something like: https://github.com/your-org/your-repo)"
end

File.open("README.md", "a") do |readme|
button = File.read(button_file)
Expand Down
11 changes: 8 additions & 3 deletions bin/configure-scripts/setup_github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
puts "If you would like to use another service like Gitlab to manage your repository,"
puts "you can opt out of this step and set up the repository manually."
puts "(If you're not sure, we suggest going with GitHub)"
setup_github = ask_boolean "Continue setting up with GitHub?", "y"

puts "setup_github = #{setup_github}"
if setup_github
# We use this variable in the `deploy_button_heroku.rb` and `deploy_button_render.rb` scripts.
SETUP_GITHUB = ask_boolean "Continue setting up with GitHub?", "y"

puts "SETUP_GITHUB = #{SETUP_GITHUB}"
if SETUP_GITHUB
if `git remote | grep origin`.strip.length > 0
puts "Repository already has a `origin` remote.".yellow
else
Expand All @@ -31,6 +33,9 @@
if ssh_path == "skip"
puts "Bailing out of GitHub setup.".yellow
return
else
# We use this variable in the `deploy_button_heroku.rb` and `deploy_button_render.rb` scripts.
HTTP_PATH = "https://github.com/#{ssh_path.gsub(/.*:/, "")}".delete_suffix(".git")
end
puts "Setting repository's `origin` remote to `#{ssh_path}`.".green
puts `git remote add origin #{ssh_path}`.chomp
Expand Down
Loading