adamsanderson / open_gem

Gem Command to easily open a ruby gem with the editor of your choice. (For a more flexible solution, see Qwandry)
http://endofline.wordpress.com
173 stars 23 forks source link

Only load "launchy" when it is needed #12

Open rubiety opened 13 years ago

rubiety commented 13 years ago

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.

adamsanderson commented 13 years ago

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 < reply@reply.github.com>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

rubiety commented 13 years ago

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.

thibaudgg commented 13 years ago

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