Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fixed load gem completion bug when gem dir != gem name #7

Closed
wants to merge 2 commits into from

2 participants

@janlelis

For example ripl/plugin ;)
Maybe it's better to look at every require_dir or just say 'lib' instead of spec.require_paths.last

@cldwalker
Owner

This is a valid concern but your solution only solves this for rubygems users. Being mostly a rip user, I'd like to solve this for all gems independent of the gem manager (hence the $: technique).

@cldwalker
Owner

Resolved with 1564ac6 . For fresh, just move bond/completions/ripl-fresh.rb to ripl/completions/fresh.rb. No need for the lib/ripl-fresh hack anymore.

@janlelis

Thanks :)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 19, 2010
  1. @janlelis
Commits on Dec 11, 2010
  1. @janlelis
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 3 deletions.
  1. +1 −1  ext/readline_line_buffer/extconf.rb
  2. +5 −2 lib/bond/m.rb
View
2  ext/readline_line_buffer/extconf.rb
@@ -7,7 +7,7 @@ def dummy_makefile
}
end
-if RUBY_VERSION < '1.9.2'
+if RUBY_VERSION < '1.9.2' && !defined?(JRUBY_VERSION)
dir_config("readline")
have_library('readline')
if !have_header('readline/readline.h')
View
7 lib/bond/m.rb
@@ -77,7 +77,10 @@ def started?
# Finds the full path to a gem's file relative it's load path directory. Returns nil if not found.
def find_gem_file(rubygem, file)
begin gem(rubygem); rescue Exception; end
- (dir = $:.find {|e| File.exists?(File.join(e, file)) }) && File.join(dir, file)
+ spec = Gem.source_index.find_name(rubygem).last
+ # spec.require_path
+ dir = File.join(spec.full_gem_path, spec.require_paths.last) # ?? 'lib'
+ dir && File.join(dir, file)
end
# Loads a completion file in Rc namespace.
@@ -105,7 +108,7 @@ def home
protected
def load_gem_completion(rubygem)
- (dir = find_gem_file(rubygem, File.join(rubygem, '..', 'bond'))) ?
+ (dir = find_gem_file(rubygem, 'bond')) ?
load_dir(dir) : $stderr.puts("Bond Error: No completions found for gem '#{rubygem}'.")
end
Something went wrong with that request. Please try again.