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

Add ruby support #292

Closed
wants to merge 7 commits into from
Closed

Conversation

tim-coutinho
Copy link
Contributor

@tim-coutinho tim-coutinho commented Dec 25, 2020

This addresses #38.

@alichtman
Copy link
Owner

alichtman commented Dec 26, 2020

The reinstallation fails on my system.

$ gem list | tail -n+1 | sed 's/(/--version /' | sed 's/)//' | xargs -L 1 gem install
ERROR:  While executing gem ... (Gem::Requirement::BadRequirementError)
    Illformed requirement ["default:"]
ERROR:  While executing gem ... (Gem::Requirement::BadRequirementError)
    Illformed requirement ["default:"]
ERROR:  While executing gem ... (Gem::Requirement::BadRequirementError)
    Illformed requirement ["default:"]
Fetching bundler-unload-1.0.2.gem
Successfully installed bundler-unload-1.0.2
Parsing documentation for bundler-unload-1.0.2
Installing ri documentation for bundler-unload-1.0.2
Done installing documentation for bundler-unload after 0 seconds
1 gem installed
ERROR:  While executing gem ... (Gem::Requirement::BadRequirementError)
    Illformed requirement ["default:"]
ERROR:  While executing gem ... (Gem::Requirement::BadRequirementError)
    Illformed requirement ["default:"]
ERROR:  While executing gem ... (Gem::Requirement::BadRequirementError)
    Illformed requirement ["default:"]
ERROR:  While executing gem ... (Gem::Requirement::BadRequirementError)
    Illformed requirement ["default:"]
ERROR:  While executing gem ... (Gem::Requirement::BadRequirementError)
    Illformed requirement ["default:"]
ERROR:  While executing gem ... (Gem::Requirement::BadRequirementError)
    Illformed requirement ["default:"]
$  gem list | tail -n+1 | sed 's/(/--version /' | sed 's/)//' | xargs -L 1 echo
benchmark --version default: 0.1.0
bigdecimal --version default: 2.0.0
bundler --version default: 2.1.2
bundler-unload --version 1.0.2
cgi --version default: 0.1.0
csv --version default: 3.1.2
date --version default: 3.0.0
delegate --version default: 0.1.0
did_you_mean --version default: 1.4.0
etc --version default: 1.1.0
executable-hooks --version 1.6.0
fcntl --version default: 1.0.0
fiddle --version default: 1.0.0
fileutils --version default: 1.4.1
forwardable --version default: 1.3.1
gdbm --version default: 2.1.0
gem-wrappers --version 1.4.0
getoptlong --version default: 0.1.0
io-console --version default: 0.5.3
ipaddr --version default: 1.2.2
irb --version default: 1.2.1
json --version default: 2.3.0
logger --version default: 1.4.2
matrix --version default: 0.2.0
minitest --version 5.13.0
mutex_m --version default: 0.1.0
net-pop --version default: 0.1.0
net-smtp --version default: 0.1.0
net-telnet --version 0.2.0
observer --version default: 0.1.0
open3 --version default: 0.1.0
openssl --version default: 2.1.2
ostruct --version default: 0.2.0
power_assert --version 1.1.5
prime --version default: 0.1.1
pstore --version default: 0.1.0
psych --version default: 3.1.0
racc --version default: 1.4.16
rake --version 13.0.1
rdoc --version default: 6.2.1
readline --version default: 0.0.2
readline-ext --version default: 0.1.0
reline --version default: 0.1.2
rexml --version default: 3.2.3
rss --version default: 0.2.8
rubygems-bundler --version 1.4.5
rvm --version 1.11.3.9
sdbm --version default: 1.0.0
singleton --version default: 0.1.0
stringio --version default: 0.1.0
strscan --version default: 1.0.3
test-unit --version 3.3.4
timeout --version default: 0.1.0
tracer --version default: 0.1.0
uri --version default: 0.10.0
webrick --version default: 1.6.0
xmlrpc --version 0.3.0
yaml --version default: 0.1.0
zlib --version default: 1.1.0

I think there's probably a better format to keep the install list in that would make it easy to reinstall from. Additionally, please send tested PRs, and definitely make a note if it is untested / there are bugs.

@tim-coutinho
Copy link
Contributor Author

Interesting, it was working earlier when I was testing it on my machine, perhaps there was a recent change in gem list's functionality that added the default: to some version numbers.

return process.returncode
else:
print_path_red("An error occurred while running: $", command)
print_yellow("Package manager not present.")
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
print_yellow("Package manager not present.")
print_path_red("An error occurred while running: $", command)

Copy link
Owner

Choose a reason for hiding this comment

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

I think it makes sense to keep the error messages in run_cmd_write_stdout pretty abstract. It's a util function, and we let the calling function know of the error with the error code returned. A more specific error message can be printed from there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, though there won't be an error code to check in this case, as a FileNotFoundError results in a return of None. I can change it to something like Command not found, which is a bit more general and accurate to what a return of None represents.

@alichtman
Copy link
Owner

alichtman commented Dec 26, 2020

Hmm, interesting. I'm using gem 3.1.2. We might need to run a different command to backup / reinstall with gem. I'm not super familiar with gem, though, and don't have time to dig into it at the moment.

@tim-coutinho
Copy link
Contributor Author

My latest commit fixes the issue, just had to update the backup command.

@alichtman alichtman mentioned this pull request May 29, 2021
@alichtman
Copy link
Owner

@tim-coutinho Sorry for taking so long to get around to this. Rebase off master and then I'll merge this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants