-
Notifications
You must be signed in to change notification settings - Fork 0
FB-16931 Ruby 3.1 #7
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
base: master
Are you sure you want to change the base?
Conversation
|
|
||
| 1. Copy on your personl SSH keys to ~/.ssh (including the one you use to access GitHub). | ||
| 1. On another machine (maybe) set up a GitHub [personal access token][1]. | ||
| 1. Create a file in the following format and copy it to `~/.config/hub`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is hub still the recommended tool? I'm using gh which has a hub auth command to help set it up (rather than manually creating its config file)
| echo "Aborting! No curl found (install and retry)" | ||
| exit 5 | ||
| echo "Requesting sudo access to install packages if needed" | ||
| sudo date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think sudo -v (validate) will prompt (if necessary) for the user's password and otherwise not output anything - could be good to avoid the "unnecessary" date output
|
|
||
| if ! [ -x "$(command -v curl)" ]; then | ||
| echo "Installing curl..." | ||
| sudo apt-get install -y curl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is non-portable - does a base X Linux distribution not include curl?
| echo "No suitable Ruby found (installing vendor Ruby)" | ||
| eval "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install-ruby)" | ||
| if [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then | ||
| echo "Ensure you have your GitHub SSH key at ~/.ssh/id_rsa.pub" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like (at least) GitHub recommend a ed25519 key, which doesn't use the same naming convention:
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key
If you are using a legacy system that doesn't support the Ed25519 algorithm, use: [an rsa key]
| brew install rbenv | ||
| fi | ||
|
|
||
| if [ ! -f "$HOME/.rbenv/shims/ruby" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably we can ask rbenv if it's got an installed ruby - perhaps with rbenv version? I don't think we should hard-code this file path
| if [ ! -f "$HOME/.rbenv/shims/ruby" ]; then | ||
| echo "No suitable Ruby found. Installing ruby via rbenv..." | ||
| sudo apt-get install -y libz-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt-dev | ||
| rbenv install 3.1.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3.1.4 is now the latest 3.1.X
| exit 1 | ||
| fi | ||
|
|
||
| GITHUB_TOKEN=$(ruby -e "require 'yaml'; puts YAML.load_file(Dir.home + '/.config/hub')['github.com'][0]['oauth_token']") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another reason to use gh - here, this can be GITHUB_TOKEN=$(gh auth token)
| fi | ||
|
|
||
| ruby -e "$(run_curl)" | ||
| $HOME/.rbenv/shims/ruby -e "$(run_curl)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could say $(rbenv which ruby) -e "$(rub_curl)" to get/use the bin path of the relevant ruby
| @@ -47,4 +72,4 @@ if [ "$code" != "200" ]; then | |||
| exit 7 | |||
| fi | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This run_curl command seems to be used twice but if we download the file and check the status in one we can avoid it I think? Also run_curl isn't a very good name (since we're modifying this file) - how about download_bamstrap_script
Something like: code=$(run_curl -o bamstrap.rb -w "%{http_code}") and then later ruby bamstrap.rb
|
Review with changes requested |
Changes to make bambrew work more simply and to work with with ruby 3.1.