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

Ensure YardocTask requires yard itself #1598

Closed
wants to merge 1 commit into from

Conversation

jasonkarns
Copy link

@jasonkarns jasonkarns commented Dec 20, 2024

Description

The yard task is not self contained at the moment and does not run without yard itself first being loaded.

It's preferable for rake tasks to be self-contained (the YardocTask should require its dependencies so users may require just the tasklib itself).

Fixes #1597

Completed Tasks

  • I have read the Contributing Guide.
  • The pull request is complete (implemented / written).
  • Git commits have been cleaned up (squash WIP / revert commits).
  • I wrote tests and ran bundle exec rake locally (if code is attached to PR).
    • rake spec passes locally. No tests added yet. Wanting feedback first before spending time deciphering test suite.

require_relative is available since ruby 1.9.2.

We aren't using `require` here so that we're not dependent on yard being
in the $LOAD_PATH.

Additionally, we only require yard just before the task is running.
This way we don't impact the load time of the Rakefile itself.
@lsegal
Copy link
Owner

lsegal commented Dec 21, 2024

Based on #1597, the intended API for loading the YardocTask is to require 'yard' so as to not introduce an implicit potential breaking change dependency on the file system structure of the YARD codebase. As such, this change should generally not be necessary. The majority of YARD is loaded lazily (except config loading, which is roughly a no-op if a config is not present), so unless there is specific data that shows a performance issue with this approach, I think it's best to stick with the safer API.

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

Successfully merging this pull request may close these issues.

Yard rake task is missing require
2 participants