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

[all][update.rb] feat: additional Update options #734

Open
wants to merge 10 commits into
base: staging
Choose a base branch
from

Conversation

OSXLich-Doug
Copy link
Contributor

@OSXLich-Doug OSXLich-Doug commented Jan 24, 2025

This is a fundamental change to our update methodology. New feature is

;lich5-update --install --version=<tag> --lib=<file.rb>

--install is required to ensure this is really what the user wants
--version is required and must match an existing tag
--lib is optional and is intended to allow point update.

This needs thorough testing, but - I would strongly recommend you not test it against your existing cloned Lich. It does delete files / folders, making the commit status an absolute mess.

And remember during your testing, if you see something you didn't like, ;lich5-update --revert is your best friend.

@mrhoribu mrhoribu changed the title first update to update.rb for 5.11 [all][update.rb] feat: additional Update options Jan 24, 2025
lib/util/update.rb Outdated Show resolved Hide resolved
Comment on lines 337 to 338
remote_repo = "https://raw.githubusercontent.com/elanthia-online/lich-5/refs/tags/v#{version}/lib/#{requested_file}"
remote_repo = nil unless validate_url_request(remote_repo)
Copy link
Contributor

Choose a reason for hiding this comment

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

this needs correction to be:

            remote_repo = "https://raw.githubusercontent.com/elanthia-online/lich-5/refs/tags/v#{version}/lib"
            remote_repo = nil unless validate_url_request(File.join(remote_repo, requested_file))

Otherwise the follow-up download will have a double requested file at the end of the URL. Also wouldn't hurt to move the validation to after the case statement and then do a validate_url_request then before the File.delete section (after bad extension)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like the preceding feedback point, this also will simply error out if the specific URL doesn't exist - whether it's by version or by file, with an error message. However, in re-reviewing to ensure I had my fact correct, I believe there is a problem here to address. Specifically, with all of our subdirs, the above does not account for namespace / folder location nor is there any captured input from the user. While this fails out appropriately for a file misnamed in the lib folder, if fails out inappropriately for a file in a subfolder in lib.

I'll have to consider that solution. I'm not a huge fan of --lib=commons/gtk.rb and all that might entail. I'm also not sure I'm interested in walking a specific version tree hunting for a file location either. Choices, choices. It's current location is intended to ensure no file activities (inluding zero byte file creation) occur before the determination is made. I'll look over it again, while solving the subfolder debacle.

Copy link
Contributor

@mrhoribu mrhoribu Jan 25, 2025

Choose a reason for hiding this comment

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

it does respect namespace/folder as you'd be passing it as --library=util\update.rb in the path which is another reason why we need to ensure no "spaces" in library filenames or folder paths. The issue I see here is that you're appending the FILE to the end of the base URL here, and then further down below, doing that again via:

              file.write URI.parse(File.join(remote_repo, requested_file)).open.read

So the remote_repo there has requested file already attached. So need to not do that in this section that I've attached the review comment too, similar to the other case sections are doing.

lib/util/update.rb Outdated Show resolved Hide resolved
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.

2 participants