lmarlow/gemedit

Namegemedit
DescriptionGemedit lets you quickly open up the source for a gem in your favorite editor.
LanguageRuby
Topics
Watchers108
Forks9
Open issues1
Last push4/18/2012 3:09:53 PM +00:00
Github URLhttps://github.com/lmarlow/gemedit
Clone URLhttps://github.com/lmarlow/gemedit.git
SSH URL[email protected]:lmarlow/gemedit.git

Most active issues

Topic# Comments
`gem edit rspec` should use `bundle show` when in a directory with a Gemfile. In other words these should always be equivalent in a directory that has a Gemfile with an rspec specification.

bundle show rspec | xargs mate
gem edit rspec


Read comments
6
The VIM output is piped to STDOUT without letting me interact with the VIM interface. You can briefly see VIM's warning message:
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal


Read comments
6
Fixed deprecated Gem.find_by_name to use Gem::Specifications (Rubygems is expiring support of old syntax 11/1/2011).

Now rescues on failed #find_by_name, based on the new RubyGems syntax.

Fixed syntax of TestTask so it correctly runs.

All tests passing.


Read comments
4
How to reproduce


$ gem install whois
$ gem install gemedit
$ ruby-whois example.com

:29: warning: loading in progress, circular require considered harmful - /Users/weppos/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/bin/ruby-whois:9:in `
'
from :29:in `require'
from :29:in `require'
from /Users/weppos/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:1136:in `'
from /Users/weppos/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:968:in `load_plugins'
from /Users/weppos/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:968:in `each'
from /Users/weppos/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:976:in `block in load_plugins'
from /Users/weppos/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems.rb:976:in `load'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/gemedit-1.0.0/lib/rubygems_plugin.rb:3:in `'
from :29:in `require'
from :33:in `rescue in require'
from :33:in `require'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/gemedit-1.0.0/lib/gemedit.rb:2:in `'
from :29:in `require'
from :29:in `require'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/gemedit-1.0.0/lib/gemedit/edit_command.rb:2:in `'
from :29:in `require'
from :29:in `require'
from /Users/weppos/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/rubygems/version_option.rb:7:in `'
from :29:in `require'
from :29:in `require'
^C/Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/server/adapters/base.rb:126:in `initialize': Interrupt
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/server/adapters/base.rb:126:in `open'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/server/adapters/base.rb:126:in `ask_the_socket'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/server/adapters/base.rb:120:in `query_the_socket'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/server/adapters/standard.rb:34:in `request'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/server/adapters/base.rb:85:in `block in query'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/server/adapters/base.rb:109:in `with_buffer'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/server/adapters/base.rb:84:in `query'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/client.rb:79:in `block in query'
from /Users/weppos/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/lib/whois/client.rb:77:in `query'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/gems/whois-1.6.6/bin/ruby-whois:52:in `'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/bin/ruby-whois:19:in `load'
from /Users/weppos/.rvm/gems/ruby-1.9.2-p0/bin/ruby-whois:19:in `
'


Without `gemedit` the `ruby-whois` command doesn't raise any warning.

The line referenced in the stacktrace is the `require 'rubygems'` statement created by RubyGems whenever you install a Gem with a binary command.


#!/Users/weppos/.rvm/rubies/ruby-1.9.2-p0/bin/ruby -wKU
#
# This file was generated by RubyGems.
#
# The application 'whois' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems' # <-- here's the line

version = ">= 0"



Read comments
2
When running `gem edit`, I get the following deprecation warning. Here's ruby and ruby gems versions, and the full error message I'm seeing:


$ gem --version
1.8.6
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
$ gem edit oauth2
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /Users/eprice/.rvm/gems/[email protected]/gems/gemedit-1.0.0/lib/gemedit/edit_command.rb:52.
NOTE: Gem::SourceIndex#find_name is deprecated, use Specification.find_by_name. It will be removed on or after 2011-11-01.
Gem::SourceIndex#find_name called from /Users/eprice/.rvm/gems/[email protected]/gems/gemedit-1.0.0/lib/gemedit/edit_command.rb:52.
Opening the oauth2 gem, version 0.5.0, with mvim from /Users/eprice/.rvm/gems/[email protected]/gems/oauth2-0.5.0


Everything it still working correctly for now, but will apparently stop in a couple months.


Read comments
2
Fixed deprication correctly.
Now rescues on failed #find_by_name.
Fixed syntax of TestTask so it correctly runs.


Read comments
2
what's the difference between qwandry and your gemedit?


Read comments
1
Sorry it took so long, but I was having tons of issues trying to figure out how to test this.

Problems:
- Ruby 1.9 has rubygems embedded (cant run `gem update --system 1.4.2`)
- Can't mock Gem::VERSION since rubygems is dropping old syntax next month, so tests wont work.

So i just ended up testing it myself... 1.8.7 with rubygems 1.4.2 passed all tests, and 1.9.3 with rubygems 1.8.10 passed tests, so this fix works.

As for the other commits, the noob that I am cant figure out how to cherrypick commits to submit as a pull request. Sorry :(


Read comments
0