Permalink
Browse files

Fixed reloading to work when watchr is not bundled.

  • Loading branch information...
laynor committed Feb 10, 2012
1 parent 3baaa46 commit 279cd4ad78777f32aadcc39f3233d7f3aa1076f3
Showing with 13 additions and 5 deletions.
  1. +13 −5 lib/rspec-rails-watchr-emacs.rb
@@ -225,9 +225,19 @@ def abort_watchr!
abort("\n")
end
+ def bundled?(gem)
+ `bundle show #{gem}`
+ $? == 0
+ end
+
+
def reload!
# puts ARGV.join(' ')
- exec('bundle exec watchr')
+ if bundled? "watchr"
+ exec('bundle exec watchr ' + @cli_args.join(' '))
+ else
+ exec('watchr ' + @cli_args.join(' '))
+ end
end
def reload_file_list
@@ -321,7 +331,9 @@ def initialize watchr, options = {}
# matching spec files for the path given.
:custom_matcher => nil }
+
options = @default_options.merge(options)
+ @cli_args = ARGV.to_a
puts "========OPTIONS=========="
puts options
puts "========================="
@@ -339,10 +351,6 @@ def initialize watchr, options = {}
check_if_bundle_needed
init_network
@watchr = watchr
-
-
-
-
watchr.watch('^spec/(.*)_spec\.rb$') {|m| rspec_files specs_for(m[1])}

0 comments on commit 279cd4a

Please sign in to comment.