Skip to content

Support current alias #1426

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Support current alias #1426

wants to merge 1 commit into from

Conversation

andyw8
Copy link
Contributor

@andyw8 andyw8 commented Mar 4, 2023

From the suggestion in #1417 (comment)

I think current would be clearer though. latest might be interpreted as the latest commit on master.

Closes #1215

config/routes.rb Outdated
@@ -8,7 +8,7 @@

ruby_versions = RubyConfig.ruby_versions.collect { |v| Regexp.escape(v.version) }

scope "(:version)", constraints: { version: /#{ruby_versions.join("|")}/ } do
scope "(:version)", constraints: { version: /#{ruby_versions.join("|")}|latest/ } do
Copy link
Contributor Author

@andyw8 andyw8 Mar 4, 2023

Choose a reason for hiding this comment

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

Since RubyConfig.version_for("current") would return nil, no other change is needed.

version = RubyConfig.version_for(params[:version]) || RubyConfig.default_ruby_version

Copy link
Member

@colby-swandale colby-swandale Mar 9, 2023

Choose a reason for hiding this comment

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

I would prefer to not rely on an unspecified rule as the way to support this feature. It's hard for anyone reading the code for the first time to understand this and it's very easy to break unintentionally. I think we should have a special case for current and be able to handle it transparently.

@andyw8 andyw8 mentioned this pull request Mar 4, 2023
@andyw8 andyw8 changed the title Support latest alias Support current alias Mar 4, 2023
@andyw8
Copy link
Contributor Author

andyw8 commented Mar 4, 2023

Updated to use current.

@andyw8 andyw8 marked this pull request as ready for review March 4, 2023 21:40
@natematykiewicz
Copy link
Contributor

I've not pulled this up locally yet, but do all of the links display as "current" or "3.2" when you pull up "current" documentation?

@andyw8
Copy link
Contributor Author

andyw8 commented Mar 4, 2023

As "3.2"

@natematykiewicz
Copy link
Contributor

natematykiewicz commented Mar 4, 2023

That seems fine for now. Maybe later we can support making those say "current", so that your documentation links don't lose that.

For example here:
image

Copy link
Contributor

@natematykiewicz natematykiewicz left a comment

Choose a reason for hiding this comment

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

LGTM. Thoughts @colby-swandale?

@colby-swandale
Copy link
Member

That seems fine for now. Maybe later we can support making those say "current", so that your documentation links don't lose that.

For example here: image

I feel this PR is not really complete without this. It's great that we're allowing current, but i don't see what value to UX it provides when clicking on any link resets you back to the specific version.

Could we also have some tests to ensure this feature is working as intended?

Thanks.

@cpjmcquillan
Copy link

This would be great for something like a DuckDuckGo bang to search the docs.

FWIW, in that scenario it wouldn't be a problem for me personally if the links referred to the specific version 👍

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.

Introduce current in url
4 participants