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

Fix some warnings during bin/rake spec:deps #3986

Merged
merged 1 commit into from Oct 2, 2020

Conversation

deivid-rodriguez
Copy link
Member

@deivid-rodriguez deivid-rodriguez commented Oct 1, 2020

What was the end-user or developer problem that led to this PR?

If you have multiple versions of mustache or rdiscount installed on your system and you run bin/rake spec:deps from the root of the bundler folder, you'll get warnings like this:

WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
      rdiscount (>= 1.5.8)
      Available/installed versions of this gem:
      - 2.2.0.2
      - 2.2.0.1
      mustache (>= 0.7.0)
      Available/installed versions of this gem:
      - 1.1.1
      - 1.0.5
      - 0.99.8
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.

The explanation is that loading the Rakefile requires ronn for loading the man pages tasks. rdiscount and mustache are dependencies of ronn, but since there are multiple versions of them on the system, they are left unresolved until they are eventually required. However, during bin/rake spec:deps, bundler will change the rubygems environment to prepare for the specs and eventually calls Gem::Specification.reset to apply new gem paths. Since these gems are unresolved at that time, a warning is printed.

What is your fix for the problem, implemented in this PR?

The solution is to lazily require ronn only when man pages tasks are actually run.

This commit is best viewed ignoring whitespace changes.

Tasks:

  • Describe the problem / feature
  • Write tests
  • Write code to solve the problem
  • Get code review from coworkers / friends

I will abide by the code of conduct.

If you have multiple versions of `mustache` or `rdiscount` installed on
your system and you run `bin/rake spec:deps` from the root of the
`bundler` folder, you'll get warnings like this:

```
WARN: Unresolved or ambiguous specs during Gem::Specification.reset:
      rdiscount (>= 1.5.8)
      Available/installed versions of this gem:
      - 2.2.0.2
      - 2.2.0.1
      mustache (>= 0.7.0)
      Available/installed versions of this gem:
      - 1.1.1
      - 1.0.5
      - 0.99.8
WARN: Clearing out unresolved specs. Try 'gem cleanup <gem>'
Please report a bug if this causes problems.
```

The explanation is that loading the `Rakefile` requires `ronn` for
loading the man pages tasks. `rdiscount` and `mustache` are dependencies
of `ronn`, but since there are multiple versions of them on the system,
they are left unresolved until they are eventually required. However,
during `bin/rake spec:deps`, `bundler` will change the rubygems
environment to prepare for the specs and eventually calls
`Gem::Specification.reset` to apply new gem paths. Since these gems are
unresolved at that time, a warning is printed.

The solution is to lazily require ronn only when man pages tasks are
actually run.

This commit is best viewed ignoring whitespace changes.
@deivid-rodriguez deivid-rodriguez merged commit 21536b3 into master Oct 2, 2020
@deivid-rodriguez deivid-rodriguez deleted the fix_specification_reset_warning branch October 2, 2020 10:28
deivid-rodriguez added a commit that referenced this pull request Dec 7, 2020
Fix some warnings during `bin/rake spec:deps`

(cherry picked from commit 21536b3)
deivid-rodriguez added a commit that referenced this pull request Dec 7, 2020
Fix some warnings during `bin/rake spec:deps`

(cherry picked from commit 21536b3)
deivid-rodriguez added a commit that referenced this pull request Dec 7, 2020
Fix some warnings during `bin/rake spec:deps`

(cherry picked from commit 21536b3)
deivid-rodriguez added a commit that referenced this pull request Dec 7, 2020
Fix some warnings during `bin/rake spec:deps`

(cherry picked from commit 21536b3)
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.

None yet

2 participants