open_gem icon indicating copy to clipboard operation
open_gem copied to clipboard

Only load "launchy" when it is needed

Open rubiety opened this issue 13 years ago • 3 comments

Currently lib/rubygems/commands/read_command.rb has this as the first line, which is run as soon as this file is loaded:

require 'launchy'

This is a problem because:

  1. Since this is a gem plugin, this is effectively required every time you run "rubygems" - that just shouldn't be necessary.
  2. More importantly: since this is being required when requiring rubygems, this is required outside the context of bundler. This is the source of peoples' issues with reported "Already activated 'launchy'" problems, since this is being loaded before bundler even has a chance to initialize.

It would be best if this require line was moved somewhere such that launchy was only required at runtime when actually needed.

Gem plugins have to be very careful of what they do outside of the runtime commands.

rubiety avatar Mar 29 '11 23:03 rubiety

That makes sense, I'm mostly just developing and using Qwandry these days, but I should really patch up open_gem.

On Tue, Mar 29, 2011 at 4:36 PM, rubiety < [email protected]>wrote:

Currently lib/rubygems/commands/read_command.rb has this as the first line, which is run as soon as this file is loaded:

require 'launchy'

This is a problem because:

  1. Since this is a gem plugin, this is effectively required every time you run "rubygems" - that just shouldn't be necessary.
  2. More importantly: since this is being required when requiring rubygems, this is required outside the context of bundler. This is the source of peoples' issues with reported "Already activated 'launchy'" problems, since this is being loaded before bundler even has a chance to initialize.

It would be best if this require line was moved somewhere such that launchy was only required at runtime when actually needed.

Reply to this email directly or view it on GitHub: https://github.com/adamsanderson/open_gem/issues/12

adamsanderson avatar Mar 30 '11 01:03 adamsanderson

Is there any ETA on a (literally one line) fix for this issue? It continues to cause me quite a few problems as a result of "guard" having open_gem as a dependency... so anyone using guard extensively is probably running into similar issues.

rubiety avatar Apr 18 '11 01:04 rubiety

Hi, FYI guard no more have open_gem as a dependency in the last versions :)

thibaudgg avatar Apr 18 '11 06:04 thibaudgg