Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix "guard init" command #43

Merged
merged 1 commit into from

3 participants

@brainopia

Commit 59f555e introduced a following problem, Gem.locate_guard returns incorrect path.

Before aforementioned commit the method was returning a path to gem folder, eg:

$ gem open guard-minitest --latest --command echo
/Users/brainopia/.rvm/gems/ruby-1.8.7-p334/gems/guard-minitest-0.3.0

But after the commit it returns:

$ gem which guard/minitest

And since Guard::Guard.init depends on this method, there is an error when you trying to init specific guard:

$  guard init minitest
Writing new Guardfile to /Users/brainopia/code/rails/ororo/Guardfile
/Users/brainopia/.rvm/gems/ruby-1.9.2-p180/gems/guard-0.3.1/lib/guard/guard.rb:15:in `read': Not a directory - /Users/brainopia/.rvm/gems/ruby-1.9.2-p180/gems/guard-minitest-0.3.0/lib/guard/minitest.rb/lib/guard/minitest/templates/Guardfile (Errno::ENOTDIR)

I've fixed this problem without reintroducing dependency on open_gem with following line of code:

Gem.source_index.find_name("guard-#{name}").last.full_gem_path
@rymai rymai merged commit 097ce1f into guard:master
@rymai
Owner

Hey thanks, that looks great indeed!

Merged!

@avdi

Thanks, I was just about to fix this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 16, 2011
  1. @brainopia
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/guard.rb
View
2  lib/guard.rb
@@ -91,7 +91,7 @@ def get_guard_class(name)
end
def locate_guard(name)
- `gem which guard/#{name}`.chomp
+ Gem.source_index.find_name("guard-#{name}").last.full_gem_path
rescue
UI.error "Could not find 'guard-#{name}' gem path."
end
Something went wrong with that request. Please try again.